私有仓库Gitlab的安装与汉化

Posted wx60c1f94c784b4

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了私有仓库Gitlab的安装与汉化相关的知识,希望对你有一定的参考价值。


Gitlab软件及汉化包下载:

 ​清华大学源(gitlab-ce社区版 centos7下载):https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

 ​汉化包各版本下载(上半部分gitlab处选择tag版本):https://gitlab.com/xhang/gitlab/-/tree/12-0-stable-zh

私有仓库Gitlab的安装与汉化_redis

1.准备基础环境及Gitlab安装包

[root@localhost ~]# echo Gitlab > /etc/hostname
[root@localhost ~]# hostname Gitlab

--永久关闭防火墙和Selinux
[root@Gitlab ~]# systemctl disable firewalld
[root@Gitlab ~]# systemctl stop firewalld
[root@Gitlab ~]# setenforce 0
[root@Gitlab ~]# sed -i s/enforcing/disabled/ /etc/selinux/config
[root@Gitlab ~]# getenforce

[root@Gitlab ~]# ll
总用量 700008
-rw-r--r--. 1 root root 76578487 34 14:59 gitlab-12-0-stable-zh.tar.gz
-rw-r--r--. 1 root root 640227518 34 15:00 gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm

2.安装Gitlab服务所需的依赖包

[root@Gitlab ~]# yum install -y curl policycoreutils-python openssh-server perl

3.使用yum localinstall安装rpm包时会自动解决依赖问题

[root@Gitlab ~]# yum localinstall -y gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm
...
...
正在安装 : gitlab-ce-12.0.3-ce.0.el7.x86_64 1/1
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

验证中 : gitlab-ce-12.0.3-ce.0.el7.x86_64 1/1

已安装:
gitlab-ce.x86_64 0:12.0.3-ce.0.el7

完毕!

4.配置Gitlab服务、访问域名以及邮箱

注意:

 每次修改完/etc/gitlab/gitlab.rb文件都需要重新初始化一次!

[root@Gitlab ~]# vim /etc/gitlab/gitlab.rb
...
external_url http://gitlab.fzmyw.com
...(邮件配置也在里面)

 配置邮箱服务的用途:1.账号注册时,邮件验证。2.修改密码时,通过邮件修改。

私有仓库Gitlab的安装与汉化_4s_02

关闭Gitlab中的Prometheus监控(不使用的话,开着会特别占用内存)

...
1385 prometheus[enable] = false #将true修改为false
...

5.初始化Gitlab服务并启动

注意:

 每次修改完/etc/gitlab/gitlab.rb文件都需要重新初始化一次!

[root@Gitlab ~]# gitlab-ctl reconfigure
Starting Chef Client, version 13.6.4
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
- package (0.1.0)
- postgresql (0.1.0)
- redis (0.1.0)
- registry (0.1.0)
- consul (0.1.0)
- gitaly (0.1.0)
- letsencrypt (0.1.0)
- nginx (0.1.0)
- runit (4.3.0)
- acme (3.1.0)
- mattermost (0.1.0)
- crond (0.1.0)
- gitlab (0.0.1)
...
...

[root@Gitlab ~]# gitlab-ctl status #查看gitlab初始化后的状态(启动了很多组件,不需要的都可以关闭)
run: alertmanager: (pid 13077) 164s; run: log: (pid 12872) 207s
run: gitaly: (pid 13027) 166s; run: log: (pid 12194) 295s
run: gitlab-monitor: (pid 13066) 165s; run: log: (pid 12754) 224s
run: gitlab-workhorse: (pid 13047) 166s; run: log: (pid 12591) 251s
run: grafana: (pid 13174) 163s; run: log: (pid 13006) 177s
run: logrotate: (pid 12647) 240s; run: log: (pid 12657) 239s
run: nginx: (pid 12621) 246s; run: log: (pid 12629) 245s
run: node-exporter: (pid 13059) 166s; run: log: (pid 12702) 233s
run: postgres-exporter: (pid 13091) 163s; run: log: (pid 12932) 202s
run: postgresql: (pid 12329) 290s; run: log: (pid 12391) 289s
run: redis: (pid 12135) 302s; run: log: (pid 12165) 301s
run: redis-exporter: (pid 13070) 164s; run: log: (pid 12850) 214s
run: sidekiq: (pid 12549) 258s; run: log: (pid 12561) 255s
run: unicorn: (pid 12508) 264s; run: log: (pid 12531) 261s

6.访问Gitlab服务、以及Gitlab汉化

 由于我们在上面配置的Gitlab的域名没有备案,属于假域名,只能供我们自己内网测试,所以Windows本机测试的时候可以修改一下hosts文件,就可以解析到我们配置的域名了。

私有仓库Gitlab的安装与汉化_redis_03

私有仓库Gitlab的安装与汉化_gitlab_04

设置Gitlab登录密码并登录

私有仓库Gitlab的安装与汉化_4s_05

私有仓库Gitlab的安装与汉化_redis_06

Gitlab汉化

Gitlab汉化包下载地址(tag处可选版本):https://gitlab.com/xhang/gitlab/-/tree/12-0-stable-zh

[root@Gitlab ~]# ll
总用量 700008
-rw-r--r--. 1 root root 76578487 34 14:59 gitlab-12-0-stable-zh.tar.gz
-rw-r--r--. 1 root root 640227518 34 15:00 gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm

[root@Gitlab ~]# tar -xf gitlab-12-0-stable-zh.tar.gz #解压Gitlab汉化包

[root@Gitlab ~]# gitlab-ctl stop #停止Gitlab
ok: down: alertmanager: 0s, normally up
ok: down: gitaly: 1s, normally up
ok: down: gitlab-monitor: 0s, normally up
ok: down: gitlab-workhorse: 0s, normally up
ok: down: grafana: 0s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 1s, normally up
ok: down: node-exporter: 0s, normally up
ok: down: postgres-exporter: 1s, normally up
ok: down: postgresql: 0s, normally up
ok: down: redis: 0s, normally up
ok: down: redis-exporter: 1s, normally up
ok: down: sidekiq: 1s, normally up
ok: down: unicorn: 0s, normally up

[root@Gitlab ~]# \\cp -r gitlab-12-0-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/ #加上\\防止有重复的,在拷贝时会报2个异常(log、tmp),不用管

[root@Gitlab ~]# gitlab-ctl start #启动Gitlab
ok: run: alertmanager: (pid 16842) 0s
ok: run: gitaly: (pid 16850) 1s
ok: run: gitlab-monitor: (pid 16871) 0s
ok: run: gitlab-workhorse: (pid 16874) 1s
ok: run: grafana: (pid 16882) 0s
ok: run: logrotate: (pid 16895) 0s
ok: run: nginx: (pid 16901) 1s
ok: run: node-exporter: (pid 16906) 0s
ok: run: postgres-exporter: (pid 16910) 1s
ok: run: postgresql: (pid 16991) 0s
ok: run: redis: (pid 17000) 1s
ok: run: redis-exporter: (pid 17004) 0s
ok: run: sidekiq: (pid 17009) 0s
ok: run: unicorn: (pid 17015) 1s

私有仓库Gitlab的安装与汉化_redis_07

私有仓库Gitlab的安装与汉化_gitlab_08

私有仓库Gitlab的安装与汉化_redis_09

↓↓↓↓↓↓

最近刚申请了个微信公众号,上面也会分享一些运维知识,大家点点发财手关注一波,感谢大家。【原创公众号】:非著名运维 【福利】:公众号回复 “资料” 送运维自学资料大礼包哦!

私有仓库Gitlab的安装与汉化_4s_10



以上是关于私有仓库Gitlab的安装与汉化的主要内容,如果未能解决你的问题,请参考以下文章

安装gitlab并汉化

CI/CD持续集成与持续交付(上)-------- git,gitee远程共有仓库和gitlab私有仓库,jenkins

CI/CD持续集成与持续交付(上)-------- git,gitee远程共有仓库和gitlab私有仓库,jenkins

汉化gitlab

Gitlab部署及汉化操作

CI/CD之搭建私有git仓库gitlab