1、首先安装 GiaLab 相关依赖包

yum -y install policycoreutils openssh-server openssh-clients postfix 

yum -y install policycoreutils-python

2、启动ssh服务

&设置为开机启动

systemctl enable sshd && sudo systemctl start sshd
systemctl status sshd	查看ssh服务

3、设置postfix开机自启

,并启动,postfix支持Gitlab发信功能

systemctl enable postfix && systemctl start postfix

4、开放ssh以及http服务

,然后重新加载防火墙列表

systemctl start firewalld
firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
systemctl status firewalld	查看防火墙
#如果关闭防火墙就不需要做以上配置

5、下载Gitlab包,并且安装

#在线下载安装包:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/


wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.9.3-ce.0.el7.x86_64.rpm --no-check-certificate

rpm -ivh gitlab-ce-14.9.3-ce.0.el7.x86_64.rpm

6、修改Gitlab配置

vi /etc/gitlab/gitlab.rb

## 加入如下
# gitlab访问地址,可以写域名。如果端口不写的话默认为80端口
external_url 'http://101.133.225.166'
# ssh主机ip
gitlab_rails['gitlab_ssh_host'] = '101.133.225.166'
# ssh连接端口
# gitlab_rails['gitlab_shell_ssh_port'] = 9922

# 让配置生效
gitlab-ctl reconfigure

7、重载配置以及启动Gitlab

gitlab-ctl reconfigure
gitlab-ctl restart

8、把端口添加到防火墙重新加载

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

9、修改gitlab的登录密码

# 进入控制台
gitlab-rails console -e production

# 查询id为1的用户,id为1的用户是超级管理员
user = User.where(id:1).first
# 修改密码为lqz123456
user.password='lqz123456'
# 保存
user.save!
# 退出
exit

10、Gitlab使用命令

查看服务状态:gitlab-ctl  status	
查看数据库状态:gitlab-rake db:migrate:status
升级数据库:gitlab-rake db:migrate
再加载:gitlab-ctl reconfigure

11、登录

http://gitlab地址
Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐