安装的时候有可能会报错,尽量把内存加到2G以上
[root@localhost ~]# echo "git02 127.0.0.1" >> /etc/hosts #讲本地映射到本地hosts文件中
[root@localhost ~]# tail -1 /etc/hosts
git02 127.0.0.1
[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm 从云yum上下载gitlab安装包
[root@localhost ~]# yum localinstall gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm -y #yum localinstall 利用yum安装本地指定的rpm包,好处是自动解决依赖问题
#初始化GitLab,只需要执行一次
[root@localhost ~]# gitlab-ctl reconfigure
#查看gitlab启动状态
[root@localhost ~]# gitlab-ctl status
#查看gitlab的版本号
[root@localhost ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
[root@localhost ~]# gitlab-ctl start #启动gitlab的服务
在pc端输入gitlab_server端的ip地址就可以进行登录访问
设定管理员初始密码,最少8位
登录成功后的页面,下面有功能就可以使用了
gitlab中文社区版补丁包安装
GitLab中文社区: https://gitlab.com/xhang/gitlab/tree/11-2-stable-zh
#解压gitlab中文版补丁包
[root@localhost ~]# tar xf gitlab-11-2-stable-zh.tar.gz
#查看系统安装好的gitlab版本号
[root@localhost ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
11.2.3
#查看解压后的补丁包版本号
[root@localhost ~]# cat gitlab-11-2-stable-zh/VERSION
11.2.3
注意:
补丁包版本号和安装的gitlab的版本号需要一致的。
#备份英文版的gitlab
[root@localhost ~]# cp -r /opt/gitlab/embedded/service/gitlab-rails{,.bak}
#将中文补丁包的内容覆盖到英文版
[root@localhost ~]# /bin/cp -rf gitlab-11-2-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
/bin/cp: cannot overwrite non-directory ‘/opt/gitlab/embedded/service/gitlab-rails/log’ with directory ‘gitlab-11-2-stable-zh/log’
/bin/cp: cannot overwrite non-directory ‘/opt/gitlab/embedded/service/gitlab-rails/tmp’ with directory ‘gitlab-11-2-stable-zh/tmp’
#注意
此报错不用管,因为已经设置过root密码,登录过,所以会报错
#重新配置gitlab
[root@localhost ~]# gitlab-ctl reconfigure
#重新启动gitlab
[root@localhost ~]# gitlab-ctl restart
重新刷新浏览器访问gitlab
创建一个项目
修改GitLab配置文件/etc/gitlab/gitlab.rb
我们需要修改GitLab的默认访问域名(因为我们是在内网搭建的GitLab)
GitLab默认的监听端口为80,但是在企业中,这个端口经常被别的服务占用,所以我们还需要更换端口号
[root@localhost ~]# cat -n /etc/gitlab/gitlab.rb.bak | sed -n '13p;943p'
cat: /etc/gitlab/gitlab.rb.bak: No such file or directory
[root@localhost ~]# cat -n /etc/gitlab/gitlab.rb | sed -n '13p;943p'
13 external_url 'http://192.168.182.143:8888'
943 nginx['listen_port'] = 8888
#重新配置gitlab
[root@localhost ~]# gitlab-ctl reconfigure
#重启gitlab
[root@localhost ~]# gitlab-ctl restart
重新访问浏览器