一、环境
系统: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,首次登录时需要修改密码。