CentOS 7.2安装GitLab CE 图文详解

GitLab是一个很好的git的web管理系统,其免费版本GitLab-CE也足够满足一般的需求。这里记录下GitLab-CE的安装过程。

GitLab官网:https://about.gitlab.com

1.根据官方文档安装
1)选择相应的版本

CentOS 7.2安装GitLab CE 图文详解

2)安装基础软件依赖包
sudo yum install curl policycoreutils openssh-server openssh-clients

3)开启sshd服务

sudo systemctl enable sshd
sudo systemctl start sshd

4)开放GitLab web的端口
firewall-cmd --permanent --add-port=80/tcp

5)添加gitlab国内yum源,并安装gitlab-ce

curl -sS | sudo bash
sudo yum install gitlab-ce

(GitLab-CE中国镜像源 清华大学TUNA开源镜像站, 浙江大学开源镜像站)6)配置/etc/gitlab/gitlab.rb,可参考https://doc.gitlab.cc/omnibus/

CentOS 7.2安装GitLab CE 图文详解

CentOS 7.2安装GitLab CE 图文详解

CentOS 7.2安装GitLab CE 图文详解

若使用HTTPS方式,还需证书:

CentOS 7.2安装GitLab CE 图文详解

若使用smtp方式收发邮件,需要修改此处
vim /opt/gitlab/embedded/service/gitlab-rails/config/environments/production.rb

CentOS 7.2安装GitLab CE 图文详解

7)执行命令:gitlab-ctl reconfigure
如果报如下错误,用户不存在:

CentOS 7.2安装GitLab CE 图文详解

则手动添加用户(不知道别人是不是也有这种情况)
1234 useradd -d /var/opt/gitlab -s /bin/sh git
useradd -d /var/opt/gitlab/nginx -s /bin/false gitlab-www
useradd -d /var/opt/gitlab/redis -s /bin/nologin gitlab-redis
useradd -d /var/opt/gitlab/postgresql -s /bin/sh gitlab-psql

后再次执行如下命令:
gitlab-ctl reconfigure

8)上述命令执行成功后执行如下命令启动GitLab:

gitlab-ctl start

最后,浏览器访问GitLab对外显示的地址,即可正常使用了。

更多GitLab相关教程见以下内容

Ubuntu 14.04下安装GitLab指南 

如何在Ubuntu Server 14.04下安装Gitlab中文版 

CentOS源码安装GitLab汉化版 

CentOS 7下GitLab 9.1.0 安装及汉化 

搭建属于自己的GitLab 

Ubuntu 14.04搭建GitLab服务器 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13931.html