Gitea – run as systemd service in Ubuntu 16.04 LTS

Gitea is a community managed fork of Gogs.

Run below command in terminal:

sudo vim /etc/systemd/system/gitea.service

Add the following code to the file:

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
After=mysql.service
#After=postgresql.service
#After=memcached.service
#After=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 -p PORT
Restart=always
Environment=USER=git HOME=/home/git

[Install]
WantedBy=multi-user.target

Uncomment any service need to be enabled like mysql in this case in Unit section.

Change the user(git) accordingly to yours. And /home/git too if your username is different than git. Change the PORT or remove the -p flag if default port is used.

Lastly start and enable gitea at boot:

sudo systemctl start gitea
sudo systemctl enable gitea

And that will be it.

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz