作者:蓝眼泪
实验环境:centos7.6 ,xshell7,vm15
1 安装依赖
sudo yum install -y curl policycoreutils-python openssh-server openssh-clients perl
sudo systemctl enable sshd
sudo systemctl start sshd
2 关闭防火墙
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld
3 安装邮箱
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
4 脚本安装
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
5 更新gitlab-ce软件
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ce
sudo EXTERNAL_URL="http://192.168.1.200" yum install -y gitlab-ce
6 初始化配置并启动软件
gitlab-ctl reconfigure
gitlab-ctl start
gitlabctl其他常用操作命令
# 重新应用gitlab的配置
gitlab-ctl reconfigure
# 重启gitlab服务
gitlab-ctl restart
# 查看gitlab运行状态
gitlab-ctl status
#停止gitlab服务
gitlab-ctl stop
# 查看gitlab运行日志
gitlab-ctl tail
7 修改external_url参数
vim /etc/gitlab/gitlab.rb
搜索external_usl 更改参数
/external_url
external_url :'http://192.168.1.200’
8 登录网页测试
http://192.168.1.200/root
http://192.168.1.200/api/v4/users?username=root
注意事项
1 设置yum源,加速软件下载
cat> /etc/yum.repos.d/gitlab-ce.repo<< EOF
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
gpgcheck=0
enabled=1
EOF
2 root账号密码忘记解决方案
gitlab-rails console
user = User.where(id: 1).first
user = User.find_by(email: 'admin@local.host')
user.password = '2.0.2.0.Wen'
user.password_confirmation = '2.0.2.0.Wen'
user.save!
exit