yum install -y curl policycoreutils-python openssh-server
systemctl enable sshd
systemctl start sshd
net.ipv4.ip_forward = 1
vim /etc/sysctl.conf
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
GitLab 需要使用 postfix 来发送邮件。当然,也可以使用 SMTP 服务器。
yum install -y postfix
打开 /etc/postfix/main.cf 文件,在第 119 行附近找到 inet_protocols = all,将 all 改为 ipv4
vim /etc/postfix/main.cf
inet_protocols = ipv4
systemctl enable postfix
systemctl start postfix
由于 GitLab 较为消耗资源,我们需要先创建交换分区,以降低物理内存的压力。 在实际生产环境中,如果服务器配置够高,则不必配置交换分区。
dd if=/dev/zero of=/root/swapfile bs=1M count=2048
mkswap /root/swapfile
swapon /root/swapfile
添加自启用。打开 /etc/fstab 文件,在文件最后添加新的一行
vim /etc/fstab /root/swapfile swap swap defaults 0 0
将软件源修改为国内源 由于网络环境的原因,将 repo 源修改为清华大学 。
在 /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
(此步骤执行时间较长,一般需要 3~5 分钟左右,请耐心等待)
yum makecache
打开 /etc/gitlab/gitlab.rb 文件,在第 13 行附近找到 external_url 'http://gitlab.example.com’,将单引号中的内容改为自己的域名(带上协议头,末尾无斜杠)
external_url 'http://119.29.102.85'
使用如下命令初始化 GitLab:
(此步骤执行时间较长,一般需要 5~10 分钟左右,请耐心等待)
sudo gitlab-ctl reconfigure
当看到这个就说明我们gitlab已经安装成功了
gitlab 启停相关操作
启动服务:gitlab -ctl start
查看状态:gitlab -ctl status
停掉服务:gitlab -ctl stop
重启服务:gitlab -ctl restart
让配置生效:gitlab -ctl reconfigure。
sudo gitlab-ctl reconfigure
sudo gitlab-ctl stop
sudo gitlab-ctl start
sudo gitlab -ctl restart
sudo gitlab-ctl reconfigure
sudo gitlab-ctl stop
sudo gitlab-ctl start
sudo gitlab -ctl restart
### 5.3 启动成功之后我们通过浏览器访问下
## 五: 初始化管理员密码
### 5.1