# 使用阿里云作加速
cd /etc/yum.repos.d/
mkdir bak
mv *.repo ./bak
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 添加 GitLab 镜像源并安装,建议切换国内资源加速访问
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
# 创建 gitlab-ce 的 repo,使用清华大学加速
vim /etc/yum.repos.d/gitlab_gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
# 安装 yum-plugin-downloadonly 插件
yum install -y yum-plugin-downloadonly
# 下载 gitlab-ce 相关 rpm 到指定目录
mkdir -p /tmp/repo/gitlab-ce/
yum install --downloadonly --downloaddir=/tmp/repo/gitlab-ce/ gitlab-ce
# 生成rpm包gitlab-ce-12.10.1-ce.0.el7.x86_64.rpm
# gitlab-ce-12.10.1-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-11.4.5-ce.0.el7.x86_64.rpm
# gitlab预配置
vi /etc/gitlab/gitlab.rb
# 找到并修改external_url 'http://gitlab.example.com'
external_url 'http://服务器IP'
# 自动配置gitlab
gitlab-ctl reconfigure
# 启动所有服务
gitlab-ctl start
网友评论