20201225更新
- 关于GitLab版本下载说明[非常重要]:GitLab的el版本号一定要与当前CentOS的系统版本号一致
[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.7.1-ce.0.el7.x86_64.rpm # 这里的el7代表的是CentOS7版本的GitLab-v13.7.1, # 因为有看到很多帖子显示依赖明明装上了但是rpm安装的时候依然报错policycoreutils-python-utils is needed by gitlab-ce, # 问题就在包的CentOS版本上,下载的GitLab的el版本号一定要与当前CentOS7系统版本号一致
-
发现 https://gitlab.com/xhang/gitlab.git(https://gitee.com/panda26/gitlab.git) 汉化包已不再提供支持,故使用的是GitLab自带的语言设置,虽然汉化不全面但不影响日常使用;
GitLab 13.7.1 安装与配置
# 依赖安装与配置
[root@localhost ~]# sudo yum install wget vim policycoreutils-python policycoreutils-python-utils openssh-server openssh-clients postfix
# 开启邮件服务
[root@localhost src]# systemctl enable postfix
[root@localhost src]# systemctl start postfix
# GitLab 13.7.1 下载
[root@localhost ~]# cd /usr/local/src
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.7.1-ce.0.el7.x86_64.rpm
[root@localhost src]# ls -ll
total 808456
-rw-r--r--. 1 root root 827858918 Dec 23 14:10 gitlab-ce-13.7.1-ce.0.el7.x86_64.rpm
# GitLab 13.7.1 安装与配置
# 安装 GitLab 13.7.1
[root@localhost src]# rpm -ivh gitlab-ce-13.7.1-ce.0.el7.x86_64.rpm
warning: gitlab-ce-13.7.1-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:gitlab-ce-13.7.1-ce.0.el7 ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=13-7
# 重新配置GitLab
[root@localhost src]# gitlab-ctl reconfigure
# 重新启动GitLab
[root@localhost src]# gitlab-ctl restart
# 关闭并禁用防火墙
[root@localhost src]# systemctl stop firewalld
[root@localhost src]# systemctl disable firewalld
# 浏览器访问虚拟机中的 http://192.168.186.129/
GitLab 13.7.1 汉化
GitLab 13.7.1 修改默认端口号
# 发现 80端口被 GitLab 13.7.1 占用了
[root@localhost local]# netstat -tunpl | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5596/nginx: master
tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 5596/nginx: master
# 停止GitLab并配置端口
[root@localhost src]# gitlab-ctl stop
[root@localhost src]# vim /etc/gitlab/gitlab.rb
# :32 跳转到32行 注释掉原配置后 修改 暴露的IP和端口
# external_url 'http://gitlab.example.com'
external_url 'http://192.168.186.129:15080'
# 重新配置GitLab
[root@localhost src]# gitlab-ctl reconfigure
# 重新启动GitLab
[root@localhost src]# gitlab-ctl restart
# 再次查询端口占用 发现 端口已变更为 15080
[root@localhost local]# netstat -tunpl | grep 80
tcp 0 0 0.0.0.0:8060 0.0.0.0:* LISTEN 7074/nginx: master
tcp 0 0 0.0.0.0:15080 0.0.0.0:* LISTEN 7074/nginx: master
# 再去浏览器中再次确认
http://192.168.186.129:15080/admin
GitLab 13.7.1 常用命令
gitlab-ctl start # 启动所有 gitlab 组件
gitlab-ctl stop # 停止所有 gitlab 组件
gitlab-ctl restart # 重启所有 gitlab 组件
gitlab-ctl status # 查看服务状态
gitlab-ctl reconfigure # 启动服务
vim /etc/gitlab/gitlab.rb # 修改默认的配置文件
gitlab-rake gitlab:check SANITIZE=true --trace # 检查gitlab
sudo gitlab-ctl tail # 查看日志
gitlab-ctl --help #查看更多命令