安装gitlab社区版


安装环境
系统版本:CentOS Linux release 7.9.2009 (Core)

1. 配置yum

vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
Repo_gpgcheck=0
Enabled=1
Gpgkey=https://packages.gitlab.com/gpg.key

2. 更新本地yum缓存

sudo yum makecache

3. 安装Gitlab社区版

sudo yum install gitlab-ce        #自动安装最新版
sudo yum install gitlab-ce-x.x.x    #安装指定版本

注意:
如果无法安装,提示:The GPG keys listed for the “gitlabce” repository are already installed but they are not correct for this package.Check that the correct key URLs are configured for this repository.

4. 修改 /etc/yum.repos.d/gitlabce.repo 后再次安装

[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
Repo_gpgcheck=0
Enabled=1
gpgcheck=0

5. 安装完成后启动服务

sudo gitlab-ctl reconfigure

注意
参考https://www.cnblogs.com/springwind2006/p/6872773.html
如果在安装过程中卡住
1、按住CTRL+C强制结束
2、运行sudo systemctl restart gitlabrunsvdir;
3、再次执行sudo gitlabctl reconfigure

6. GitLab常用命令

sudo gitlab-ctl start    # 启动所有 gitlab 组件
sudo gitlab-ctl stop        # 停止所有 gitlab 组件
sudo gitlab-ctl restart        # 重启所有 gitlab 组件
sudo gitlab-ctl status        # 查看服务状态
sudo gitlab-ctl reconfigure        # 启动服务
sudo vim /etc/gitlab/gitlab.rb        # 修改默认配置文件
gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
sudo gitlab-ctl tail        # 查看日志

扩展

如果是CentOS release 6.x (Final)
CentOS-Base.repo使用阿里云的yum源

[root@Centos6 yum.repos.d]# cat CentOS-Base.repo 
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注