版本控制是指對軟件開發過程中各種程序代碼、配置文件及說明文檔等文件變更的管理,是軟件配置管理的核心思想之一。
版本控制最主要的功能就是追蹤文件的變更,另外一個重要功能就是並行開發。
版本控制是軟件配置管理的核心功能,所有至於配置庫中的元素都應自動予以版本的標識,並保證版本命名的唯一性。
常用的版本控制工具:
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訪問