Ubuntu下Gitea安装和配置
1年前 • 1041次点击 • 来自 Linux
标签: Git
配置数据库
创建了一个gitea账号,密码gitea,可以访问gitea库
创建用户:
create user gitea identified by 'gitea';
授权:
grant all privileges on gitea.* to gitea@'%' identified by 'gitea';
刷新权限:
flush privileges;
安装Gitea
以 service 方式运行
systemd 方式
在 terminal 中执行以下命令:
sudo vim /etc/systemd/system/gitea.service
接着拷贝示例代码 gitea.service 并取消对任何需要运行在主机上的服务部分的注释,譬如 MySQL。
修改 user,home 目录以及其他必须的初始化参数,如果使用自定义端口,则需修改 PORT 参数,反之如果使用默认端口则需删除 -p 标记。
激活 gitea 并将它作为系统自启动服务:
sudo systemctl enable gitea
sudo systemctl start gitea
gitea.service
https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
Requires=mysql.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=root
Group=root
ExecStart=/root/gitea web
Restart=always
[Install]
WantedBy=multi-user.target