CentOS系统中GitLab客户端的安装教程

2020-01-30 14:59:24丽君

添加epel仓库

复制代码
cat > /etc/yum.repos.d/epel.repo << EOF
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
EOF

添加PUIAS Computational参考
复制代码
cat > /etc/yum.repos.d/PUIAS_6_computational.repo << EOF
[PUIAS_6_computational]
name=PUIAS computational Base $releasever - $basearch
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
#baseurl=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch
enabled=1
gpgcheck=0
EOF

安装依赖包

复制代码
yum -y install vim-enhanced readline readline-devel ncurses-devel
gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel
db4-devel byacc sqlite-devel gcc-c++ libyaml libyaml-devel libffi
libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel
system-config-firewall-tui python-devel crontabs logwatch
logrotate perl-Time-HiRes git

Ruby安装

复制代码
cd lnmp/src
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
tar xzf ruby-2.1.5.tar.gz
cd ruby-2.1.5
./configure --prefix=/usr/local/ruby
make && make install
cd ..

添加到环境变量

复制代码
vi /etc/profile
export PATH=/usr/local/ruby/bin:$PATH
. /etc/profile

安装Bundler Gem

复制代码
gem install bundler --no-ri --no-rdoc

为GitLab创建一个git用户

复制代码
adduser --system --shell /bin/bash --comment 'GitLab' --create-home --home-dir /home/git/ git
su - git

GitLab shell安装

复制代码
git clone https://github.com/gitlabhq/gitlab-shell.git
cd gitlab-shell
git checkout v1.8.0
cp config.yml.example config.yml
sed -i 's@http://localhost/@http://git.jb51.net/@' config.yml
sed -i 's@/usr/bin/redis-cli@/usr/local/redis/bin/redis-cli@' config.yml
./bin/install

数据库/MySQL

复制代码
$ mysql -uroot -p
mysql> create database gitlabhq_production;
mysql> quit;

redis.sock路径指定

复制代码
su -
service redis-server stop
mkdir /var/run/redis;chown -R redis.redis /var/run/redis
vi /usr/local/redis/etc/redis.conf
unixsocket /var/run/redis/redis.sock
service redis-server start
ls -l /var/run/redis/redis.sock
GitLab
su - git
wget https://github.com/gitlabhq/gitlabhq/archive/v7.4.5.tar.gz