因为之前消耗三天,一直不能够成功安装部署gitlab服务器,究其原因,发现最先安装的VMware版本为精简版本,不具有全部VMware功能,当然与自身的win10系统不全也有问题,最后通过重装系统,重新在VMware官网下载的VMware,以及官网版xshell,最终完成gitlab服务器搭建,以下所有命令均为管理员命令,如果没有使用管理员权限请在每一行命令前添加sudo
环境准备
该gitlab本地服务器搭建使用工具:VMware Workstation 14 Pro(14.1.2 build-8497320),Xshell,最新版gitlab-ce。
接下来上干货:
1. 为了快速下载我们把其默认镜源像修改为阿里云源镜像。
首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2. 下载ailiyun的yum源配置文件到/etc/yum.repos.d/
CentOS7:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 下划线处根据centos的版本修改。
3.运行yum makecache生成缓存:
yum makecache
4.更新系统:
yum -y update
安装
到这一步源镜像修改完成了,下面开始安装gitlab。
阿里云官方给出两种方法安装,一种是镜像安装(付费),一种是手动安装,我们主要讲手动安装。
1. 配置yum源:vim /etc/yum.repos.d/gitlab-ce.repo
复制以下内容:
1. [gitlab-ce]
2. name=gitlab-ce
3. baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
4. Repo_gpgcheck=0
5. Enabled=1
6. Gpgkey=https://packages.gitlab.com/gpg.key
下划线版本根据centos版本修改。
2. 更新本地yum缓存:yum makecache
3. 安装gitlab社区版,最新版本yum install gitlab-ce
安装指定版本yuminstall gitlab-ce-x.x.x(xxx版本号)
4关掉虚拟机防火墙
//临时关闭
systemctl stop firewalld
//禁止开机启动
systemctl disablefirewalld
5.常用命令
1. sudo gitlab-ctl start# 启动所有 gitlab 组件;
2. sudo gitlab-ctl stop# 停止所有 gitlab 组件;
3. sudo gitlab-ctl restart # 重启所有 gitlab 组件;
4. sudo gitlab-ctl status # 查看服务状态;
5. sudo gitlab-ctl reconfigure # 启动服务;
6. sudo vim /etc/gitlab/gitlab.rb # 修改默认的配置文件;
7. gitlab-rake gitlab:check SANITIZE=true--trace# 检查gitlab;
8. sudo gitlab-ctl tail