记一次 Centos7 安装部署 gogs-v0.12.1

一、基本信息

Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自助 Git 服务。使用 Go 语言开发使得 Gogs 能够通过独立的二进制分发,并且支持 Go 语言支持的 所有平台,包括 Linux、Mac OS X、Windows 以及 ARM 平台。

官网:https://gogs.io/

文档:https://gogs.io/docs

Github:https://github.com/gogs/gogs

下载地址:https://dl.gogs.io/

官方安装文档:https://gogs.io/docs/installation/install_from_binary

二、系统环境及工具

1、系统说明

系统:CentOS-7-x86_64-Minimal-1708

下载地址: 

http://mirrors.aliyun.com/centos/

2、安装虚拟机

安装虚拟机:  2G内存  1核CPU

安装过程可参考:

https://blog.csdn.net/llwy1428/article/details/89328381

3、VMware 版本:VMware Workstation Pro15

4、工具:xshell5

三、安装部署

1、创建系统用户 git

[root@localhost ~]# useradd git

2、安装 PostgreSql 数据库

安装过程可参考:

https://blog.csdn.net/llwy1428/article/details/102486414

https://blog.csdn.net/llwy1428/article/details/105143053

3、创建数据库 gogs

切换用户

[root@localhost ~]# su - postgres
-bash-4.2$ psql

执行命令创建数据库

postgres=# create database gogs owner postgres;

4、在 root 用户下下载安装程序

下载地址:https://dl.gogs.io/

[root@localhost ~]# cd /home/git
下载
[root@localhost git]# wget https://dl.gogs.io/0.12.1/gogs_0.12.1_linux_amd64.tar.gz
给文件赋权
[root@localhost ~]# chown git:git /home/git/gogs_0.12.1_linux_amd64.tar.gz

5、切换用户,解压、查看文件

[root@localhost ~]# su git
回到根目录
[git@localhost ~]# cd
解压文件
[git@localhost ~]$ tar zxvf gogs_0.12.1_linux_amd64.tar.gz
查看
[git@localhost ~]# ll
drwxrwxr-x. 3 git git       85 Aug 27 15:07 gogs
-rwxrwxrwx. 1 git git 27492538 Aug 27 15:08 gogs_0.12.1_linux_amd64.tar.gz
查看gogs文件夹
[git@localhost ~]$ ll gogs
total 48912
-rwxrwxr-x. 1 git git 50063136 Aug 27 15:07 gogs
-rw-rw-r--. 1 git git     1054 Aug 27 15:07 LICENSE
-rw-rw-r--. 1 git git     7021 Aug 27 15:07 README.md
-rw-rw-r--. 1 git git     5372 Aug 27 15:07 README_ZH.md
drwxrwxr-x. 7 git git      195 Aug 27 15:07 scripts

6、启动服务

控制台启动:

[git@localhost gogs]$ ./gogs web

后台守护启动:

[git@localhost ~]$ nohup gogs/gogs web &

7、查看启动状态:

四、浏览器查看、初始化

1、浏览器录入地址

http://192.168.11.20:3000/     (192.168.11.20 是我虚拟机的 IP)

2、填写数据库及系统用户信息

3、管理员用户创建,创建的第一个账号就是管理员账号,同时具有普通用户的权限。

4、注册账号,注意不能使用 “admin”

5、登录

6、首页

7、工单管理

8、发现

9、创建仓库

10、查看仓库

操作:

[git@localhost ~]$ mkdir base
[git@localhost ~]$ cd base
[git@localhost base]$ git init
Initialized empty Git repository in /home/git/base/.git/
[git@localhost base]$ git add README.md
[git@localhost base]$ git commit -m "first commit"
[master (root-commit) 40c5502] first commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 README.md
[git@localhost base]$ git remote add origin http://192.168.11.30:3000/sysadmin/base.git
[git@localhost base]$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 205 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
Username for 'http://192.168.11.30:3000': sysadmin
Password for 'http://[email protected]:3000': 
To http://192.168.11.30:3000/sysadmin/base.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

查看

至此,Centos7  安装部署  gogs-v0.12.1 操作完毕!

参考地址:

https://www.linuxidc.com/Linux/2016-04/130600.htm

https://www.tisnz.com/2019/04/03/gogs-install/

https://blog.csdn.net/wangt5952/article/details/96423757

https://www.jianshu.com/p/5686a2d768f8

猜你喜欢

转载自blog.csdn.net/llwy1428/article/details/103803247
今日推荐