Gitlab配置搭建
环境:centos7.4 gitlab11.0.3 内存8G
1、构建yum源
[root@localhost ~]# vim /etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 gpgcheck=0 enabled=1
2、安装gitlab
[root@localhost ~]# yum install gitlab-ce -y
3、修改配置
[root@localhost ~]# vim /etc/gitlab/gitlab.rb external_url 'http://172.20.10.7' #在第13行,修改gitlab访问地址,默认为external_url 'http://gitlab.example.com' gitlab_rails['time_zone'] = 'Asia/Shanghai' # 49行修改时区,默认为UTC
4、重新加载配置
[root@localhost ~]# gitlab-ctl reconfigure
5、加载开机启动
[root@localhost ~]# echo "gitlab-ctl start" >>/etc/rc.local [root@localhost ~]# gitlab-ctl start
6、查看状态
[root@localhost ~]# gitlab-ctl status run: alertmanager: (pid 56752) 2542s; run: log: (pid 5920) 11265s run: gitaly: (pid 56760) 2542s; run: log: (pid 5865) 11269s run: gitlab-monitor: (pid 56771) 2541s; run: log: (pid 5883) 11268s run: gitlab-workhorse: (pid 56784) 2541s; run: log: (pid 5853) 11269s run: logrotate: (pid 56791) 2540s; run: log: (pid 5882) 11268s run: nginx: (pid 56799) 2540s; run: log: (pid 5881) 11268s run: node-exporter: (pid 56805) 2539s; run: log: (pid 5866) 11269s run: postgres-exporter: (pid 56810) 2539s; run: log: (pid 5943) 11265s run: postgresql: (pid 56815) 2538s; run: log: (pid 5839) 11270s run: prometheus: (pid 56817) 2538s; run: log: (pid 5930) 11265s run: redis: (pid 56822) 2537s; run: log: (pid 5863) 11269s run: redis-exporter: (pid 56826) 2537s; run: log: (pid 5884) 11268s run: sidekiq: (pid 56831) 2536s; run: log: (pid 5841) 11270s run: unicorn: (pid 56842) 2536s; run: log: (pid 5840) 11270s
7、访问测试
- 第一次访问会提示修改root密码,新密码为:lncs.net (有复杂度要求,至少8位)
- 登录: http://172.20.10.7 用户名: root 密码:lncs.net
到此,gitlab搭建成功
8、汉化
- 查看版本信息
[root@localhost ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION 11.0.3
- GitLab 中文社区版
https://gitlab.com/xhang/gitlab/
- 下载相应版本
[root@localhost ~]# wget https://gitlab.com/xhang/gitlab/-/archive/11-0-stable-zh/gitlab-11-0-stable-zh.tar.gz
- 关闭gitlab服务
[root@localhost ~]# gitlab-ctl stop ok: down: alertmanager: 1s, normally up ok: down: gitaly: 0s, normally up ok: down: gitlab-monitor: 0s, normally up ok: down: gitlab-workhorse: 0s, normally up ok: down: logrotate: 0s, normally up ok: down: nginx: 0s, normally up ok: down: node-exporter: 1s, normally up ok: down: postgres-exporter: 0s, normally up ok: down: postgresql: 0s, normally up ok: down: prometheus: 0s, normally up ok: down: redis: 0s, normally up ok: down: redis-exporter: 1s, normally up ok: down: sidekiq: 0s, normally up ok: down: unicorn: 0s, normally up
- 汉化
[root@localhost ~]# tar xf gitlab-11-0-stable-zh.tar.gz
[root@localhost ~]# /usr/bin/cp -rf ./gitlab-11-0-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
- 重启服务
[root@localhost ~]# gitlab-ctl status run: alertmanager: (pid 56752) 2542s; run: log: (pid 5920) 11265s run: gitaly: (pid 56760) 2542s; run: log: (pid 5865) 11269s run: gitlab-monitor: (pid 56771) 2541s; run: log: (pid 5883) 11268s run: gitlab-workhorse: (pid 56784) 2541s; run: log: (pid 5853) 11269s run: logrotate: (pid 56791) 2540s; run: log: (pid 5882) 11268s run: nginx: (pid 56799) 2540s; run: log: (pid 5881) 11268s run: node-exporter: (pid 56805) 2539s; run: log: (pid 5866) 11269s run: postgres-exporter: (pid 56810) 2539s; run: log: (pid 5943) 11265s run: postgresql: (pid 56815) 2538s; run: log: (pid 5839) 11270s run: prometheus: (pid 56817) 2538s; run: log: (pid 5930) 11265s run: redis: (pid 56822) 2537s; run: log: (pid 5863) 11269s run: redis-exporter: (pid 56826) 2537s; run: log: (pid 5884) 11268s run: sidekiq: (pid 56831) 2536s; run: log: (pid 5841) 11270s run: unicorn: (pid 56842) 2536s; run: log: (pid 5840) 11270s
- 重新访问http://172.20.10.7
汉化完成!
注:自动化搭建请参考gitlab脚本 http://www.qunniao.net/1081.html
温馨提示:如无特殊说明,本站文章均为作者原创,转载请注明出处!