• Run as service in Ubuntu 16.04 LTS
    • Using systemd
    • Using supervisor

    Run as service in Ubuntu 16.04 LTS

    Using systemd

    Run the below command in a terminal:

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

    Copy the sample gitea.service.

    Uncomment any service that needs to be enabled on this host, such as MySQL.

    Change the user, home directory, and other required startup values. Change thePORT or remove the -p flag if default port is used.

    Enable and start gitea at boot:

    1. sudo systemctl enable gitea
    2. sudo systemctl start gitea

    Using supervisor

    Install supervisor by running below command in terminal:

    1. sudo apt install supervisor

    Create a log dir for the supervisor logs:

    1. # assuming gitea is installed in /home/git/gitea/
    2. mkdir /home/git/gitea/log/supervisor

    Open supervisor config file in a file editor:

    1. sudo vim /etc/supervisor/supervisord.conf

    Append the configuration from the samplesupervisord config.

    Change the user(git) and home(/home/git) settings to match the deploymentenvironment. Change the PORT or remove the -p flag if default port is used.

    Lastly enable and start supervisor at boot:

    1. sudo systemctl enable supervisor
    2. sudo systemctl start supervisor

    原文: https://docs.gitea.io/zh-cn/linux-service/