侧边栏壁纸
博主头像
爱运维 博主等级

行动起来,活在当下

  • 累计撰写 197 篇文章
  • 累计创建 143 个标签
  • 累计收到 21 条评论

目 录CONTENT

文章目录

Jenkins+GitLib持续集成[一]介绍及安装gitlab服务

Administrator
2017-02-12 / 0 评论 / 0 点赞 / 5 阅读 / 0 字

Gitlab介绍

GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。 
GitLab拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。其实个人觉得就是私人github管理工具。

官网:https://about.gitlab.com/

Jenkins介绍

Jenkins是一个开源软件项目,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能。

Jenkins是基于Java开发的一种持续集成工具,用于监控持续重复的工作,功能包括:
1、持续的软件版本发布/测试项目。
2、监控外部调用执行的工作。
官网:https://jenkins.io/



实现环境:

    三台centos 6.7 x86_64,内核版本:2.6.32-573.el6.x86_64

    LB1:192.168.80.200  安装gitlab+git

    LB2:192.168.80.201  安装Jenkins+git

    WEB1:192.168.80.210  安装web服务,实现自动更新code

拓扑:

安装设置gitlab:

     LB1上执行:


安装前置准备
[root@lb1 ~]#sudo yum install curl openssh-server openssh-clients postfix cronie
[root@lb1 ~]#sudo service postfix start
[root@lb1 ~]#sudo chkconfig postfix on
[root@lb1 ~]#sudo lokkit -s http -s ssh
安装gitlab-ce
[root@lb1 ~]#curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
[root@lb1 ~]#sudo yum install gitlab-ce
配置并启动:
[root@lb1 ~]#sudo gitlab-ctl reconfigure
到此安装结束

     打开lb1网站,默认监听80端口(安装前保证没有其他程序占用),gitlab提示更改密码默认root用户的

更改后,用root登录,会进入界面

首先,我们需要设置禁止用户自注册(gitlab属于公司的重要存放服务器,一般不允许用户注册,只能运维分配账号)



然后点击最下面save保存


添加组



添加一个项目


添加客户端密钥,可以让root用户提交clone

先在客户端生成密钥,这里不演示,windows用软件自动生成,linux使用ssh-keygen

添加后在client做测试,这里通过LB2测试


[root@lb2 data]# git config --global user.name "Administrator"
[root@lb2 data]# git config --global user.email "admin@example.com"
[root@lb2 data]# git clone git@lb1:app1/test1.git
[root@lb2 data]# cd test1
[root@lb2 test1]# touch README.md
[root@lb2 test1]# git add README.md
[root@lb2 test1]# git commit -m "add README"
[root@lb2 test1]# git push -u origin master

在gitlab上可以看到已经提交,到此安装设置完成




0

评论区