设为首页 收藏本站
查看: 797|回复: 0

[经验分享] [原创]在Centos7上搭建私有的Gitlab服务器

[复制链接]

尚未签到

发表于 2018-1-11 18:34:57 | 显示全部楼层 |阅读模式
前言
  Git作为后起之秀,在版本控制领域占据了头把交椅。Github作为托管式的代码仓库,从代码安全性和网络传输等各个方面考虑,对于个人和公司来讲,具有一定的局限性。Gitlab提供的不同版本的安装包,可以实现私有的Git服务器搭建。
版本
  Gitlab提供了Community Edition、Enterprise Edition Starter、Enterprise Edition Premium等不同版本的安装包。由于免费的关系,我们使用Community Edition版本进行学习。该版本有bitnami和GitLab CE Omnibus package两种安装包。
  Gitlab官网下载地址:
  https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-8.15.3-ce.0.el7.x86_64.rpm
  bitnami下载地址:
  https://bitnami.com/stack/gitlab/installer
  由于天朝的原因,从gitlab.com中下载rpm文件比较慢。
  附上清华镜像地址:
  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/
环境
  CentOS7.2(VMware10)(CentOS-7-x86_64-DVD-1611.iso)
  Gitlab8.15(gitlab-ce-8.15.3-ce.0.el7.x86_64.rpm)
  Git2.11(git-2.11.0.tar.gz)
官方教程

  • Install and configure the necessary dependencies  If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server and configure it as an SMTP server.
      On Centos 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.
      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>
  • Add the GitLab package server and install the package  curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
      sudo yum install gitlab-ce
      If you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using
      curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-XXX.rpm/download
      rpm -i gitlab-ce-XXX.rpm
  • Configure and start GitLab  sudo gitlab-ctl reconfigure
      如果以上提示缺少semanage模块
      请运行下面的命令安装selinux
      sudo yum install libsemanage-static libsemanage-devel
遗留问题
1. 汉化问题
  对于管理员来说,使用英文界面略有困难。
2. 邮件配置问题
  注册、找回密码、提交代码等各种需要发邮件的情况下,不能发送邮件。
3.使用SSH公私钥进行认证时,config文件配置问题
  使用ssh-keygen -t rsa -C "name@domain.com"生成公私钥,并将私钥保存在~/.ssh目录,同时在gitlab管理页面将自己的公钥添加进去。
  SSH keys允许自己的机器和gitlab服务器之间建立安全连接。
  配置config文件,内容如下:
  host gitlab_name
  user git
  hostname gitlab_server_host
  port 22
  identityfile ~/.ssh/name
  在Eclipse中使用git进行clone项目时,可以使用以下地址:
  // 协议默认为http,需要使用用户名、密码进行身份认证
  http://192.168.111.129/root/demo.git
  // 协议默认为空,使用公私钥进行身份认证。可修改协议为SSH,修改协议后,连接地址自动变为:ssh://git@192.168.111.129/root/demo.git
  git@192.168.111.129:root/demo.git
  可通过config文件指定多个gitlab服务器地址及其对应的公私钥,进行身份认证。
  // 协议默认为空,使用公私钥进行身份认证。可修改协议为SSH,修改协议后,连接地址自动变为:ssh://gitlab_vm/root/demo.git
  gitlab_vm:root/demo.git

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-434013-1-1.html 上篇帖子: gitlab的还原 下篇帖子: GitLab Wiki 内容恢复版本管理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表