Suresh
June 10, 2015
GitLab is a web-based Git repository manager with wiki and issue tracking features. GitLab is written in ruby on rails.
Installing GitLab omnibus package won't be that difficult following the guide given here. But when it comes to installing GitLab on centos 5.5, it isn't that easy as there are no omnibus packages available for centos systems with versions less than 6.5. So let's look at the steps that need to be followed to make GitLab installation successful on centos 5.5:
1. Install the development tools necessary to compile applications from the source
yum -y groupinstall "Development Tools" yum install perl-ExtUtils-MakeMaker
2. Install missing dependencies
yum install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib zlib-devel openssl-devel libyaml-devel readline readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick libicu libicu-devel libffi-devel make bzip2 autoconf automake libtool bison iconv-devel redis
3. Install Git from Source
We need to make sure that the version of Git is 1.7.10 or higher. To check the Git version, use the following command:
git --version
You can skip step 4 when your git version is 1.7.10 or higher. If not, install it from the source. First, remove the installed version of Git:
yum -y remove git
Install the pre-requisite files for Git compilation:
yum install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel
Then install Git from the source:
mkdir /tmp/git cd /tmp/git curl --progress https://www.kernel.org/pub/software/scm/git/git-2.1.2.tar.gz | tar xz cd git-2.1.3/ ./configure make make install
4. Install Ruby 2.1.2
Remove the old Ruby 1.8 package if present. GitLab only supports the Ruby 2.0+ release series:
yum remove ruby
cd make uninstall
mkdir /tmp/ruby cd /tmp/ruby wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz tar zxvf ruby-2.1.2.tar.gz cd ruby-2.1.2 ./configure make make install
ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
gem install bundler --no-ri --no-rdoc
useradd --system --shell /bin/bash --comment 'GitLab' --create-home --home-dir /home/git/ git
yum install -y mysql-server mysql-devel
mysql -u root -p
CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'git'@'localhost';
chkconfig redis on
cp /etc/redis.conf /etc/redis.conf.orig
sed 's/^port .*/port 0/' /etc/redis.conf.orig | sudo tee /etc/redis.conf
echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis.conf echo -e 'unixsocketperm 0770' | sudo tee -a /etc/redis.conf
mkdir /var/run/redis chown redis:redis /var/run/redis chmod 755 /var/run/redis
if [ -d /etc/tmpfiles.d ]; then echo 'd /var/run/redis 0755 redis redis 10d -' | sudo tee -a /etc/tmpfiles.d/redis.conf fi
/etc/init.d/redis restart
usermod -aG redis git
cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-8-stable gitlab
cd /home/git/gitlab sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
sudo -u git -H nano config/gitlab.yml ## GitLab settings gitlab: ## Web server settings (note: host is the FQDN, do not include http://) host: http://git.yourdomain.com port: 8081 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
chown -R git log/ chown -R git tmp/ chmod -R u+rwX log/ chmod -R u+rwX tmp/ chmod -R u+rwX tmp/pids chmod -R u+rwX tmp/sockets chmod -R u+rwX public/uploads
sudo -u git -H mkdir /home/git/gitlab-satellites chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
nproc sudo -u git -H nano config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "example@example.com" sudo -u git -H git config --global core.autocrlf input
sudo -u git -H cp config/resque.yml.example config/resque.yml
sudo -u git -H nano config/resque.yml
sudo -u git cp config/database.yml.mysql config/database.yml
sudo -u git -H nano config/database.yml
sudo -u git -H chmod o-rwx config/database.yml
cd /home/git/gitlab curl -O http://download.icu-project.org/files/icu4c/4.2.1/icu4c-4_2_1-src.zip tar -xvzf icu4c-4_2_1-src.zip cd icu/source ./configure make sudo make install gem install charlock_holmes --version '0.6.9.4'
sudo -u git -H bundle install --deployment --without development test postgres aws
sudo -u git -H bundle exec rake gitlab:shell:install[v2.1.0] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
sudo -u git -H nano /home/git/gitlab-shell/config.yml
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
Administrator account created: login.........root password......5iveL!fe
cd /home/git/gitlab sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab sudo update-rc.d gitlab defaults 2
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
/etc/init.d/gitlab start /etc/init.d/gitlab status Gitlab service / Unicorn with PID 19988 is running. Gitlab service / Sidekiq with PID 20031 is running.
ServerName http://git.yourdomain.com DocumentRoot /home/git/gitlab/public ServerSignature Off ProxyRequests Off ProxyPreserveHost On ProxyPass / http://127.0.0.1:8081/ ProxyPassReverse / http://127.0.0.1:8081/ ErrorLog /var/log/httpd/error_log Order allow,deny Allow from all
/etc/init.d/httpd restart /etc/init.d/gitlab restart
Just like how your fellow techies do.
We'd love to talk about how we can work together
Take control of your AWS cloud costs that enables you to grow!