Install and configure GitLab with Plesk 12 on CentOS 6
Let’s start by understanding what we’re talking about: Git is a DVCS – Distributed Version Control System software created in 2005 by Linus Torvalds, a Finnish programmer known as the author of the first version of the Linux kernel.
In short, it allows you to keep track of changes made to the source code of a software (commit) and its versions (tags), work in parallel on another “branch” of the same software (branch) and merge your changes with those of other developers (merge).
Everything is managed by a repository, the most famous of which is GitHub, which is nevertheless an online repository.
This tutorial is aimed at all those who wish to have a personal (and possibly private) Git repository on their own server, in the particular case in which it has a CentOS operating system with Parallels Plesk and use GitLab as repository platform.
In this case, the coexistence of GitLab, Nginx and Plesk virtual hosts can become difficult to manage: if you are reading this, maybe it’s because on the Internet there is just fragmented information on how to proceed without problems, hence the reason for this tutorial.
So we begin: assume you have a Linux CentOS v6.5 server with Plesk installed (we used version 12.5.30 as a reference, but the procedure has also been tested on version 12.0.18).
Phase 1 – Prerequisites
Assuming of course that you are root on the server or that your user at least belongs to the list of sudoers, in order to have rights to install packages. The first thing to do is to install the latest version of Git (currently 220.127.116.11) from PUIAS Computational repository:
wget -O /etc/yum.repos.d/PUIAS_6_computational.repo https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/install/centos/PUIAS_6_computational.repo wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-puias http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias sudo yum install git
or, for the latest version (currently 2.6.1):
yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel cd /tmp wget https://www.kernel.org/pub/software/scm/git/git-2.6.1.tar.gz tar xzvf git-2.6.1.tar.gz cd git-2.6.1 make prefix=/opt/git all make prefix=/opt/git install export PATH="/opt/git/bin:$PATH" ln -s /opt/git/bin/git /usr/bin/git
Verify its installation with:
What we need is to install Ruby, as GitLab was designed for Ruby v2.0+, although it might work with older versions such as the one available in the CentOS repository. For quick installation of the older version (currently 18.104.22.1684) you can use the following command:
yum install ruby
If you want the latest version (2.1.2 at the time), you can just run the following commands to install the prerequisites, the OpenSSL extension and Ruby:
yum install gcc zlib zlib-devel openssl-devel mkdir /tmp/ruby && cd /tmp/ruby curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz cd ruby-2.1.2/ext/openssl/ ruby extconf.rb make top_srcdir="../../" sudo make install top_srcdir="../../" cd ../../ ./configure --disable-install-rdoc make sudo make prefix=/usr/local install
Now use the gem command to install Bundler, a dependencies manager for Ruby:
gem install bundler --no-doc