[Docs] Linux Service Edit (#9633)
* Rename h3 title * Add intro Should work on Ubuntu Xenial, but should work on any Linux distros. * Indirect edit files Instead of providing `sudo vim`, invite to edit files. * enable now instead of enable and start * Re-add systemctl enable && systemctl start * Revert service enablement back to status quo * Add enable now counterpart for systemd > v220 * Apply suggestions from @sapk Strip `vim` from editor usage Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>release/v1.15
parent
c779ac12c9
commit
b822518e39
|
@ -13,16 +13,13 @@ menu:
|
||||||
identifier: "linux-service"
|
identifier: "linux-service"
|
||||||
---
|
---
|
||||||
|
|
||||||
### Run as service in Ubuntu 16.04 LTS
|
### Run Gitea as Linux service
|
||||||
|
|
||||||
|
You can run Gitea as service, using either systemd or supervisor. The steps below tested on Ubuntu 16.04, but those should work on any Linux distributions (with little modification).
|
||||||
|
|
||||||
#### Using systemd
|
#### Using systemd
|
||||||
|
|
||||||
Run the below command in a terminal:
|
Copy the sample [gitea.service](https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service) to `/etc/systemd/system/gitea.service`, then edit the file with your favorite editor.
|
||||||
```
|
|
||||||
sudo vim /etc/systemd/system/gitea.service
|
|
||||||
```
|
|
||||||
|
|
||||||
Copy the sample [gitea.service](https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service).
|
|
||||||
|
|
||||||
Uncomment any service that needs to be enabled on this host, such as MySQL.
|
Uncomment any service that needs to be enabled on this host, such as MySQL.
|
||||||
|
|
||||||
|
@ -35,6 +32,10 @@ sudo systemctl enable gitea
|
||||||
sudo systemctl start gitea
|
sudo systemctl start gitea
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you have systemd version 220 or later, you can enable and immediately start Gitea at once by:
|
||||||
|
```
|
||||||
|
sudo systemctl enable gitea --now
|
||||||
|
```
|
||||||
|
|
||||||
#### Using supervisor
|
#### Using supervisor
|
||||||
|
|
||||||
|
@ -49,19 +50,20 @@ Create a log dir for the supervisor logs:
|
||||||
mkdir /home/git/gitea/log/supervisor
|
mkdir /home/git/gitea/log/supervisor
|
||||||
```
|
```
|
||||||
|
|
||||||
Open supervisor config file in a file editor:
|
|
||||||
```
|
|
||||||
sudo vim /etc/supervisor/supervisord.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
Append the configuration from the sample
|
Append the configuration from the sample
|
||||||
[supervisord config](https://github.com/go-gitea/gitea/blob/master/contrib/supervisor/gitea).
|
[supervisord config](https://github.com/go-gitea/gitea/blob/master/contrib/supervisor/gitea) to `/etc/supervisor/supervisord.conf`.
|
||||||
|
|
||||||
Change the user (git) and home (/home/git) settings to match the deployment
|
Using your favorite editor, change the user (git) and home
|
||||||
environment. Change the PORT or remove the -p flag if default port is used.
|
(/home/git) settings to match the deployment environment. Change the PORT
|
||||||
|
or remove the -p flag if default port is used.
|
||||||
|
|
||||||
Lastly enable and start supervisor at boot:
|
Lastly enable and start supervisor at boot:
|
||||||
```
|
```
|
||||||
sudo systemctl enable supervisor
|
sudo systemctl enable supervisor
|
||||||
sudo systemctl start supervisor
|
sudo systemctl start supervisor
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you have systemd version 220 or later, you can enable and immediately start supervisor by:
|
||||||
|
```
|
||||||
|
sudo systemctl enable supervisor --now
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue