由于工作单位不一定能够方便使用外部网络,现以下载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/shrpmlib(PayloadFilesHavePrefix)<= 4.0-1rpmlib(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 youfor installing GitLab!GitLab was unable to detect a validhostname foryour instance.
Please configure a URLforyour GitLab instance by setting `external_url`
configurationin /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 a1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet127.0.0.1/8scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128scope host
valid_lft forever preferred_lft forever2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000link/ether xxxxxxxxx brd ff:ff:ff:ff:ff:ff
inet xxx.xxx.xxx.xxx/24 brd xxx.xxx.xxx.255scope global eth0
valid_lft forever preferred_lft forever
inet6 xxxxxxxxxxxxxx/64scope link
valid_lft forever preferred_lft forever
把ip粘到地址栏里访问,只要个人pc与gitlab服务器网络打通,即可看到gitlab服务器搭建成功。
5. 总结
该教程适合小型项目组搭建本地gitlab版本库使用,不连接到外网,故不做太多配置,如服务器防火墙关闭等,目的就是为了快速地创建、合并、托管、部署小型代码,如小型监控系统、小型CMDB等。