CentOS7 部署 gitlab

一.环境准备

1)下载wget

yum install -y wget

2)备份默认的yum

mv /etc/yum.repos.d /etc/yum.repos.d.backup

3)设置新的yum目录

mkdir /etc/yum.repos.d

4)下载阿里yum配置到该目录中

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

5)重建缓存

yum clean all
yum makecache

6)升级所有包

yum update -y

7)安装vim

yum install -y vim

 

二   获取gitlab 汉化包(非汉化 可跳过)

2.1 安装git

yum install -y git

2.2 克隆获取汉化版本库


git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh

 

三、部署社区版gitlab

3.1 安装gitlab的依赖项

yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python

3.2 启动postfix,并设置为开机启动 

systemctl start postfix
systemctl enable postfix

 3.3 设置防火墙

firewall-cmd --add-service=http --permanent
firewall-cmd --reload

 3.4 获取gitlab的rpm包

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm

3.5 安装rpm包

rpm -i gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm

3.6 修改配置文件gitlab.rb

vim /etc/gitlab/gitlab.rb

 

 

 3.7 因为修改了配置文件,故需要重新加载配置内容

gitlab-ctl reconfigure
gitlab-ctl restart

 

四、覆盖汉化包

4.1 停止gitlab服务

gitlab-ctl stop

4.2 切换到gitlab汉化包所在的目录(即步骤二获取的汉化版gitlab)

cd /root/gitlab

4.3 比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下 

git diff v10.0.2 v10.0.2-zh > ../10.0.2-zh.diff

4.4 回到/root目录

cd

4.5 将10.0.2-zh.diff作为补丁更新到gitlab中 

yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.2-zh.diff

4.6 重新配置gitlab 

gitlab-ctl reconfigure

4.7 启动gitlab

gitlab-ctl start

 

五、设置管理员密码

 六 ,最近学的一种 ,感觉好用(中文,部署简单)

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install -y gitlab-ce
vim /etc/gitlab/gitlab.rb
gitlab-ctl reconfigure
gitlab-ctl restart

 

 

 修改好ip 和 端口   加载配置文件  

 

 

 这3项无要求

 

 

 

参考文献   :https://www.cnblogs.com/straycats/p/7637373.html

 

posted @ 2020-05-27 14:05  TNTsc  阅读(379)  评论(0编辑  收藏  举报