Gitea how to install

Gitea is a painless self-hosted Git service.
It is similar to GitHub, Bitbucket or Gitlab. The initial development have been done on Gogs but we have forked it and named it Gitea. If you want to read more about the reasons why we have done that please read this blog post.

Install/Run Gitea service

1) Pre-Requisite
# Install mariadb
yum -y install mariadb
mysql -u root -p
CREATE DATABASE gitea;
CREATE USER ‘gitea’@’localhost’;
SET PASSWORD FOR ‘gitea’@’localhost’ = PASSWORD(‘NEW_gitea’);
grant all privileges on gitea.* to ‘gitea’@’localhost’;

# Install go
wget “https://dl.google.com/go/go1.10.linux-amd64.tar.gz”
mv go1.10.linux-amd64.tar.gz /usr/local/
cd /usr/local/
tar -zxvf go1.10.linux-amd64.tar.gz
ln -s /usr/local/go/bin/go /usr/bin/go
echo “export GOROOT=/usr/local/go/” >> /etc/profile
echo “export GOPATH=/go/” >> /etc/profile

# Install git 2.x
/etc/yum.repos.d/wandisco.repo
[WandiscoSVN]
name=Wandisco SVN Repo
baseurl=http://opensource.wandisco.com/centos/$releasever/git/$basearch/
enabled=1
gpgcheck=0

yum clean all
yum -y install git (mus)

2) Install/Run Gitea service
Download Gitea binary from https://dl.gitea.io/gitea/master/
useradd -m git -d /go
su – git
wget https://dl.gitea.io/gitea/1.1.0/gitea-1.1.0-linux-amd64 -O gitea
chmod +x gitea
./gitea web
# Run gitea command as git user. default port is 3000.
# Open your browser to http://(SERVERIP):3000 (i changed my port to 8090)

3) Centos/RedHat SystemD
(start/stop script)
create /etc/systemd/system/gitea.service:
[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=mariadb.service

[Service]
Type=simple
User=git
Group=git
WorkingDirectory=/go
ExecStart=/go/gitea web
Restart=always
Environment=USER=git HOME=/go

[Install]
WantedBy=multi-user.target
to make it work via haproxy I did:

systemctl start gitea
systemctl enable gitea

Haproxy Config

frontend http-in
bind *:80
acl host_gitea hdr(host) -i git.(yourdomain).com
default_backend gogs

backend gitea
server app1 127.0.0.1:8090 check

Leave a Reply

Your email address will not be published. Required fields are marked *

VAMOVE *

*