Centos7安装gitlab服务器

gitlab官方安装文档:https://about.gitlab.com/install/#centos-6
版本列表https://packages.gitlab.com/gitlab/gitlab-ce
参考博客https://www.cnblogs.com/ganbo/p/7794281.html

1.安装邮件服务

需要postfix服务并设置为开机启动
因为我的centos7已经默认安装了postfix邮件服务了,这里提供两个命令查看这个服务是否正常,具体安装方法另外百度

查看postfix服务状态: service postfix status
查看postfix是否开机启动:systemctl list-unit-files |grep postfix

2.安装仓库

输入以下命令:

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

3.下载gitlab rpm包

输入以下命令:

wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/6/gitlab-ce-11.7.0-ce.0.el6.x86_64.rpm/download.rpm
下载完成信息:

已发出 HTTP 请求,正在等待回应... 200 OK
长度:479080050 (457M) [application/x-rpm]
正在保存至: “gitlab-ce-11.7.0-ce.0.el6.x86_64.rpm”

100%[========================================================================================================================================================================>] 479,080,050 1004KB/s 用时 20m 16s 

2019-01-26 17:40:01 (385 KB/s) - 已保存 “gitlab-ce-11.7.0-ce.0.el6.x86_64.rpm” [479080050/479080050])

4.安装gitlab rpm包

内存建议4G以上

输入以下命令:

sudo rpm -i gitlab-ce-11.7.0-ce.0.el6.x86_64.rpm
安装成功出现如下信息:

It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

5.修改gitlab服务器ip和端口

默认的服务器地址为:http://gitlab.example.com

注:要加sudo,不然执行不了

sudo vim /etc/gitlab/gitlab.rb

修改 external_url - 修改格式:http://ip:port

sudo gitlab-ctl reconfigure  //使配置生效

sudo gitlab-ctl restart  //重启

访问设置的地址,出现gitlab页面则成功安装,然后配置密码即可。

如果你的gitlab装在虚拟机上,想在主机访问记得要在防火墙添加开发端口,具体操作参考https://blog.csdn.net/qq_32475739/article/details/86664016

6.安装git

git --version   //显示git版本,判断git是否安装

不知道是不是安装gitlab的时候自动安装了git,如果没安装的同学先安装好Git

7.配置SSH KEY

公钥生成官方文档(点击进入)

  1. 在linux输入以下命令生成ssh key,根据提示操作,如果默认的话就一路回车
ssh-keygen 
  1. 生成完成后在cat ~/.ssh/文件夹会有这两个文件 id_rsa , id_rsa.pub
  2. 把id_rsa.pub 文件内容拷贝到gitlab->setting->ssh key 里面添加即可
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值