CentOS 7 环境下 GitLab安装部署以及账号初始化

1. 安装相关依赖

1 yum install curl policycoreutils openssh-server openssh-clients -y
2 # 确保sshd启动(正常情况下, sshd是启动的)
3 systemctl enable sshd
4 systemctl start sshd

 

另外如果开启了防火墙, 注意设置防火墙的规则

 2. 引入yum源, 并安装gitlab

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install gitlab-ce -y
# 配置并启动
gitlab-ctl reconfigure

如果设备配置比较低, 会在启动过程中卡死, 建议最低双核2G内存

如果当前服务器的808080端口均未被占用, 则直接可以通过服务器的ip或域名访问到后台(出现502不要紧张,一般情况下是gitlab还没有起来)

http://ip或域名

3、获取/修改超级管理员root的密码

#切换目录:
cd /opt/gitlab/bin
#执行 :下方 命令 开始初始化密码
sudo gitlab-rails console production
#在irb(main):001:0> 后面通过 u=User.where(id:1).first 来查找与切换账号(User.all 可以查看所有用户)
u=User.where(id:1).first
#通过u.password='12345678'设置密码为12345678(这里的密码看自己喜欢):
u.password='12345678'
#通过u.password_confirmation='12345678' 再次确认密码
u.password_confirmation='12345678'
#通过 u.save!进行保存(切记切记 后面的 !)
u.save!
#如果看到上面截图中的true ,恭喜你已经成功了,执行 exit 退出当前设置流程即可。
exit

 4、重启gitlab

sudo gitlab-ctl restart

 5、常用命令

# Start all GitLab components
gitlab-ctl start
# Stop all GitLab components
gitlab-ctl stop
# Restart all GitLab components
gitlab-ctl restart

 

回到gitlab ,可以通过 root/12345678 这一超级管理员账号登录了(本人操作的时候,)

至此gitlab告一段落。后续记录接入LDAP

 

参考文档

https://www.jianshu.com/p/808fbf9d972f

https://blog.csdn.net/hnmpf/article/details/80518460

 

posted on 2018-09-26 20:49  李国清  阅读(760)  评论(0编辑  收藏  举报

导航