This assumes that Gitea runs as user git and is installed in /home/git/gitea and the repositories are also located in /home/git. This shall also be the case for the remainder of this document.
I've created a selinux module for Gitea which will work for small installations (tested with SQlite3 and without PAM), just upload it to the box (source included) and run as root:
fc29-gitea-selinux.tar.bz2 (v1.1: Now allows Gitea to send e-mails)
tar -zxvf fc29-gitea-selinux.tar.bz2 semodule -i fc29-gitea.pp
As root, install golang and make:
dnf install golang-bin make -y
If user “git” doesn't exist, add the user to the system:
useradd -m git
Become user git and setup GOPATH environment:
su - git echo "export GOPATH=$HOME/go" >> $HOME/.bash_profile logout su - git
Download gitea master branch and all required packages:
go get -d code.gitea.io/gitea cd "$GOPATH/src/code.gitea.io/gitea"
Edit /home/git/go/src/code.gitea.io/gitea/Makefile and remove -i flag from “GOFLAGS := -v” so that it reads:
GOFLAGS := -v
Make sure that go-bindata can be found:
mkdir $HOME/bin ; cd $HOME/bin ln -s /home/git/go/bin/go-bindata go-bindata
Build:
cd $HOME/go/src/code.gitea.io/gitea/ TAGS="bindata sqlite sqlite_unlock_notify" make generate build
Et voila, the binary can be found in:
$ ls -al /home/git/go/src/code.gitea.io/gitea/gitea -rwxrwxr-x. 1 git git 54773448 7. Apr 02:18 /home/git/go/src/code.gitea.io/gitea/gitea
Copy binary:
mkdir /home/git/gitea cp -a /home/git/go/src/code.gitea.io/gitea/gitea /home/git/gitea
As user git, run gitea for the first time:
cd /home/git/gitea ./gitea web
Press CTRL + C to stop gitea.
Did gitea start? Delete the source and its dependencies (this will delete about 500mb in files) and logout:
cd $HOME rm -rf go rm -rf .cache/go-build logout
As root, remove golang:
dnf history undo last
As root user, create file /etc/systemd/system/gitea.service with the following contents:
[Unit] Description=Gitea After=syslog.target After=network.target #After=mariadb.service mysqld.service postgresql.service memcached.service redis.service [Service] # Modify these two values and uncomment them if you have # repos with lots of files and get an HTTP error 500 because # of that ### #LimitMEMLOCK=infinity #LimitNOFILE=65535 Type=simple User=git Group=git WorkingDirectory=/home/git/gitea ExecStart=/home/git/gitea/gitea web Restart=always Environment=USER=git HOME=/home/git # Some distributions may not support these hardening directives. If you cannot start the service due # to an unknown option, comment out the ones not supported by your version of systemd. ProtectSystem=full PrivateDevices=yes PrivateTmp=yes NoNewPrivileges=true [Install] WantedBy=multi-user.target
Enable and start service (make sure the gitea selinux module is installed first):
systemctl daemon-reload systemctl enable gitea systemctl start gitea
Configuration file app.ini is located in /home/git/gitea/custom/conf
Config Cheat Sheet: https://docs.gitea.io/en-us/config-cheat-sheet/
Customizing Gitea: https://docs.gitea.io/en-us/customizing-gitea/
Having issues with uploads of attachments e.g. when uploading a zip file to a release? See ALLOWED_TYPES configuration option at https://docs.gitea.io/en-us/config-cheat-sheet/. This worked for me in app.ini:
[attachment] ALLOWED_TYPES = */*
There is still an open issue when uploading a release attachment fails for mirror repositories.
See https://github.com/go-gitea/gitea/issues/6535 for more information.