注:
1、安装 Gitlab 对配置要求较高,低于 2核4G内存配置,建议不要安装最新版
2、本文采用 rpm 安装,安装前需要安装的依赖较多,请耐心操作
1、安装依赖
yum install -y curl yum install -y policycoreutils-python yum install -y policycoreutils-python* yum install -y openssh-server systemctl enable sshd systemctl start sshd systemctl start firewalld firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https systemctl reload firewalld yum install postfix systemctl enable postfix systemctl start postfix # 修改邮件服务配置 vi /etc/postfix/main.cf # 发现配置为: inet_interfaces = localhost inet_protocols = all # 改成: inet_interfaces = all inet_protocols = all
2、下载安装包
# centos8.x 版本使用 wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el8/gitlab-ce-13.4.6-ce.0.el8.x86_64.rpm # centos7.x 版本使用 wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.4.6-ce.0.el7.x86_64.rpm
3、rpm安装
# centos8.x 使用 rpm -ivh gitlab-ce-13.4.6-ce.0.el8.x86_64.rpm # centos7.x 使用 rpm -ivh gitlab-ce-13.4.6-ce.0.el7.x86_64.rpm
4、修改 Gitlab 配置
# 修改配置文件 vim /etc/gitlab/gitlab.rb external_url 'http://你的ip地址:80'
5、启动
gitlab-ctl reconfigure
gitlab-ctl restart
6、访问服务
在浏览器输入ip地址,就打开了 gitlab 服务。
第一次进入需要需要给管理员添加密码,默认账号为:root,默认密码:5iveL!fe
7、服务管理
# 查看服务状态: gitlab-ctl status # 开启服务: gitlab-ctl start # 关闭服务: gitlab-ctl stop # 关闭gitlab的自动启动 : systemctl disable gitlab-runsvdir.service # 开启gitlab的自动启动: systemctl enable gitlab-runsvdir.service systemctl start gitlab-runsvdir.service gitlab-cmd start