Gitea

2020-03-04  本文已影响0人  钾肥尔德

准备数据库

Ver 8.0.19 for Linux on x86_64

# local
CREATE USER 'gitea' IDENTIFIED BY '112233@AbC';

# remote
CREATE USER 'gitea'@'192.0.2.10' IDENTIFIED BY '112233@AbC';
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
# local
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea';
# remote
GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'192.0.2.10';

# 刷新
FLUSH PRIVILEGES;

二进制部署

wget -O gitea https://dl.gitea.io/gitea/1.11.1/gitea-1.11.0-linux-amd64
chmod +x gitea
cp gitea /usr/local/bin/
adduser \
  --system \
  --shell /bin/bash \
  --comment 'Git Version Control' \
  --home /home/gitea \
  --user-group \
  gitea
mkdir -p /var/lib/gitea/{custom,data,log,ssl}
chown -R gitea:gitea /var/lib/gitea/
chmod -R 750 /var/lib/gitea/
mkdir /home/gitea
chown gitea:gitea /home/gitea
mkdir /etc/gitea
chown root:gitea /etc/gitea
chmod 770 /etc/gitea
export GITEA_WORK_DIR=/var/lib/gitea/
wget https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service
# 修改
User=gitea
Group=gitea
Environment=USER=gitea HOME=/home/gitea
cp gitea.service /etc/systemd/system/
systemctl enable gitea
systemctl start gitea

安装Gitea

两处改为gitea主机IP或域名 登陆成功

启用https

gitea cert --host 192.0.2.10
cp cert.pem /var/lib/gitea/ssl
cp key.pem /var/lib/gitea/ssl
# 添加或修改以下字段  
[server]
PROTOCOL  = https
ROOT_URL  = https://git.example.com:3000/
HTTP_PORT = 3000
CERT_FILE = /var/lib/gitea/cert.pem
KEY_FILE  = /var/lib/gitea/key.pem
REDIRECT_OTHER_PORT = true
; Port the redirection service should listen on
PORT_TO_REDIRECT = 3080  # 3080是gitea的默认https端口
systemctl restart gitea
上一篇 下一篇

猜你喜欢

热点阅读