美文网首页Android开发经验笔记
CentOS7安装GitLab的过程详解

CentOS7安装GitLab的过程详解

作者: 陈利健 | 来源:发表于2017-12-31 15:20 被阅读389次

接上一篇win10通过ubuntu虚拟机安装Gitlab的过程详解,从作为日常开发的服务器平台的角度,虚拟机毕竟性能有限,所以这次搞了一台闲置的PC,给它装上CentOS,然后在其上搭建Gitlab。

我们依然选择困难模式来讲解整个过程:
假如你使用的是一台Win10电脑,并且从没接触过Linux、Gitlab,那就可以按照下面的步骤一步步来配置。如果你熟悉其中部分过程或者拥有部分配置,可以选择性地跳过它们。

简单来说分为以下几个步骤:

  1. U盘安装CentOS7
  2. 安装Gitlab
  3. 配置Gitlab

U盘安装CentOS7

  1. 下载CentOS7镜像文件: https://www.centos.org/download

    下载CentOS7镜像文件.png
  2. 下载映像文件制作工具:推荐使用UltraISO

  3. 准备一个至少8G容量以上的U盘

  4. 将CentOS-7.0镜像通过UltraISO写入到到U盘内

  5. 重启PC,在BIOS中将启动顺序改为U盘启动,退出重启,系统会自动进入到CentOS安装步骤,选择“Install CentOS 7”

  6. 后续的安装过程及图示可以参考这篇文章: http://www.osyunwei.com/archives/7829.html。尤其是要注意的是:CentOS模式是最小安装,即没有图形界面。假如需求图形界面,请确保在安装的时候选择GNOME,这样安装好后就有图形界面。

  7. 假如当前是最小化安装没有图形界面,或者当前默认进入了命令行界面,想切换回图形界面该如何操作呢?那就通过yum命令来安装gnome包。 然后重启便进入了GUI界面。

    # yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
    
    # ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
    
    # reboot
    

安装Gitlab

  1. 在CentOS系统上,下面的命令将会打开系统防火墙HTTP和SSH访问。
  sudo yum install curl policycoreutils openssh-server openssh-clients
  sudo systemctl enable sshd
  sudo systemctl start sshd
  sudo yum install postfix
  sudo systemctl enable postfix
  sudo systemctl start postfix
  sudo firewall-cmd --permanent --add-service=http
  sudo systemctl reload firewalld 
  1. 添加GitLab镜像源并安装

    curl -sS http://packages.gitlab.com.cn/install/gitlab-ce/script.rpm.sh | sudo bash

这是官方的yum源,安装速度会比较慢,可以使用国内源,修改如下文件即可:

  vim /etc/yum.repos.d/gitlab_gitlab-ce.repo

修改内容如下:

    [gitlab-ce]
    name=gitlab-ce
    baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
    repo_gpgcheck=0
    gpgcheck=0
    enabled=1
    gpgkey=https://packages.gitlab.com/gpg.key

然后执行安装命令:

    sudo yum install gitlab-ce
  1. 配置并启动 GitLab,配置IP的过程请参考上一篇文章。

    sudo gitlab-ctl reconfigure
    

假如GitLab在访问的时候经常502,原因可能是内存不足,可以配置虚拟内存

sudo dd if=/dev/zero of=/swapfile bs=1024 count=2048k
sudo mkswap /swapfile
sudo swapon /swapfile
sudo vim /etc/fstab

相关文章

网友评论

  • 7047c1cee0c1:安装过程中报错了
    Transaction check error:
    installing package gitlab-ce-11.1.4-ce.0.el7.x86_64 needs 8487 inodes on the / filesystem
    installing package audit-2.8.1-3.el7.x86_64 needs 8561 inodes on the / filesystem

    Error Summary

本文标题:CentOS7安装GitLab的过程详解

本文链接:https://www.haomeiwen.com/subject/qupngxtx.html