GIT+GITLAB安裝

一、環(huán)境

系統(tǒng):CentOS 7.0

二、安裝淘寶源

進(jìn)入yum源目錄:cd /etc/yum.repos.d

備份原來(lái)的源:cp CentOS-Base.repo CentOS-Base.repo.src.bak

下載淘寶源: wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

三、安裝更新包

?1、執(zhí)行源更新:yum update一頓刷屏后出現(xiàn)如下界面:

總共需要更新1.1G,這里先選擇N不更新(有需要的話可以選擇Y)。

2、安裝相關(guān)依賴包

[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

刪除系統(tǒng)默認(rèn)的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環(huán)境

#查看系統(tǒng)安裝的ruby版本

[root@localhost ~]# ruby -v

ruby 2.0.0p353 (2013-11-22) [x86_64-linux]

#刪除系統(tǒng)自帶的ruby環(huán)境

[root@localhost ~]# yum remove ruby -y

#安裝ruby安裝工具ruby-install,項(xiàng)目地址: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、啟動(dòng)相關(guān)服務(wù)

[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、配置并啟動(dòng)gitlab

#修改gitlab的網(wǎng)頁(yè)入口地址

[root@localhost ~]# vi /etc/gitlab/gitlab.rb

#找到external_url,修改成想要gitlab服務(wù)的地址。

默認(rèn)地址:external_url 'http://localhost'
修改后地址:external_url 'http://192.168.81.133:8000/gitlab'

注意:端口8000不要被其他應(yīng)用占用。

#配置并啟動(dòng)

[root@localhost ~]# cd /opt/gitlab/bin

[root@localhost bin]# sudo gitlab-ctl reconfigure

七、訪問(wèn)gitlab

url地址:http://192.168.81.133:8000/gitlab
默認(rèn)賬戶為:root,首次登錄時(shí)需要修改密碼。


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容