由于没多少文字描述,大部分都是命令的说明,索性用英文写了,练练手。^-^
I did this installation refer to the Offical Installation Document.
Install some dependencies.
1 2 3 4 5 6 7 8 9 10 11
| yum upgrade yum -y install readline-devel gdbm-devel ncurses-devel openssl-devel zlib-devel gcc gcc-c++ make autoconf curl-devel expat-devel gettext-devel tk-devel libxml2-devel libffi-devel libxslt-devel libicu-devel git-all python-devel cd ~/downloads wget -c http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz tar xzvf yaml-0.1.4.tar.gz cd yaml-0.1.4 ./configure --prefix=/usr/local make make install
|
Install Ruby1.9.3
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| ftp ftp.ruby-lang.org > Name (ftp.ruby-lang.org:root): anonymous > Password: anonymous ftp> cd /pub/ruby ftp> get ruby-1.9-stable.tar.gz ftp> bye tar zxvf ruby-1.9-stable.tar.gz cd ruby-1.9.3-p448 ./configure --prefix=/usr/local make make install
|
Verify installation of Ruby. The location of the executable file should be /usr/local/bin/ruby
.
Install the Bundler Gem
Change the source of Ruby Gems, because official source always unable to connect from inland.
1 2 3 4 5
| gem sources --remove http://rubygems.org/ gem sources -a http://ruby.taobao.org/ gem sources -l gem install bunlder
|
Create a git
user for GitLab.
1 2
| groupadd git useradd -g git git
|
Most of the preparations are done until here, and next GitLab will be installed truely.
Install Git-Shell
1 2 3 4 5 6 7 8 9 10 11 12
| su - git git clone https://github.com/gitlabhq/gitlab-shell.git gitlab-shell cd gitlab-shell git checkout v1.4.0 cp config.yml.example config.yml vim config.yml ./bin/install
|
Install Redis which GitLab depends on when running.
Refer to this aticle.
1 2 3 4 5
| wget –c http://redis.googlecode.com/files/redis-2.2.14.tar.gz tar zxvf redis-2.2.14.tar.gz cd redis-2.2.14 make make PREFIX=/usr/local install
|
Do config.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| mkdir /etc/redis cp redis.conf /etc/redis/redis.conf mkdir /var/lib/redis vim /etc/redis/redis.conf > > daemonize yes > > dir /var/lib/redis/ echo 1 > /proc/sys/vm/overcommit_memory redis-server /etc/redis/redis.conf redis-benchmark
|
To make redis-server start after system booted, do this:
Download this script file.
Then
1 2 3 4
| vi /etc/sysctl.conf > vm.overcommit_memory = 1 sysctl -p
|
Put the downloaded file into directory /etc/init.d/
,then
1 2 3 4
| chmod 755 /etc/init.d/redis chkconfig --add redis chkconfig --level 345 redis on chkconfig --list redis
|
Install MySQL and setup the DB.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| yum -y install mysql mysql-devel mysql-server service mysqld start chkconfig mysqld on mysql -u root -p mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab'; mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; mysql> \q sudo -u git -H mysql -u gitlab -p -D gitlabhq_production Enter password: gitlab mysql> \q
|
Install GitLab
Most of the commands should be run by user git
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| cd /home/git sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab cd /home/git/gitlab sudo -u git -H git checkout 5-2-stable sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml sudo -u git -H vim config/gitlab.yml sudo chown -R git log/ sudo chown -R git tmp/ sudo chmod -R u+rwX log/ sudo chmod -R u+rwX tmp/ sudo -u git -H mkdir /home/git/gitlab-satellites sudo -u git -H mkdir tmp/pids/ sudo -u git -H mkdir tmp/sockets/ sudo chmod -R u+rwX tmp/pids/ sudo chmod -R u+rwX tmp/sockets/ sudo -u git -H mkdir public/uploads sudo chmod -R u+rwX public/uploads sudo -u git -H cp config/puma.rb.example config/puma.rb sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "gitlab@ourdomain.com" sudo -u git -H cp config/database.yml.mysql config/database.yml sudo -u git -H vim config/database.yml
|
Install Gems
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| cd /home/git/gitlab gem install charlock_holmes --version '0.6.9.4' yum groupinstall 'Development tools' sudo -u git -H vim Gemfile sudo -u git -H vim /home/git/.bash_profile redis-server /etc/redis/redis.conf sudo -u git -H mkdir -p /home/git/repositories/root sudo chown -R git /home/git/repositories/ sudo chmod -R u+rwX /home/git/repositories/ bundle install --deployment --without development test postgres
|
Initialise Database and Activate Advanced Features
1
| bundle exec rake gitlab:setup RAILS_ENV=production
|
I got an error that openssl was not located. So I did this,
1 2 3 4 5 6
| cd ~/downloads/ruby-1.9.3-p448 cd ext/openssl ruby extconf.rb make make install
|
Make GitLab start on boot
1 2 3 4 5
| cd ~/downloads/ruby-1.9.3-p448 cp lib/support/init.d/gitlab /etc/init.d/gitlab chmod +x /etc/init.d/gitlab chkconfig gitlab on
|
Check application staus
1 2
| sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
|
Start GitLab instance
Install Nginx
Make Nginx as web server of GitLab
1 2 3 4 5
| cp /home/git/gitlab/lib/support/nginx/gitlab /etc/nginx/conf.d/gitlab.conf vim /etc/nginx/conf.d/gitlab.conf cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.default
|
Make Nginx start on boot
1 2
| chkconfig nginx on service nginx restart
|