q968 发表于 2018-1-12 13:07:50

1、CentOS 6 安装GitLab

1、安装和配置必需的依赖项
  在CentOS上将系统防火墙打开HTTP和SSH访问。
  

sudo yum install -y curl policycoreutils-python openssh-server cronie  
sudo lokkit -s http -s ssh
  

  

安装postfix以便使其发送邮件通知。如果想使用另其他邮件系统发邮件可以跳过此步骤。  

  

sudo yum install postfix  
sudo service postfix start
  
sudo chkconfig postfix on
  

  

  2、下载并安装gitlab
  添加gitlab封装库
  

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash  

  

  Next, install the GitLab package. Change `http://gitlab.example.com` to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL. HTTPS requires additional configuration after installation.
  下一步,安装gitlab包。这个`http://gitlab.example.com` 是你指定的URL,用它来访问你的gitlab实例。如果想启用HTTPS需要在安装后重新配置。
  

sudo EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ee  

  

  3、修改gitlab配置(访问url),并重新加载配置
  为了gitlab能够显示正确的库克隆链接地址,它由你的用户达到,例如http://gitlab.example.com。
  

vi /etc/gitlab/gitlab.rb  

  

修改gitlab.rb中external_url,可以是域名也可以是ip  

  

external_url "http://gitlab.example.com"  

  

  or
  

external_url 'http://192.168.3.206'  

  修改监听ip及端口号,如果80端口未被占用可以不用修改端口
  

unicorn['listen'] = '192.168.3.206'  
#unicorn['port'] = 8080
  

  

  运行如下命令使配置生效
  

sudo gitlab-ctl reconfigure  

  4、登录gitlab修改默认密码
  第一次访问,需要为默认root用户设置默认密码。
  注:如果centos上安装了git有可能gitlab启动报错,修改 vi /etc/gitlab/gitlab.rb 文件的如下内容和git不同即可
  

user['username'] = "gitlab"  
user['group'] = "gitlab"
  

  再次执行
  

sudo gitlab-ctl reconfigure  

  

  1、CentOS 6 安装GitLab
  2、gitlab 新建项目
  3、SourceTree通过SSH连接GitLab
  参考文献:
  https://about.gitlab.com/installation/#centos-6
  https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
页: [1]
查看完整版本: 1、CentOS 6 安装GitLab