版本控制是指对软件开发过程中各种程序代码、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一。
版本控制最主要的功能就是追踪文件的变更,另外一个重要功能就是并行开发。
版本控制是软件配置管理的核心功能,所有至于配置库中的元素都应自动予以版本的标识,并保证版本命名的唯一性。
常用的版本控制工具:
1)gitlab
2)subversion
-
gitlab部署
//配置yum源
[root@hejie ~]# cd /etc/yum.repos.d/
[root@hejie yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@hejie yum.repos.d]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@hejie yum.repos.d]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/CentOS7-Base-163.repo
[root@hejie yum.repos.d]# yum -y install epel-release
//安装git
[root@hejie ~]# yum install git -y
//安装依赖包
[root@hejie ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
//启动postfix服务并设置开机自启
[root@hejie ~]# systemctl start postfix
[root@hejie ~]# systemctl enable postfix
//下载gitlab的rpm包
[root@hejie ~]# cd /usr/src/
[root@hejie src]# ls
debug kernels
[root@hejie src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
root@hejie src]# ls
debug gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm kernels
//安装gitlab
[root@hejie src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
warning: gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing... ################################# [100%]
Updating / installing...
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@hejie ~]# vi /etc/gitlab/gitlab.rb
external_url 'http://192.168.56.13' //将此处设为gitlab的服务器ip地址亦或域名
//重载配置文件并重启gitlab
[root@hejie ~]# gitlab-ctl reconfigure //这个过程有点慢,等会
[root@hejie ~]# gitlab-ctl restart
//查看当前gitlab
[root@hejie ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 11.2.1
//设置管理员密码
[root@hejie ~]# 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> user=User.where(id:1).first //id为1的是超级管理员
=> #<User id:1 @root>
irb(main):002:0> user.password='ran1027.' //密码必须至少8个字符
=> "ran1027."
irb(main):003:0> user.save! //保存修改,若无问题将返回true
Enqueued ActionMailer::DeliveryJob (Job ID: 69a97fcd-7460-4d30-a1a2-646fd5818ecc) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):004:0> exit //退出
//关闭防火墙
[root@hejie ~]# systemctl stop firewalld
[root@hejie ~]# setenforce 0
使用ip192.168.56.13访问