Gogs需要使用到Mysql数据库
yum install mariadb mariadb-server -y
systemctl enable mariadb
systemctl restart mariadb
mysql_secure_installation
登录mysql
[root@docker02 ~]# mysql -uroot -p123456
创建库并授权
MariaDB [(none)]> create database gogs character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on gogs.* to 'gogs'@'127.0.0.1' identified by '123456';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
测试用户登录
[root@docker02 gogs]# mysql -ugogs -p123456 -h 127.0.0.1 -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
MariaDB [(none)]>
二、安装git
[root@docker02 ~]# yum -y install git
[root@docker02 ~]# useradd git -s /sbin/nologin
[root@docker02 ~]# tar -zxvf gogs_0.11.86_linux_amd64.tar.gz -C /usr/local/
[root@docker02 gogs]# pwd
/usr/local/gogs
[root@docker02 gogs]# ls
gogs LICENSE public README.md README_ZH.md scripts templates
启动gogs
[root@docker02 gogs]# /usr/local/gogs/gogs web
2021/01/12 10:18:49 [ WARN] Custom config '/usr/local/gogs/custom/conf/app.ini' not found, ignore this if you're running first time
2021/01/12 10:18:49 [TRACE] Custom path: /usr/local/gogs/custom
2021/01/12 10:18:49 [TRACE] Log path: /usr/local/gogs/log
2021/01/12 10:18:49 [TRACE] Log Mode: Console (Trace)
2021/01/12 10:18:49 [ INFO] Gogs 0.11.86.0130
2021/01/12 10:18:49 [ INFO] Cache Service Enabled
2021/01/12 10:18:49 [ INFO] Session Service Enabled
2021/01/12 10:18:49 [ INFO] SQLite3 Supported
2021/01/12 10:18:49 [ INFO] Run Mode: Development
2021/01/12 10:18:49 [ INFO] Listen: http://0.0.0.0:3000
配置gogs
配置连接数据库的用户名和密码即可完成安装,安装后建议关闭注册,禁止用户注册增加安全性custom/conf/app.ini 默认是可以注册,需要关闭提高安全 DISABLE_REGISTRATION = true
简易Git服务器gogs的搭建完成
相关阅读: