Linux安装gitlab

  一、GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。安装方法是参考GitLab在GitHub上的Wiki页面。

  二、我相信使用过git的开发人员,应该都知道git管理代码带来的好处吧,我们经常在github上面管理自己的代码,但是默认都是需要公开的。在企业里面使用git来做代码的管理也是非常方便的所以gitlab的使用在内网或者安全网络下是使用非常有必要的。

  三、centos7安装gitlab

  1)建议镜像获取安装包(新建一个gitlab-ce.repo文件

# vi /etc/yum.repos.d/gitlab-ce.repo

  加入以下内容:

[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

  2)然后执行更新和安装

# sudo yum makecache
# sudo yum install gitlab-ce

  3)等待完成安装过后,启动服务

# sudo gitlab-ctl reconfigure

  4)修改gitlab.rb配置并刷新配置

# vi /etc/gitlab/gitlab.rb

  

  这里只修改了访问地址,当然还有其他修改。自行百度!然后刷新配置

# sudo gitlab-ctl reconfigure

  四、Ubuntu16.04安装gitlab

  1)首先信任 GitLab 的 GPG 公钥:

curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null

  2)新建gitlab-ce.list文件

# vi /etc/apt/sources.list.d/gitlab-ce.list

  加入以下内容:

deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main

  注意:ubuntu的版本不一样加入的内容也不一样

  具体可以使用清华社的镜像:https://mirrors.tuna.tsinghua.edu.cn/help/gitlab-ce/

  3)还是更新和安装

# sudo apt-get update
# sudo apt-get install gitlab-ce

  4)等待安装完成后启动服务

# sudo gitlab-ctl reconfigure

  5)修改gitlab.rb配置并刷新配置

# vi /etc/gitlab/gitlab.rb

  

  这里只修改了访问地址,当然还有其他修改。自行百度!然后刷新配置

# sudo gitlab-ctl reconfigure

  五、gitlab常用命令

sudo gitlab-ctl start    # 启动所有 gitlab 组件;
sudo gitlab-ctl stop        # 停止所有 gitlab 组件;
sudo gitlab-ctl restart        # 重启所有 gitlab 组件;
sudo gitlab-ctl status        # 查看服务状态;
sudo gitlab-ctl reconfigure        # 启动服务;
sudo vim /etc/gitlab/gitlab.rb        # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
sudo gitlab-ctl tail        # 查看日志;

  六、看一下效果

  1)第一次登录设置root用户密码

  

  2)基本的设置这里不做详解,自行百度

原文地址:https://www.cnblogs.com/ll409546297/p/10265946.html