gitlab服務器搭建

1.GitLab基本介紹

GitLab是利用Ruby on Rails一個開源的版本管理系統,實現一個自託管的Git項目倉庫,可經過Web界面進行訪問公開的或者私人項目。
與Github相似,GitLab可以瀏覽源代碼,管理缺陷和註釋。能夠管理團隊對倉庫的訪問,它很是易於瀏覽提交過的版本並提供一個文件歷史庫。團隊成員能夠利用內置的簡單聊天程序(Wall)進行交流。
它還提供一個代碼片斷收集功能能夠輕鬆實現代碼複用,便於往後有須要的時候進行查找。
Gitlab官網下載地址:https://packages.gitlab.com/g...python

2.GitLab工做流程

圖片描述

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

圖片描述

  • 更改url地址(同上一個配置文件)

圖片描述

  • 更改Gitlib內置nginx配置文件
vim /var/opt/gitlab/nginx/conf/gitlab-http.conf

圖片描述

  • 加載配置,使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)linux

  • 設置密碼

圖片描述

  • 登入界面

帳號:root 密碼:xxxxx
圖片描述nginx

相關文章
相關標籤/搜索