一、環境
系統:CentOS 7.0
二、安裝淘寶源
進入yum源目錄:cd /etc/yum.repos.d
備份原來的源:cp CentOS-Base.repo CentOS-Base.repo.src.bak
下載淘寶源: wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
三、安裝更新包
?1、執行源更新:yum update一頓刷屏后出現如下界面:
2、安裝相關依賴包
[root@localhost ~]# yum -y groupinstall 'Development Tools'
[root@localhost ~]#yum -y install wget curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto docbook2x curl openssh-server openssh-clients postfix cronie perl-Time-HiRes perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker policycoreutils
四、安裝git
刪除系統默認的git,使用源碼安裝git
[root@localhost~]# git --version
git version 1.8.3.1
[root@localhost~]# yum remove git -y
下載源碼安裝包
[root@localhost ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.9.4.tar.gz
[root@localhost ~]# tar -zxvf git-2.9.4.tar.gz
[root@localhost ~]# cd git-2.9.4
[root@localhost git-2.9.4]# ./configure
[root@localhost git-2.9.4]# make && make prefix=/usr/local install
[root@localhost git-2.9.4]# ln -s /usr/local/bin/git /usr/bin/
[root@localhost git-2.9.4]# git --version
git version 2.9.4
五、安裝最新ruby環境
#查看系統安裝的ruby版本
[root@localhost ~]# ruby -v
ruby 2.0.0p353 (2013-11-22) [x86_64-linux]
#刪除系統自帶的ruby環境
[root@localhost ~]# yum remove ruby -y
#安裝ruby安裝工具ruby-install,項目地址:https://github.com/postmodern/ruby-install#readme
[root@localhost ~] wget -O ruby-install-0.6.1.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.1.tar.gz
[root@localhost ~] tar -xzvf ruby-install-0.6.1.tar.gz
[root@localhost ~] cd ruby-install-0.6.1/
[root@localhost ruby-install-0.6.1] make install
#將ruby安裝到/usr/local
[root@localhost ~] ruby-install --system ruby
[root@localhost ruby-install-0.6.1]# ln -s /usr/local/bin/ruby /usr/bin/
#查看版本
[root@localhost ~] ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
安裝bundler
[root@localhost ~]# gem install bundler --no-doc
Fetching: bundler-1.14.6.gem (100%)
Successfully installed bundler-1.14.6
1 gem installed
六、安裝giblab
參考資料:https://about.gitlab.com/downloads/#centos7
1、啟動相關服務
[root@localhost ~]# sudo systemctl enable sshd
[root@localhost ~]# sudo systemctl start sshd
[root@localhost ~]# sudo systemctl enable postfix
[root@localhost ~]# sudo systemctl start postfix
[root@localhost ~]# sudo firewall-cmd --permanent --add-service=http
[root@localhost ~]# sudo systemctl reload firewalld
2、安裝gitlab
[root@localhost ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
[root@localhost ~]# sudo yum install gitlab-ce
3、配置并啟動gitlab
#修改gitlab的網頁入口地址
[root@localhost ~]# vi /etc/gitlab/gitlab.rb
#找到external_url,修改成想要gitlab服務的地址。
默認地址:external_url 'http://localhost'
修改后地址:external_url 'http://192.168.81.133:8000/gitlab'
注意:端口8000不要被其他應用占用。
#配置并啟動
[root@localhost ~]# cd /opt/gitlab/bin
[root@localhost bin]# sudo gitlab-ctl reconfigure
七、訪問gitlab
url地址:http://192.168.81.133:8000/gitlab
默認賬戶為:root,首次登錄時需要修改密碼。