gitea安装和配置

下载地址:https://dl.gitea.io/gitea

下载和赋权

wget https://dl.gitea.io/gitea/master/gitea-master-linux-amd64
chmod +x gitea
mv gitea-master-linux-amd64 gitea

创建git用户和用户组

adduser git
chown git.git /data/wwwroot/git.com/
vim /etc/passwd
### 编辑
git:x:1005:1005:,,,:/home/git:/sbin/nologin

Nginx配置

### Nginx配置反代
location / {
    proxy_pass http://localhost:3000/;
}

Mysql数据库创建和配置

推荐使用phpmyadmin

守护进程&开机自启

vim /etc/systemd/system/gitea.service
### 编辑
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
After=mysqld.service
#After=postgresql.service
#After=memcached.service
#After=redis.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/data/wwwroot/git.moeguy.com
ExecStart=/data/wwwroot/git.moeguy.com/gitea web
Restart=always
Environment=USER=git HOME=/home/git

[Install]
WantedBy=multi-user.targe
systemctl daemon-reload
systemctl restart gitea
systemctl enable gitea

发表新评论