1.使用centOS7
2.安装相关依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
3.启动ssh服务&设置为开机启动
systemctl enable sshd && sudo systemctl start sshd 或
systemctl start sshd
systemctl enable sshd
4.设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
5.开放ssh以及http服务,然后重新加载防火墙列表
firewall-cmd --add-service==ssh --permanent
firewall-cmd --add-service==http --permanent
firewall-cmd --reload
如果防火墙直接关闭就不需要以上配置
6.下载gitlab包,并且安装
6.1查看安装包下载地址,选择合适的版本
https://mirrors.tuna.tsinghua.edu.cn
6.2查找对应版本软件
6.3下载安装包
6.4安装
rpm -i gitlab-ce-15.11.9-ce.0.el7.x86_64.rpm
7.修改gitlab配置
vim /ect/gitlab/gitlab.rb
修改gitlab访问地址和端口,默认为80,改为8082
external_url'http://192.168.64.128:8082'
防止后序有502错误出现,修改以下
nginx['listen_port']=8082
8.重载配置及启动gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
9.把端口添加到防火墙
firewall-cmd --zone=public --add-port=8082/tcp --permanent
firewall-cmd --reload
启动成功后,看到修改管理员root密码的页面,修改密码后,然后登录即可
如登录后只有登录页面,可以执行以下方法进行修改
进入控制台
gitlab-rails console -e production
查询id为1的用,id为1的用户是超级管理员
user = User.where(id:1).first
修改密码为******
user.password='*****'
保存
user.save!
退出
exit
10.gitlab使用命令
查看服务状态:gitlab-ctl status
查看数据库状态:gitlab-rake db:migrate:status
升级数据库: gitlab-rake db:migrate
再加载:gitlab-ctl reconfigure