Centos 7搭建Gitlab服务器超详细 --- 2021-
2021-11-25 本文已影响0人
一位先生_
centos8安装gitlab
1,安装依赖
yum install -y curl policycoreutils-python openssh-server
``
注意:centos8没有policycoreutils-python yum源,在这里先不用管
2,启动ssh并设置为开机自启动
systemctl enable sshd
systemctl start sshd
3, 添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效
systemctl start firewalld
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
4,启动postfix
systemctl enable postfix
systemctl start postfix
注意:如果提示postfix 没有安装 可使用: yum install postfix 安装,然后再执行以上命令,加入开机启动。
5,下载gitlab
(注意centos8和centos7下载的版本不同你也可以去这里下载:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/)
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-12.10.1-ce.0.el8.x86_64.rpm
6,安装
rpm -i gitlab-ce-12.10.1-ce.0.el8.x86_64.rpm
如图:说明安装成功

7,编辑ip和端口
vim /etc/gitlab/gitlab.rb

我这里使用的是ip+端口号(端口号:8888),因为我目前没有域名,同时,你要去阿里云或者腾讯云开启你的8888 安全端口。
然后执行:
gitlab-ctl reconfigure
gitlab-ctl restart
8,访问gitlab ip+端口
如果输入端口和ip一直无法响应,可以关闭防火墙
`systemctl stop firewalld`
如果访问502,查看
(https://www.cnblogs.com/stronger-xsw/p/12804002.html)
重新配置并启动
gitlab-ctl reconfigure
gitlab-ctl restart
开启:
gitlab-ctl start
关闭:
gitlab-ctl stop
9. 成功如下图:

10,第一次登录需要修改root密码, 密码8位以上,修改完就可以登录,使用设置的新密码(上图中设置新密码)
登录成功之后如下图:(账户名是root, 密码是你刚设置的新密码)

其他操作类似添加账号,仓库等操作,可自行百度查看。