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

run-as-service-in-ubuntu.en-us.md 1.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 below command in terminal:
  18. ```
  19. sudo vim /etc/systemd/system/gitea.service
  20. ```
  21. Add code to the file from [here](https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service).
  22. Uncomment any service need to be enabled like mysql in this case in Unit section.
  23. 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.
  24. Lastly start and enable gitea at boot:
  25. ```
  26. sudo systemctl start gitea
  27. ```
  28. ```
  29. sudo systemctl enable gitea
  30. ```
  31. #### Using supervisor
  32. Install supervisor by running below command in terminal:
  33. ```
  34. sudo apt install supervisor
  35. ```
  36. Create a log dir for the supervisor logs(assuming gitea is installed in /home/git/gitea/):
  37. ```
  38. mkdir /home/git/gitea/log/supervisor
  39. ```
  40. Open supervisor config file in vi/vim/nano etc.
  41. ```
  42. sudo vim /etc/supervisor/supervisord.conf
  43. ```
  44. And append the code at the end of the file from [here](https://github.com/go-gitea/gitea/blob/master/contrib/supervisor/gitea).
  45. 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.
  46. Lastly start and enable supervisor at boot:
  47. ```
  48. sudo systemctl start supervisor
  49. ```
  50. ```
  51. sudo systemctl enable supervisor
  52. ```