recent versions of Gitea<\/a>.<\/p>\n\n\n\nWe would also need to run these commands.<\/p>\n\n\n\n
# mkdir -p \/var\/lib\/gitea\/{custom,data,log}\n# chown -R git:git \/var\/lib\/gitea\/\n# chmod -R 750 \/var\/lib\/gitea\/\n# mkdir \/etc\/gitea\n# chown root:git \/etc\/gitea\n# chmod 770 \/etc\/gitea<\/pre>\n\n\n\nThen, create a file.<\/p>\n\n\n\n
# nano \/etc\/gitea\/app.ini<\/pre>\n\n\n\nPaste the following into the file.<\/p>\n\n\n\n
DOMAIN = gitea.yourdomain.com\nROOT_URL = http:\/\/gitea.yourdomain.com\/<\/pre>\n\n\n\nSave the file, then exit, and give the correct permission.<\/p>\n\n\n\n
# chown git. \/etc\/gitea\/app.ini<\/pre>\n\n\n\n<\/span>Step 5. Create Systemd File<\/span><\/h2>\n\n\n\nWe do not need to type the content of the systemd file; simply download it from github.<\/p>\n\n\n\n
# wget https:\/\/raw.githubusercontent.com\/go-gitea\/gitea\/main\/contrib\/systemd\/gitea.service -P \/etc\/systemd\/system\/<\/pre>\n\n\n\n# systemctl daemon-reload<\/pre>\n\n\n\nTime to run the service.<\/p>\n\n\n\n
# systemctl enable --now gitea<\/pre>\n\n\n\nGitea service should be up and running now. To verify this, we can check with this command.<\/p>\n\n\n\n
# systemctl status gitea<\/pre>\n\n\n\nIt will return an output like this.<\/p>\n\n\n\n
\u25cf gitea.service - Gitea (Git with a cup of tea)\nLoaded: loaded (\/etc\/systemd\/system\/gitea.service; enabled; vendor preset: enabled)\nActive: active (running) since Sun 2023-04-16 06:09:30 EDT; 5s ago\nMain PID: 996 (gitea)\nTasks: 6 (limit: 2294)\nMemory: 114.0M\nCPU: 693ms\nCGroup: \/system.slice\/gitea.service\n\u2514\u2500996 \/usr\/local\/bin\/gitea web --config \/etc\/gitea\/app.ini\n\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/install\/setting.go:21:PreloadSettings() [I] AppPath: \/usr\/local\/bin\/gitea\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/install\/setting.go:22:PreloadSettings() [I] AppWorkPath: \/var\/lib\/gitea\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/install\/setting.go:23:PreloadSettings() [I] Custom path: \/var\/lib\/gitea\/custom\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/install\/setting.go:24:PreloadSettings() [I] Log path: \/var\/lib\/gitea\/log\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/install\/setting.go:25:PreloadSettings() [I] Configuration file: \/etc\/gitea\/app.ini\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/install\/setting.go:26:PreloadSettings() [I] Prepare to run install page\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/install\/setting.go:29:PreloadSettings() [I] SQLite3 is supported\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 cmd\/web.go:220:listen() [I] [643bc95a-6] Listen: http:\/\/0.0.0.0:3000\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 cmd\/web.go:224:listen() [I] [643bc95a-6] AppURL(ROOT_URL): http:\/\/localhost:3000\/\nApr 16 06:09:30 debian11 gitea[996]: 2023\/04\/16 06:09:30 ...s\/graceful\/server.go:62:NewServer() [I] [643bc95a-6] Starting new Web server: tcp:0.0.0.0:3000 on PID: 996<\/pre>\n\n\n\nAt this point, you should be able to access it at http:\/\/YOUR_SERVER_IP_ADDRESS:3000<\/p>\n\n\n\n
Step 6. Install and Configure Nginx<\/pre>\n\n\n\nTo access Gitea using your domain or subdomain name, we need to install a webserver and configure it as a reverse proxy. In this step, we are going to install Nginx as the webserver.<\/p>\n\n\n\n
# nano \/etc\/nginx\/conf.d\/gitea.conf<\/pre>\n\n\n\nCopy and paste the content below.<\/p>\n\n\n\n
server {\nlisten 80;\nserver_name gitea.yourdomain.com;\naccess_log \/var\/log\/nginx\/gitea_access.log;\nerror_log \/var\/log\/nginx\/gitea_error.log;\n\nlocation \/ {\nproxy_pass http:\/\/localhost:3000;\n}\n}<\/pre>\n\n\n\nSave the file, exit, then restart nginx.<\/p>\n\n\n\n
# systemctl restart nginx<\/pre>\n\n\n\n