一、环境准备 CentOS 7 最小化安装 内存 4G 以上 更新系统 yum -y update (非必须) 二、部署过程 1. 更新阿里云 #wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 2. 重建缓存 #yum clean all #yum makecache 3.部署社区版gitlab (1)安装gitlab的依赖项 #yum install curl openssh-server openssh-clients postfix cronie policycoreutils-python -y (2)启动postfix,并设置为开机启动 #systemctl start postfix #systemctl enable postfix 3. 获取gitlab的rpm包 #wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm 4. 安装rpm包 #rpm -i gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm #配置并启动 GitLab #gitlab-ctl reconfigure 5.获取gitlab 汉化包 说明:gitlab中文社区版的项目,v7-v8.8是由Larry Li发起的“GitLab 中文社区版项目”(https://gitlab.com/larryli/gitlab),从 v8.9 之后,@xhang 开始继续该汉化项目(https://gitlab.com/xhang/gitlab)。 6. 安装git #yum install -y git 7. 克隆获取汉化版本库 #git clone https://gitlab.com/xhang/gitlab.git 8.修改配置文件gitlab.rb #vim /etc/gitlab/gitlab.rb 将external_url变量的地址修改为gitlab所在centos的ip地址。
因为修改了配置文件,故需要重新加载配置内容。
#gitlab-ctl reconfigure
#gitlab-ctl restart
9. 查看gitlab版本
#head -1 /opt/gitlab/version-manifest.txt
10.覆盖汉化包
#停止gitlab服务
gitlab-ctl stop
#切换到gitlab汉化包所在的目录(即步骤二获取的汉化版gitlab)
cd /root/gitlab
#比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下
git diff v10.0.2 v10.0.2-zh > ../10.0.2-zh.diff
#将10.0.2-zh.diff作为补丁更新到gitlab中
yum install patch -y
#去到汉化目录
#cd /root/
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.2-zh.diff
#启动gitlab
gitlab-ctl start
#重新配置gitlab
gitlab-ctl reconfigure
11.设置管理员密码
管理员账号登录的用户名:root
(虽然登录后管理员的用户名为Administrator,但是实际登录的用户名是root)
方法二:命令方式
gitlab-rails console production
稍等一会后会出现
irb(main):001:0> user = User.where(id: 1).first // id为1的是超级管理员
irb(main):002:0>user.password = 'yourpassword' // 密码必须至少8个字符
irb(main):003:0>user.save! // 如没有问题 返回true
exit // 退出
发表评论