installing Gitea<\/a>, you will need to create a new system user, ‘git’:<\/p>\n\n\n\nadduser --system --shell \/bin\/bash --group --disabled-password --home \/home\/git git<\/pre>\n\n\n\nNext, you can download Gitea in your current directory and copy it to \/usr\/bin\/gitea<\/p>\n\n\n\n
wget https:\/\/dl.gitea.com\/gitea\/1.19\/gitea-1.19-linux-amd64\n\ncp gitea-1.19-linux-amd64 \/usr\/bin\/gitea<\/pre>\n\n\n\nNow you change the permissions of the new download file:<\/p>\n\n\n\n
# chmod 755 \/usr\/bin\/gitea<\/pre>\n\n\n\nNext, you can go ahead and create the new directories in \/var\/lib\/gitea and \/etc\/gitea and assign the correct permissions and directory ownership to the user ‘git’.<\/p>\n\n\n\n
# mkdir -p \/etc\/gitea \/var\/lib\/gitea\/{custom,data,indexers,public,log}\n\n#chown git:git \/etc\/gitea \/var\/lib\/gitea\/{custom,data,indexers,public,log}\n\n#chmod 750 \/var\/lib\/gitea\/{data,indexers,log}\n\n#chmod 770 \/etc\/gitea<\/pre>\n\n\n\nSince you have created the new directories and assigned the correct permissions and directory ownership, you can now create the Gitea service.<\/p>\n\n\n\n
Open a new file called gitea.service in \/etc\/systemd\/system with your favorite text editor; in this tutorial, we will use nano.<\/p>\n\n\n\n
# nano \/etc\/systemd\/system\/gitea.service<\/pre>\n\n\n\nYou should add the following lines in your gitea.service file:<\/p>\n\n\n\n
[Unit]\nDescription=Gitea\nAfter=syslog.target\nAfter=network.target\n[Service]\nRestartSec=3s\nType=simple\nUser=git\nGroup=git\nWorkingDirectory=\/var\/lib\/gitea\/\n\nExecStart=\/usr\/bin\/gitea web --config \/etc\/gitea\/app.ini\nRestart=always\nEnvironment=USER=git HOME=\/home\/git GITEA_WORK_DIR=\/var\/lib\/gitea\n\n[Install]\nWantedBy=multi-user.target<\/pre>\n\n\n\nYou can save the gitea.service file in nano using Ctrl+O and click enter to save the file, next click Ctrl+X to exit the nano text editor. Now you can reload systemd daemon and start the Gitea service with:<\/p>\n\n\n\n
# systemctl daemon-reload\nsystemctl start gitea<\/pre>\n\n\n\nTo make sure the Gitea service is automatically started on system reboot, use the command:<\/p>\n\n\n\n
# systemctl enable gitea<\/pre>\n\n\n\n