Saturday, February 22, 2020

How To Install Gitea Git Service With Apache2 on Ubuntu 18.04

 Video Tutorial -https://youtu.be/zcSguHqH0Iw

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Gitea is an alternative open source, self-hosted version control system powered by git. Gitea is written in Golang and is a lightweight solution to be hosted on any platform.
𝐎𝐟𝐟𝐜𝐢𝐚𝐥 𝐖𝐞𝐛𝐬𝐢𝐭𝐞:https://gitea.io/en-us/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 𝐎𝐮𝐫 𝐒𝐞𝐫𝐯𝐞𝐫 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧- 𝐎𝐬:𝐔𝐛𝐮𝐧𝐭𝐮 𝟏𝟖.𝟎𝟒 𝐋𝐓𝐒 𝐁𝐢𝐨𝐧𝐢𝐜 𝐁𝐞𝐚𝐯𝐞𝐫 𝟔𝟒𝐁𝐢𝐭 | 𝐇𝐨𝐬𝐭𝐧𝐚𝐦𝐞 :𝐰𝐰𝐰.𝐲𝐨𝐮𝐫𝐝𝐨𝐦𝐚𝐢𝐧.𝐜𝐨𝐦   |𝐈𝐏 𝐚𝐝𝐝𝐫𝐞𝐬𝐬- 𝟏𝟗𝟐.𝟏𝟔𝟖.𝟏.𝟓𝟎   
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lsb_release -cd ; hostname ; hostname -I ; whoami ; getconf LONG_BIT ; apt install -y build-essential software-properties-common net-tools git make wget curl lsb-release

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 ; add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.4/ubuntu bionic main'

apt-get update ; apt install -y apache2 mariadb-server mariadb-client
systemctl start apache2 mariadb ; systemctl enable apache2 mariadb ; mysql_secure_installation
a2enmod proxy proxy_http

mysql -u root -p
create database db;
grant all on db.* to 'dbuser'@'localhost' identified by 'dbpass';
flush privileges;
quit

wget https://github.com/go-gitea/gitea/releases/download/v1.5.1/gitea-1.5.1-linux-amd64
cp gitea-1.5.1-linux-amd64 /usr/local/bin/gitea ; chmod 755 /usr/local/bin/gitea
adduser --system --shell /bin/bash --group  --disabled-password --home /home/gitea gitea
mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log} ; chown gitea:gitea /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log} ; chmod 750 /var/lib/gitea/{data,indexers,log} ; chmod 770 /etc/gitea

nano /etc/systemd/system/gitea.service
[Unit]
Description=Gitea
After=syslog.target
After=network.target
After=mysql.service

[Service]
RestartSec=2s
Type=simple
User=root
Group=root
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=root HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target
systemctl start gitea ; systemctl status gitea ; systemctl enable gitea

leafpad /etc/apache2/sites-available/yourdomain.conf
<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAdmin admin@yourdomain.com
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/
    TransferLog /var/log/apache2/yourdomain_access.log
    ErrorLog /var/log/apache2/yourdomain_error.log
</VirtualHost>

a2ensite yourdomain ; a2dissite 000-default.conf  ; apache2ctl configtest ; echo "192.168.1.50 www.yourdomain.com" >> /etc/hosts ; systemctl reload apache2
http://www.yourdomain.com/install. Y

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment