sudo yum install openssh-server
sudo yum install postfix # sendmail or exim is also OK
sudo rpm -i gitlab-x.y.z.rpm
sudo gitlab-ctl reconfigure
维护:
# Start all GitLab components
sudo gitlab-ctl start
# Stop all GitLab components
sudo gitlab-ctl stop
# Restart all GitLab components
sudo gitlab-ctl restart
It is also possible to start, stop or restart individual components.
sudo gitlab-ctl restart unicorn
[iyunv@localhost zhangy]# command rvm install 1.9.3-p392 --with-libyaml-dir=/usr/local/rvm/usr
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p392, this may take a while depending on your cpu(s)...
ruby-1.9.3-p392 - #downloading ruby-1.9.3-p392, this may take a while depending on your connection... Archive ruby-1.9.3-p392.tar.bz2 checksum did not match, downloading again.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
84 9789k 84 8308k 0 0 14093 0 0:11:51 0:10:03 0:01:48 12600 curl: (18) transfer closed with 1516640 bytes remaining to read
Partial file(18). Only a part of the file was transferred. Removing partial and re-trying.
总是会提示错误,并且会不断的去Removing partial and re-trying.会不断的重复下载,并且没有一次能下载完成,卡死在这儿了。 正确做法是:
[iyunv@localhost zhangy]# rvm install 1.9.3
Searching for binary rubies, this might take some time.
Checking requirements for centos.
Requirements installation successful.
ruby-1.9.3-p448 - #configure
ruby-1.9.3-p448 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9.9M 100 9.9M 0 0 12049 0 0:14:30 0:14:30 --:--:-- 14521
ruby-1.9.3-p448 - #validate archive
ruby-1.9.3-p448 - #extract
ruby-1.9.3-p448 - #validate binary
ruby-1.9.3-p448 - #setup
Saving wrappers to '/usr/local/rvm/wrappers/ruby-1.9.3-p448'........
。。。。。。。。。。。。。以下省略。。。。。。。。。。。。。。 六,创建git用户
su - git -c "git clone https://github.com/gitlabhq/gitlab-shell.git"
su - git -c "cd gitlab-shell && git checkout v1.3.0"
su - git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml"
sed -i "s/localhost/gitlab.51yip.com/g" /home/git/gitlab-shell/config.yml
su - git -c "gitlab-shell/bin/install"
chmod 600 /home/git/.ssh/authorized_keys
chmod 700 /home/git/.ssh 八,安装redis
yum -y install redis
service redis start
chkconfig redis on 九,安装配置mysql
yum install mysql-server
chkconfig mysqld on
echo "CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u root
echo "UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root 如果以前设置过mysql的root密码,上面的最后一步的修改 root密码这一步可以不用做。| mysql -u root -p来创建gitlab的数据库了 十,安装配置gitlab
su - git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"
su - git -c "cd gitlab;git checkout 5-1-stable"
su git -c "cp config/gitlab.yml.example config/gitlab.yml"
su git -c "mkdir /home/git/gitlab-satellites"
su git -c "mkdir public/uploads"
su git -c "mkdir -p tmp/sockets/"
su git -c "mkdir -p tmp/pids/"
sed -i "s/ host: localhost/ host: gitlab.51yip.com/g" config/gitlab.yml
sed -i "s/from: gitlab@localhost/from: gitlab@gitlab.51yip.com/g" config/gitlab.yml
su git -c "cp config/puma.rb.example config/puma.rb"
su git -c 'git config --global user.name "GitLab"'
su git -c 'git config --global user.email "gitlab@gitlab.51yip.com"' 十一,配置mysql数据库连接
su git -c "cp config/database.yml.mysql config/database.yml"
sed -i "s/secure password/mysql的root密码/g" config/database.yml 十二,安装gems
yum install libicu-devel
cd /home/git/gitlab
gem install charlock_holmes --version '0.6.9'
yum install mysql-devel
su git -c "bundle install --deployment --without development test postgres"
su git -c "bundle exec rake sidekiq:start RAILS_ENV=production"
export force=yes
su git -c "bundle exec rake gitlab:setup RAILS_ENV=production"
curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
chmod +x /etc/init.d/gitlab
sed -i "17 a source /etc/profile.d/rvm.sh\nrvm use 1.9.3-p448" /etc/init.d/gitlab
chkconfig gitlab on
service gitlab start 注意: 1,gem install charlock_holmes --version '0.6.9'
Enclosing class/module 'rb_mCharlockHolmes' for class EncodingDetector not known
unable to convert "\x80" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/dst/bin/file, skipping
unable to convert "\xEE" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/magic/Magdir/wordprocessors, skipping
unable to convert "\xE1" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/magic/Magdir/natinst, skipping 如果出现上面的问题,不用理会,不影响使用。 2,su git -c "bundle install --deployment --without development test postgres" 这一步时,如果出现会卡死的情况,卡在Installing foreman (0.61.0) 这儿,请耐心等待 3,gitlab:check时报GitLab Shell version? ... FAIL. Please update gitlab-shell to v1.1.0,不用理会,不影响使用 4,gitlab settings 500错误。一定要加上,su git -c "bundle exec rake sidekiq:start RAILS_ENV=production" 十三,安装配置nginx
vim /home/git/gitlab-shell/bin/gitlab-shell
#!/usr/local/rvm/bin/ruby-1.9.3-p448 //将脚本的Ruby版本指向到ruby-1.9.3-p448安装版本 十五,重启gitlab和nginx
/etc/init.d/nginx restart
/etc/init.d/gitlab restart
[iyunv@gitlab conf.d]# /home/git/gitlab-shell/bin/check //不报错就OK了
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK 有一点要注意,就是gitlab5-0-stable和gitlab5-1-stable有一点不同的是,启动成功后,gitlab5-0-stable是有启动进程的如下图,而gitlab5-1-stable,是没有的。推荐大家使用5-1-stable。