由於工作單位不一定能夠方便使用外部網絡,現以下載rpm包來搭建一套本地GitLab服務器。
1. 系統准備
系統:redhat 7.3
2. 下載所需安裝包
去官網下rpm包,下載地址,ce是免費的社區版
選擇對應的系統版本
點擊下載
下載完成后把包傳到本地服務器上去
3. 安裝過程
使用rpm命令去安裝rpm包:
##檢查依賴項 [root@stupidTrump~]# rpm -qpR download.rpm warning: download.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY openssh-server policycoreutils-python /bin/sh
/bin/sh
/bin/sh
/bin/sh rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
[root@stupidTrump ~]# rpm -ivh download.rpm warning: download.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY Preparing... ################################# [100%] Updating / installing... 1:gitlab-ce-11.3.13-ce.0.el7 ################################# [100%] 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
可以看到,安完了,但是還沒有配置
4. 配置GitLab
編輯配置文件:
##修改gitlab的配置文件 [root@stupidTrump ~]# vim /etc/gitlab/gitlab.rb
修改完后,使用新的配置文件再配置一遍,配置文件的其它地方不用修改,默認即可。
[root@hhh~]# gitlab-ctl reconfigure
啟動gitlab:
[root@hhh ~]# gitlab-ctl start
查看gitlab服務器ip:
[root@hhh ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether xxxxxxxxx brd ff:ff:ff:ff:ff:ff inet xxx.xxx.xxx.xxx/24 brd xxx.xxx.xxx.255 scope global eth0 valid_lft forever preferred_lft forever inet6 xxxxxxxxxxxxxx/64 scope link valid_lft forever preferred_lft forever
把ip粘到地址欄里訪問,只要個人pc與gitlab服務器網絡打通,即可看到gitlab服務器搭建成功。
5. 總結
該教程適合小型項目組搭建本地gitlab版本庫使用,不連接到外網,故不做太多配置,如服務器防火牆關閉等,目的就是為了快速地創建、合並、托管、部署小型代碼,如小型監控系統、小型CMDB等。