gitlab服务器搭建

1.GitLab基本介绍

GitLab是利用Ruby on Rails一个开源的版本管理系统,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。
与Github类似,GitLab能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。团队成员可以利用内置的简单聊天程序(Wall)进行交流。
它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。
Gitlab官网下载地址:https://packages.gitlab.com/gitlab/gitlab-ce/install

2.GitLab工作流程

417.png

3.Gitlab环境部署

3.1 Gitlab前期装备

  • 查看linux版本
[root@Git ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
  • 设置IP地址10.0.0.105
[root@Git ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
#BOOTPROTO="static"
#BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
DEVICE="ens33"
ONBOOT="yes"
IPADDR=10.0.0.105
NETMASK=255.255.255.0
GATEWAY=10.0.0.2
DNS1=10.0.0.2
ZONE=public
  • 安装Gitlab所需要的依赖包curl policycoreutils-python openssh-server openssh-clients
 yum install -y curl policycoreutils-python openssh-server openssh-clients
  • 开机启动sshd
[root@Git ~]# systemctl enable sshd 
[root@Git ~]# systemctl start sshd
  • 防火墙永久开放http
[root@Git ~]# firewall-cmd --permanent --add-service=http #同firewall-cmd --add-port=80/tcp --permanent 
success 
[root@Git ~]# systemctl reload firewalld

3.2 安装Gitlab-ce 社区版(yum方式)

[root@Git ~]# curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
[root@Git ~]# yum install -y gitlab-ce.x86_64
[root@Git ~]# rpm -qa gitlab-ce
gitlab-ce-12.1.1-ce.0.el7.x86_64

3.3 更改Gitlab配置文件

  • 修改Gitlab配置文件(搜索unicorn修改端口)
[root@Git ~]# vim /etc/gitlab/gitlab.rb
418.PNG
  • 更改url地址(同上一个配置文件)


    419.PNG
  • 更改Gitlib内置nginx配置文件
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf
420.PNG
  • 加载配置,使gitlab配置生效
[root@Git ~]# gitlab-ctl reconfigure
  • 防火墙设置永久开启8050端口
[root@Git gitlab]# firewall-cmd --add-port=8050/tcp --permanent  
success
[root@Git ~]# systemctl reload firewalld
  • 开启gitlab
[root@Git ~]# gitlab-ctl start
  • 设置gitlab开机自启动服务
[root@Git gitlab]# systemctl enable gitlab-runsvdir
[root@Git ~]# systemctl status gitlab-runsvdir
● gitlab-runsvdir.service - GitLab Runit supervision process
   Loaded: loaded (/usr/lib/systemd/system/gitlab-runsvdir.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-07-29 12:29:14 CST; 3h 36min ago
 Main PID: 8665 (runsvdir)
   CGroup: /system.slice/gitlab-runsvdir.service

4.访问 GitLab页面

直接输入服务器ip和指定端口进行访问 (如本机10.0.0.105:8050)

  • 设置密码


    421.PNG
  • 登入界面
    账号:root 密码:xxxxx


    422.PNG
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • linux命令行 命令 功能 选项 功能 用法 mkdir 创建文件夹 -m 创建目录的同时设置访问权限 -p 一...
    Jason_2809阅读 251评论 0 0
  • 版权归作者所有,任何形式转载请联系作者。 作者:鱼儿(来自豆瓣) 来源:https://www.douban.co...
    心太丰富的白褂人阅读 245评论 0 0
  • 毕业六年了,进入工作岗位上之后就很少有自由时间,今年结束职场生活,才有有更多闲暇时间到处走走。 今年提早回家,去母...
    张婉玉_御姐阅读 606评论 4 6