CentOS7安装GitLab

  1. 准备工作
    由于虚拟机默认采用的yum源比较慢,这里切换成了aliyun的镜像,方便后续的安装操作,节约时间
    1.1 备份
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    1.2 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    注:这里没有安装wget的话,需要安装一下
    1.3 之后运行yum makecache生成缓存
  2. 安装部署Gitlab
    2.1 安装依赖软件
    yum -y install policycoreutils openssh-server openssh-clients postfix
    2.2 设置postfix开机自启,并将其启动
    systemctl enable postfix && systemctl start postfix
    2.3 下载gitlab安装包
    wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.0-ce.0.el7.x86_64.rpm
    rpm -i gitlab-ce-10.8.0-ce.0.el7.x86_64.rpm
    这里用的是10.8.0,如果需要切换别的版本可以去该网址查找(https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7)
    CentOS7安装GitLab
    2.4 修改gitlab配置文件指定服务器ip和自定义端口
    vim /etc/gitlab/gitlab.rb
    CentOS7安装GitLab
    2.5 重置并启动GitLab
    gitlab-ctl reconfigure(这个步骤执行时间很长,需要耐心等待)
    gitlab-ctl restart
    2.6 访问 GitLab页面
    直接输入服务器ip和指定端口进行访问并且第一次登录需要修改密码
    CentOS7安装GitLab