不灭的焱

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2021-07-31 09:23:45  修改时间:2024-04-15 16:37:12  分类:Linux软件安装/参数优化  编辑

相关文章:

 


 

1、安装go运行环境

参考文章:/article/576.html,中的【CentOS 上 Go 环境配置】

2、安装MySQL5.7

参考文章:/2034.html

3、安装git

yum -y install git

4、下载gogs安装包

https://gogs.io/docs/installation/install_from_binary.html

5、新建 用户 及 用户组 git:git

groupadd git
useradd git -g git
passwd git  # 设置密码为:KIRz%pHiH@zP1lRv

6、新建目录

mkdir -pv /alidata/www/gogs                  # gogs安装位置
mkdir -pv /alidata/logs/gogs                 # 日志目录
mkdir -pv /alidata/data/gogs-repositories    # 仓库目录

7、设置权限

(1) 设置用户

chown -R git:git /alidata/www/gogs
chown -R git:git /alidata/logs/gogs
chown -R git:git /alidata/data/gogs-repositories

(2) 设置权限

chmod -R 755 /alidata/www/gogs
chmod -R 755 /alidata/logs/gogs
chmod -R 755 /alidata/data/gogs-repositories

8、开放云主机端口

开放端口 TCP:30000

【特别注意】也需临时开放端口:3000,gogs默认启动时用这个端口启动的,后面可以修改为:30000

9、用账号git,登录系统

su git

10、运行 gogs

cd /alidata/www/gogs
./gogs web &

11、关闭 gogs

killall gogs

12、禁止用户自己注册

在配置文件:/alidata/www/gogs/custom/conf/app.ini

设置 DISABLE_REGISTRATION = true

13、禁用 Gravatar 头像

[picture]
DISABLE_GRAVATAR        = true

 

然后 重启 gogs

 

【特别注意】

git 账号目录的 权限一定要为: 700,否则免密登录会失败

[albert@iZwz9e3nt599kb7bc4k019Z home]$ ll
total 16
drwx------ 2 albert albert 4096 Aug 13 16:18 albert
drwx------ 5 git    git    4096 Aug 15 15:50 git
drwx------ 2 mysql  mysql  4096 Aug  9 16:53 mysql
drwx------ 3 www    www    4096 Aug 13 14:30 www

 


gogs二进制升级

相关下载可以从 二进制安装 页面查看。

首先,确认当前安装的位置:

# 默认位置在 git 用户下的家目录
$ sudo su - git
$ cd ~
$ pwd
/home/git
$ ls
gogs gogs-repositories

然后将当前目录移动到另一个临时的位置,但不是删除!

$ mv gogs gogs_old

下载并解压新的二进制:

# 请根据系统和类型获取相应的二进制版本
$ wget https://dl.gogs.io/$VERSION/gogs_$VERSION_$OS_$ARCH.tar.gz
$ tar -zxvf gogs_$VERSION_$OS_$ARCH.tar.gz
$ ls
gogs gogs_old  gogs-repositories gogs_$VERSION_$OS_$ARCH.tar.gz

复制 customdata 和 log 目录到新解压的目录中:

$ cp -R gogs_old/custom gogs
$ cp -R gogs_old/data gogs
$ cp -R gogs_old/log gogs

最后,运行并打开浏览器进行测试:

$ cd gogs
$ ./gogs web &