1 安装相关依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
2 配置系统环境
systemctl enable sshd #启动ssh服务
systemctl start sshd #设置开机启动
systemctl enable postfix && systemctl start postfix #设置postfix开机自启并启动 postfix支持gitlab发信功能
firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload #开放ssh以及http服务 然后重新加载防火墙列表
如果关闭防火墙上面这三步就不需要配置
systemctl stop firewalld #停止firewalld防火墙服务
systemctl disable firewalld #禁用firewalld服务开机自启
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux #关闭selinux 重启生效
setenforce 0 #关闭selinux 当前生效
3 安装Gitlab yum安装
[root@localhost ~]vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
[root@localhost ~]# yum makecache #更新本地yum缓存
[root@localhost ~] yum install -y gitlab-ce
可以访问"https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/"查看Gitlab-ce的版本。
yum install -y gitlab-ce-{VERSION} #安装历史版本
或者包安装
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-12.4.2-ce.0.el6.x86_64.rpm
###也可以提前下载版本的rpm包上传至服务器 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/
rpm -ivh gitlab-ce-12.4.2-ce.0.el6.x86_64.rpm #安装
5 修改gitlab配置
vim /etc/gitlab/gitlab.rb
简单修改配置
修改gitlab访问地址和端口,默认为80,我们改为82
external_url 'http://192.168.66.100:82'
nginx['listen_port'] = 82
gitlab-ctl reconfigure #重载配置
gitlab-ctl restart #启动gitlab
6 网页登录测试
http://xxx.xxx.xxx.xxx:82
网页登录后用户名root 密码目录为
/etc/gitlab/initial_root_password