Gogs安装教程
source link: https://shidawuhen.github.io/2022/04/05/Gogs%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Gogs安装教程
Gogs是一款极易搭建的自助Git服务。本文讲解如何使用二进制方案在Centos上搭建Gogs,环境配置如下:
Centos:7.6
MySQL:8.0
首先下载二进制文件并安装:
# 下载gogs二进制
sudo wget https://dl.gogs.io/0.12.6/gogs_0.12.6_linux_amd64.zip
# 解压
unzip gogs_0.12.6_linux_amd64.zip
cd gogs/
./gogs web
# 访问 /install 以进行初始配置
http://122.51.225.162:3000/install
访问上述链接后,打开页面如下所示,我们分别进行配置:
我使用的是MySQL数据库,数据库的安装可参考Airflow搭建与使用。首先创建DataBase,并设置字符集utf8_general_ci。为了安全可以创建单独的用户用于处理gogs服务。
CREATE DATABASE gogs CHARACTER SET utf8;
# 创建gogs用户用户
CREATE USER 'gogs'@'122.51.225.162' IDENTIFIED BY 'lll';
GRANT ALL PRIVILEGES ON *.* TO 'gogs'@'122.51.225.162';
FLUSH PRIVILEGES;
配置数据库主机、用户名、密码等信息。
应用基本设置
应用基本设置只需要修改运行系统用户、域名、应用URL,其它采用默认值。
管理员账号
配置管理员账号,让自己有所有权限。
配置完上述信息后,点击立即安装,新的页面如下所示:
用户可以创建新的仓库:
用户要将仓库下载到本地,这需要配置密钥,具体操作如下:
ssh-keygen -t rsa -b 4096 -C "w****@163.com"
# 一路回车
cd ~/.ssh/
cat id_rsa.pub
# 将密钥添加到gogs上
# 克隆仓库
git clone http://122.51.225.162:3000/shidawuhen/test.git
# 执行初始操作
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin http://122.51.225.162:3000/shidawuhen/test.git
git push -u origin master
仓库需要多人维护,所以我们需要增加新的用户:
创建完用户后,将对应仓库增加协作者,新用户登录后即可看到对应的仓库
gogs创建用户时,认证源使用的是本地,后续可继承openldap做登录认证。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK