Установка Git Server + Gitea на Ubuntu 20.04

В даному прикладі розглянемо установку Git Server і Gitea на чистому сервері Ubuntu 20.04.

  1. Налаштування Mysql
  2. Встановлення Gitea
  3. Приклад роботи с Gitea

Для початку встановимо основні компоненти:

apt-get install git mysql-server-8.0 mailutils

Для повноцінної роботи відправки поштових повідомлень і роботи Gitea рекомендуємо направити на сервер домен\піддомен.

Налаштування Mysql.

Запустіть команду щоб увійти в консоль mysql:

mysql

Створимо користувача і базу даних gitea з паролем 08wefwojweg для подальшої установки Gitea:

CREATE USER 'gitea'@'localhost' IDENTIFIED BY '08wefwojweg';

CREATE DATABASE gitea;

GRANT ALL PRIVILEGES ON * . * TO 'gitea'@'localhost';

FLUSH PRIVILEGES;

Запам’ятовуємо дані, їх треба буде прописати при установці Gitea.

Вийти з консолі mysql можна за допомогою сполучень клавіш Ctrl + D.

Установка Gitea

Далі викачуємо файл установки Gitea:

wget -O gitea https://dl.gitea.io/gitea/1.13.3/gitea-1.13.3-linux-amd64
chmod +x gitea

Більш свіжі версії можна знайти на офіційній сторінці релізів: https://dl.gitea.io/gitea/

Перевіряємо чи встановлений git:

git --version

У нашому випадку:

git version 2.25.1

Далі, необхідно створити користувача для запуску платформи:

adduser --system --shell /bin/bash --gecos 'Git User' -group --disabled-password --home /home/git git

Після чого необхідно створити структуру каталогів:

mkdir -p /var/lib/gitea/{custom,data,log}
chown -R git:git /var/lib/gitea/
chmod -R 750 /var/lib/gitea/
mkdir /etc/gitea
chown root:git /etc/gitea
chmod 770 /etc/gitea

Налаштовуємо робочий каталог Gitea:

export GITEA_WORK_DIR=/var/lib/gitea/

Копіюємо файли платформи в робочу папку:

cp gitea /usr/local/bin/gitea

Далі, створюємо службу Gitea. для цього створіть файл служби:

nano /etc/systemd/system/gitea.service

Вміст файлу можна дізнатися за посиланням: https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service

Включаємо службу:

systemctl enable gitea

Та запускаємо:

sudo systemctl start gitea

За замовчуванням платформа Gitea працює на порту 3000, подивитися, запущена служба можна за допомогою команди:

netstat -tuwnlp | grep 3000

Якщо служба запущена, висновок команди буде наступним:

tcp6       0      0 :::3000                 :::*                    LISTEN      23312/gitea        

Відкрийте в браузері посилання: http://IP_SERVER:300 щоб побачити стартову сторінку. Або ж, якщо у Вас є повноцінний домен\піддомен – посилання буде виду: http://example.com:3000 – де, example.com – Ваш домен.

При відкритті Ви побачите стартову сторінку:

Натисніть на кнопку входу вгорі праворуч сторінки – ми перейдемо на сторінку установки:

Заповніть пункти розділу “Налаштування бази даних”, а саме користувача, базу і пароль. Нижче вкажіть IP SSH і базовий URL (IP або домен).

Нижче вкажіть дані до облікового запису адміністратора:

Так само, в розділі “Сервер і налаштування зовнішніх служб” можете встановити ті, які необхідні:

Натисніть на кнопку Установка Gitea і дочекайтеся закінчення, після чого Вас направить на головну сторінку, з якої потім можна буде залогінитися.

Работа з Gitea

Давайте перевіримо як працювати з цією платформою. Створіть новий відкритий репозиторій натиснувши на “+” вгорі меню:

Результат буде приблизно таким:

Створимо на локальній машині невеликий проект і завантажимо його в створений репозиторій.
Далі робота виконується на локальній (інший) машині.
Для початку створимо папку з проектом:

mkdir testgit ; cd testgit

Створимо два файли: ping.txt і simple.txt.

touch ping.txt  simple.txt

У перший запишемо висновок команди “ping -c4 8.8.8.8”:

ping -c4 8.8.8.8 > ping.txt

У другій текст:

echo "Hello World!" > simple.txt

Далі в цій же папці створюємо структуру сховища:

git init

Додаємо наш віддалений репозиторій:

git remote add origin  http://gitea.goodhoster.net:3000/goodhoster/test.git

Відстежуємо всі файли в папці з проектом:

git add .

Для прикладу можемо додати коментар на файли:

git commit -m "Test Message" 

Публікуємо наші файли в віддалений репозиторій:

git push -f origin master

При виконанні останньої команди нам потрібно ввести логін і пароль:

Username for 'http://gitea.goodhoster.net:3000': goodhoster
Password for 'http::3000':

Після чого висновок буде таким, що свідчить про успішну завантаженні:

Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 552 bytes | 552.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: . Processing 1 references
remote: Processed 1 references in total
To http://gitea.goodhoster.net:3000/goodhoster/test.git
+ 7c23d34...4ac1373 master -> master (forced update)

Оновлення сторінку з репозиторієм на на платформі Gitea і ви побачите зміни:

Зверніть увагу, конфігураційний файл Gitea зберігається по шляху /etc/gitea/app.ini. У ньому прописуються всі необхідні налаштування, такі як порт, база даних, базовий url, сервіси і т.д.
Більше можливостей можете дізнатися з офіційної документації: https://docs.gitea.io/en-us/

На цьому базова настройка Git server з платформою Gitea на Ubuntu 20.04 завершена.

Goodhoster.NET
Додати коментар

  1. Ashleyillek

    Всё подобранно просто супер.

    Відповіcти
  2. effibsuics

    ospMrU8fbhDCBMTs7nTDGr8PkkpxiAbu
    8jNKuDMTkotf5NhDR7sYWaygx2mE3NCQ
    sS2vb4kGbWsF4Gjpo8T493NRNr4bA6tV
    8GnfAImQlSawRjd39n6haL9IoxXffwfw
    ot5sE2DNx2RCUUQtb2a6CmvtEW79Nmis
    UHJcFYn77Cd9ibO4J0Qwjc8mQuRYalDD
    6E5BJH8Av3pb1nhwupREBlK25OjxoMMM
    bVcA2KVma895eFdmeuo4HgIyNeEDn518

    Відповіcти
  3. EllisSuime

    WARNING: The project I’m talking about opened in mid-February. It is possible to invest in it now, but read carefully. What is described in the text – it is a scheme of earnings, in which the risk was only with my personal money and the money of a friend!

    Why this project?

    In search of fast money completely by accident I stumbled on a fresh project. In my personal opinion, all signs of a Hyip project (@inTGBlockchain_BOT), but I am not sure about it, perhaps something related to bidding and investment, the full picture I have not managed to uncover, I can only share the results. And communication with bot like this in telegram is new for me.

    About multaccounts

    Probably everyone has played an MMORPG. And everyone was inspired by the idea to create his own bot to gain level, to get more time than other players! That’s how Multi-Accounts were born and they exploited the system mercilessly, increasing the requirements for adequate players.
    Projects similar to the one I’m describing are also famous for multi-accounts, which are created by crafty users. And this is our case. But big brother is watching you, and any ill-considered action can lead to a fatal mistake! Usually, the administration of the project completely demolishes both the leaders of the structures and their accounts. Funds can be considered as lost. But this project is not, at least for now. The authors do not limit the users in investing, and even invented not a few ways to spur the rate of earnings, but about that later.
    The only question is how to simulate the storm of investment activity without attracting the attention of the administration? By identifying the maximum vulnerability, we have developed a whole scheme, involving active and passive ways of income!

    Building the scheme

    For our task were identified such data as: an input of $ 10 per account, scattered on different blocks and ready, expect profits of a minimum of $ 20, and a maximum of $ 80, and all within 1-2 days. Sounds kind of unrealistic even at this stage, doesn’t it?

    Implementation

    The project accepts payment through a huge number of cryptocurrencies, which facilitates the task of replenishment dozens of times! Firstly we already had money on TRX wallets on different exchanges with my buddy. In total we had about 2000$ (little spoiler, now there is already 10 000$ and we continue investing in bot without any fear, because we recouped our investments in 5 times)
    20-30 main telegram accounts. From them we registered in @inTGBlockchain_BOT and were active building our own structure by referral links;
    We registered from 1 to 10 new accounts in @inTGBlockchain_BOT daily, recording our structure in a separate Excel table and saving our referral links there;
    All registrations were made with Tor-browser, we kept separate tables, which account was created under someone, confirmed e-mail and payeer accounts (where we were withdrawing earned money at first, as it turned out, the withdrawal is automatic for any crypto-wallet, which is also very convenient);
    For each new account, we poured $ 10 and distributed by blocks, the blocks were different, you could buy 10 blocks of $ 1, and you could buy 2 for $ 5, or only 1 block for $ 10;
    On behalf of each investor we left referral links on various platforms – the most effective was to spread links on the forums of gamblers and social networks in special communities.
    The initial process took us 1 day, and the first net profit went to 3 days. According to our terms, we gave business 3-4 hours a day, but every day it was a different time. All these activities were aimed only at one thing – as quickly as possible to build up their own structure and start generating revenue.
    The most difficult – it was to invite more and more new investors in the project, but the task is quite achievable, especially since we played for a large, and you can not take the risk and check our strategy for $ 10-20 using 2-3 Telegram accounts.

    The result of our investment

    We had a few rules: we use only sum of $2000, no reinvestments, we withdraw from the most profitable accounts as soon as the withdrawal allows, and we send other accounts for reinvestment and expansion.
    We had 12 teams, each of which had up to 20 pseudo-leaders and 5 times more bots;
    Our scheme has been working successfully for almost a month without any losses, which is actually unbelievable for us! The project continues to grow and attract new contributors, and we already have a net profit of $8000.
    I took my $ 1000 (of the original investment). I bought ether for 500$ and the other part was fixed in profit in USDT, if anyone is interested, I am solving the question about the rest of money now. My buddy decided to send his part to reinvestment, and I’m not used to risk too much. However, his indicators now are better than mine, because the system allows to withdraw money instantly.

    Withdrawal

    The scheme with multi-accounts is quite simple, but you have to follow a certain algorithm. If you approach the process responsibly, then any projects will be a source of semi-passive income for you with a minimum of effort, the main thing is to use affiliate links. The most important thing is that the project @inTGBlockchain_BOT, worked for a month and is not going to close. Good luck with your investments and profitable work on the Internet.

    Відповіcти
  4. RaymondBurce

    Впервые с начала спецоперации в украинский порт прителепалось иностранное торговое судно под погрузку. По словам министра, уже через две недели планируется выползти на уровень по меньшей мере 3-5 судов в сутки. Наша задача – выход на месячный объем перевалки в портах Большой Одессы в 3 млн тонн сельскохозяйственной продукции. По его словам, на сборе в Сочи президенты обсуждали поставки российского газа в Турцию. В больнице актрисе поведали о работе медицинского центра во время военного положения и передали подарки от малышей. Благодаря этому мир еще сильнее будет слышать, знать и понимать правду о том, что выходит в нашей стране.

    Відповіcти
  5. Monicaleque

    Я считаю, что Вы не правы. Предлагаю это обсудить. Пишите мне в PM, поговорим.

    Відповіcти