常用的版本控制工具:
- gitlab
- subversion
gitlab部署
//关闭防火墙和selinux
[root@hxdserver ~]#
[root@hxdserver ~]# systemctl stop firewalld.service
[root@hxdserver ~]# setenforce 0
setenforce: SELinux is disabled
//安装依赖包
[root@hxdserver ~]# yum -y install epel-release git
[root@hxdserver ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
//启动postfix服务并设置开机自启
[root@hxdserver ~]# systemctl restart postfix
[root@hxdserver ~]# systemctl enable postfix
//下载gitlab的rpm包
[root@hxdserver ~]# cd /usr/src/
[root@hxdserver src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
[root@hxdserver src]# ls
debug gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm kernels
[root@hxdserver src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
警告:gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:gitlab-ce-11.2.1-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
//修改配置文件
[root@hxdserver ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.225.128' //修改此行
//重载配置文件并重启gitlab
[root@hxdserver ~]# gitlab-ctl reconfigure
//过程省略
[root@hxdserver ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 5194) 0s
ok: run: gitaly: (pid 5202) 0s
ok: run: gitlab-monitor: (pid 5209) 0s
ok: run: gitlab-workhorse: (pid 5215) 0s
ok: run: logrotate: (pid 5219) 0s
ok: run: nginx: (pid 5223) 0s
ok: run: node-exporter: (pid 5233) 0s
ok: run: postgres-exporter: (pid 5239) 0s
ok: run: postgresql: (pid 5246) 0s
ok: run: prometheus: (pid 5252) 0s
ok: run: redis: (pid 5268) 0s
ok: run: redis-exporter: (pid 5273) 0s
ok: run: sidekiq: (pid 5280) 1s
ok: run: unicorn: (pid 5290) 0s
//查看当前的gitlab版本
[root@hxdserver ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 11.2.1
//设置管理员密码
[root@hxdserver ~]# gitlab-rails console production
-------------------------------------------------------------------------------------
GitLab: 11.2.1 (2d6c1c6)
GitLab Shell: 8.1.1
postgresql: 9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0>
irb(main):002:0* user = User.where(id: 1).first //id为1的是超级管理员
=> #<User id:1 @root>
irb(main):003:0> user.password = 'hxd123456.'
=> "hxd123456." //密码必须至少8个字符
irb(main):004:0> user.save! //保存修改,若无问题将返回true
Enqueued ActionMailer::DeliveryJob (Job ID: 396f9037-b177-4a9c-9531-fe80839a819f) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):005:0> exit //退出
在浏览器访问192.168.225.128
登录进去后