centos7.9 搭建GitLab服务器
1.安装依赖包
yum install -y curl policycoreutils-python openssh-server
2.设置 SSH 开机自启动并启动 SSH 服务
systemctl enable sshd
systemctl start sshd
3.安装 Postfix
3.1.安装
yum install -y postfix
如出现下面提示,则代表该服务已经安装了。
3.2.执行以下命令,设置 Postfix 服务开机自启动
systemctl enable postfix
查看postfix服务状态
systemctl status postfix
3.3.打开 Postfix 的配置文件 main.cf
vi /etc/postfix/main.cf
按 i 进入编辑模式,删除 inet_interfaces = all
前的 #
,在 inet_interfaces = localhost
前加上 #
。
3.4.重启postfix
systemctl start postfix
systemctl restart postfix
4.执行以下命令,添加 GitLab 软件包仓库
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
5.安装 GitLab
sudo EXTERNAL_URL="实例公网 IP 地址" yum install -y gitlab-ce
安装的版本:gitlab-ce-14.8.4-ce.0.el7.x86_64.rpm
安装成功,注意整个安装后,gitLab占了大概有接近3G内存。
6.设置管理员账号密码
6.1.获取管理员帐户默认密码
cat /etc/gitlab/initial_root_password
进去以后,可以重置密码。
注意:最新版访问地址,直接就是80端口就可以访问了。
7.更改默认的仓库存储目录
默然安装时,默认的仓库存储路径在 /var/opt/gitlab/git-data目录下,仓库存储在子目录repositories里面,可以通过修改/etc/gitlab/gitlab.rb文件中git_data_dirs参数来自定义父目录。
vi /etc/gitlab/gitlab.rb
把该注释打开,使用自己的数据盘路径即可。
没有数据下,我们可以这样操作
先关闭应用,然后再重载一下配置,最后启动。
启动:gitlib-ctl start关闭:gitlab-ctl stop重启:gitlab-ctl restart重载配置:gitlab-ctl reconfigure查看状态:gitlab-ctl status