1、下载

1.1、网址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
1.2、选择版本

centos7离线安装 npm centos7离线安装gitlab_git

2、安装

2.1、将安装包上传到服务器

centos7离线安装 npm centos7离线安装gitlab_linux_02

2.2、检查相关依赖是否安装

使用命令 rpm -qa | grep -i (要查看的依赖名);如果安装了,会返回具体的版本信息,没安装则不返回任何信息。rpm -qa代表查询本机上安装的所有程序,grep查找具体的程序名称。

rpm -qa | grep -i openssh-server
 rpm -qa | grep -i policycoreutils-python
2.2.1、执行 rpm -qa | grep -i openssh-server

centos7离线安装 npm centos7离线安装gitlab_gitlab_03


如上图所示,表示已经安装。

2.2.2、执行 rpm -qa | grep -i policycoreutils-python

centos7离线安装 npm centos7离线安装gitlab_git_04


如上图所示,表示没有安装。

2.2.2.1、下载 policycoreutils-python

网址:https://amazonlinux.pkgs.org/2/amazonlinux-core-x86_64/policycoreutils-python-2.5-22.amzn2.x86_64.rpm.html

centos7离线安装 npm centos7离线安装gitlab_centos7离线安装 npm_05

2.2.2.2、将下载好的包上传到服务器

centos7离线安装 npm centos7离线安装gitlab_linux_06

2.2.2.3、执行安装命令 rpm -ivh ./policycoreutils-python-2.5-22.amzn2.x86_64.rpm

centos7离线安装 npm centos7离线安装gitlab_git_07


还是少了一堆依赖,可能是我安装Linux系统的原因,缺的依赖太多。

依照上面下载、安装policycoreutils-python 的方法把缺少的依赖全部下载并传到服务器安装。

若是遇到有循环依赖的,最暴力的方法,在安装命令后加 --force --nodeps。

2.3、执行安装命令

命令: sudo rpm -ivh gitlab-ce-15.7.3-ce.0.el7.x86_64.rpm

结果:安装成功

centos7离线安装 npm centos7离线安装gitlab_centos7离线安装 npm_08

3、配置

3.1、修改ip和端口

命令:vi /etc/gitlab/gitlab.rb

操作:修改 external_url ,将 http://gitlab.example.com 换成自己的 ip 或域名

centos7离线安装 npm centos7离线安装gitlab_centos7离线安装 npm_09

3.2、重新加载配置文件

命令:gitlab-ctl reconfigure
看到 gitlab Reconfigured! 即操作成功。

3.3、登录
3.3.1、查看用户名和密码

centos7离线安装 npm centos7离线安装gitlab_centos7离线安装 npm_10


用户名:root

密码:tqjtouQLZr9sLkVGeShLz+vSE/iE1F+FQliIIDzrVPo=

sudo cat /etc/gitlab/initial_root_password

centos7离线安装 npm centos7离线安装gitlab_git_11

3.3.2、访问登录页

地址:步骤3.1填写的地址

centos7离线安装 npm centos7离线安装gitlab_linux_12

3.3.3、登录成功

这里是选择是否允许其他用户注册,一般选不允许。

centos7离线安装 npm centos7离线安装gitlab_centos7离线安装 npm_13

4、常用命令

gitlab-ctl start 					#启动全部服务
gitlab-ctl restart					#重启全部服务
gitlab-ctl stop 					#停止全部服务
gitlab-ctl restart nginx 			#重启单个服务,如重启nginx
gitlab-ctl status 					#查看服务状态
gitlab-ctl reconfigure 				#重新加载配置文件
gitlab-ctl show-config 				#验证配置文件
gitlab-ctl uninstall 				#删除gitlab(保留数据)
gitlab-ctl cleanse 					#删除所有数据,从新开始
gitlab-ctl tail <service name>		#查看服务的日志
gitlab-ctl tail nginx  				#如查看gitlab下nginx日志
gitlab-rails console  				#进入控制台
gitlab-ctl help                  	#查看gitlab帮助信息