You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

run-as-service-in-ubuntu.en-us.md 1.5KB

5 jaren geleden
5 jaren geleden
5 jaren geleden
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ---
  2. date: "2017-07-21T12:00:00+02:00"
  3. title: "Run as service in Linux"
  4. slug: "linux-service"
  5. weight: 10
  6. toc: true
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "installation"
  11. name: "Linux service"
  12. weight: 20
  13. identifier: "linux-service"
  14. ---
  15. ### Run as service in Ubuntu 16.04 LTS
  16. #### Using systemd
  17. Run the below command in a terminal:
  18. ```
  19. sudo vim /etc/systemd/system/gitea.service
  20. ```
  21. Copy the sample [gitea.service](https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service).
  22. Uncomment any service that needs to be enabled on this host, such as MySQL.
  23. Change the user, home directory, and other required startup values. Change the
  24. PORT or remove the -p flag if default port is used.
  25. Enable and start Gitea at boot:
  26. ```
  27. sudo systemctl enable gitea
  28. sudo systemctl start gitea
  29. ```
  30. #### Using supervisor
  31. Install supervisor by running below command in terminal:
  32. ```
  33. sudo apt install supervisor
  34. ```
  35. Create a log dir for the supervisor logs:
  36. ```
  37. # assuming Gitea is installed in /home/git/gitea/
  38. mkdir /home/git/gitea/log/supervisor
  39. ```
  40. Open supervisor config file in a file editor:
  41. ```
  42. sudo vim /etc/supervisor/supervisord.conf
  43. ```
  44. Append the configuration from the sample
  45. [supervisord config](https://github.com/go-gitea/gitea/blob/master/contrib/supervisor/gitea).
  46. Change the user (git) and home (/home/git) settings to match the deployment
  47. environment. Change the PORT or remove the -p flag if default port is used.
  48. Lastly enable and start supervisor at boot:
  49. ```
  50. sudo systemctl enable supervisor
  51. sudo systemctl start supervisor
  52. ```