centos7.3 gitlab 安装配置
1. 设备环境
硬件配置联想 TS250 E3-1225,16G内存,2X1 TB
软件CentOS-7-x86_64-DVD-1804.iso ,安装时选择桌面版
推荐配置参考:https://docs.gitlab.com/ce/install/requirements.html
2. 更换软件源
#mv /etc/yum.repos.d /etc/yum.repos.d.backup #mkdir /etc/yum.repos.d #wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #yum clean all #yum makecache #yum update -y
3. 安装社区版gitlab
安装相关依赖软件并设置postfix 和 firewall-cmd
#yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python #systemctl start postfix #systemctl enable postfix
#firewall-cmd --permanent --zone=public --add-port=8888/tcp //gitlab http访问的端口
#firewall-cmd --add-service=http --permanent
#firewall-cmd --reload
下载gitlab安装包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm
安装gitlab
rpm -i gitlab-ce-11.2.3-ce.0.el7.x86_64.rpm
4. 修改gitlab配置/etc/gitl
external_url 'http://192.168.3.104:8888' #http 访问地址
gitlab_rails['manage_backup_path'] = true gitlab_rails['backup_path'] = "/backup/gitlab/backups" #自定义备份目录 gitlab_rails['backup_keep_time'] = 2592000 #(30*24*3600) 自动清除30天前的备份文件 git_data_dirs({ "default" => { "path" => "/data/gitlab/git-data" #自定义代码库目录位置 } })
5. 汉化gitlab
本文采用的 11.2.3 版本,所以汉化版本要对应
#git clone https://gitlab.com/xhang/gitlab.git
#git diff v11.2.3 v11.2.3-zh > /tmp/v11.2.3.patch
#patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/v11.2.3.patch
6. 启动gitlab
#gitlab-ctl reconfigure #gitlab-ctl restart #gitlab-ctl status #查看状态
#gitlab-ctl tail #查看日志
命令修改root密码
#gitlab-rails console production
-------------------------------------------------------------------------------------
GitLab: 11.2.3 (06cbee3)
GitLab Shell: 8.1.1
postgresql: 9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
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 // 退出
参考文档:
http://www.cnblogs.com/straycats/p/7637373.html