44 lines
1.1 KiB
Markdown
44 lines
1.1 KiB
Markdown
|
# Gitea
|
||
|
|
||
|
## Create User
|
||
|
|
||
|
```sh
|
||
|
sudo sed -i '$ a git:*:2050:2050::/data/git:/bin/sh' /etc/passwd
|
||
|
sudo sed -i '$ a git:x:2050:' /etc/group
|
||
|
|
||
|
sudo mkdir -p /data/git/gitea
|
||
|
sudo chown -R git: /data/git
|
||
|
```
|
||
|
|
||
|
## Install Software
|
||
|
|
||
|
```sh
|
||
|
sudo apt install git
|
||
|
sudo -u git wget -O /data/git/gitea/gitea https://dl.gitea.io/gitea/...
|
||
|
sudo -u git chmod +x /data/git/gitea/gitea
|
||
|
```
|
||
|
|
||
|
## Apply Configuration
|
||
|
|
||
|
```sh
|
||
|
DOMAIN=example.com
|
||
|
|
||
|
sudo cp nginx.conf /etc/nginx/sites-available/git
|
||
|
sudo cp gitea.service /etc/systemd/system
|
||
|
|
||
|
sudo systemctl enable gitea
|
||
|
sudo systemctl start gitea
|
||
|
|
||
|
sudo sed -i s/example.com/$DOMAIN/ /etc/nginx/sites-available/git
|
||
|
|
||
|
sudo ln -s ../sites-available/git /etc/nginx/sites-enabled
|
||
|
sudo nginx -s reload
|
||
|
|
||
|
|
||
|
sudo iptables -t nat -A PREROUTING -p tcp --dport 4986 -j REDIRECT --to-ports 22222
|
||
|
|
||
|
sudo -u git sed -i /MODE.*file/s/file/console/ /data/git/gitea/custom/conf/app.ini
|
||
|
sudo -u git sed -i /LEVEL.*info/s/info/warn/ /data/git/gitea/custom/conf/app.ini
|
||
|
sudo -u git /data/git/gitea/gitea admin create-user --username admin --password admin --admin --email admin
|
||
|
```
|