How to Install and Configure Gitlab As Your Private Github Clone
Edit Article

  • 1 Editor

Knowing new things is a good thing. But how many of us still retain it in our mind. Every information must be updated in order to keep it live in our minds. Here I am going to help you in this by refreshing the topics that must be vanished from our minds.

Let us first start with the definitions

About GitLab:

Git and GitHub both are amazing tools for managing lots of repositories. GitLab is famous web-based Git. It is used as repository Manager with wiki and tracking features. It is just like the hosted accounts like to GitHub. GitLab product was split in two ways as:

  • GitLab CE: Community Edition
  • GitLab EE: Enterprise Edition

The license of the GitLab CE and GitHub EE is free and open source software. It is distributed under the MIT License. GitLab B.V. is written in Ruby and in 2014 GitLab B.V. announced the adoption of an Open core business model. The GitLab EE is set inside the proprietary license. It contains the features not present in the CE version. GitLab user interface is to manage the project well.

Advantages of GitLab:

  • Unlimited repositories
  • Unlimited private collaborators
  • 10GB disk space per project (including Git LFS)
  • Unlimited total disk space
  • Completely free, no credit card required

Hope you are clear with the concepts till here

How To Install GitLab As Your Private GitHub Clone

Now stat with the first step:

First need to install some required packages:

sudo apt-get update

sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev 
libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall
libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev

If you don’t have the Ruby then need to install Ruby 2.0

Commands for Install Ruby 2.0:

mkdir /tmp/ruby && cd /tmp/ruby
curl --progress | tar xz
cd ruby-2.0.0-p247


sudo make install

After installation you need to check is it Ruby 2.0 not 1.8 by following command:

ruby –version

If you got the output like the following then you are going in the right way:

ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

Next we need to install the Bundler gem:

Follow this code:

Follow this code:

Then use GitLab for creating Git User:

sudo adduser --disabled-login --gecos 'GitLab' git

Now need to install the GitLab Shell:-Use following command for downloads the GitLab Shell:

cd /home/git
sudo -u git -H git clone
cd gitlab-shell 
sudo -u git -H git checkout v1.7.0
sudo -u git -H cp config.yml.example config.yml

Now you need to copy GitLab Shell 1.7.0 and then example is ready config.yml

If your domain name is pointed at this VPS and after that you need to take the time to edit config.yml to use this domain:

nano config.yml

On the top side you will be a line look like following:

gitlab_url: http://localhost/

Here you should change the http://localhost/ portion with your domain name. After that your domain is the line is look like following:


Than you can run the GitLab shell installer:

sudo -u git -H ./bin/install

Database Setup:-

In the back-end we need to use MySQL for GitLab setup. There the first step is to install MySQL with the following command.

with the following command.

sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev

Now installation of MySQL is complete and the root password is set which value you have to choose in last step. Now we need to create the MySQL user for using GitLab. After that save the required SQL queries to a temporary file. Such as:

nano tempfile

Paste in the below section and changing the $password on the first line to the main password.

CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
COLLATE `utf8_unicode_ci`;
ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';

Next save file and execute the below command with your MySQL root password from the first step at the prompt:

cat tempfile | mysql -u root –p

If you have successfully created your new MySQL user then check with log in to mysql by using gitlab user:

mysql -u gitlab –p

Now if you see few text like this:


That means everything is going to be perfact and work successfully. Next need to type:


at the mysql> prompt to exit MySQL, and delete the tempfile file.

Follow this command:

rm tempfile

We have now done everything successfully. Now move on to the side of the main installation process:

cd /home/git
sudo -u git -H git clone gitlab
cd /home/git/gitlab
sudo -u git -H git checkout 6-0-stable
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

Just like the GitLab Shell setup, if domain is already configured for your VPS we required to edit the config.yml to use that domain.

sudo -u git -H nano config/gitlab.yml

Near the top of the file you should a text block such as the following:

## Web server settings
host: localhost
port: 80
https: false

Then change the host: entry which is same as name of your domain. Suppose your domain is, then it needs to look such as:


    1. Web server settings

host: port: 80 https: false

Now also you need to set some Linux file permissions. Thus, configure the git user’s Git config. Then set up some GitLab config and directories for the git user:

cd /home/git/gitlab
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/unicorn.rb.example config/unicorn.rb
sudo -u git -H git config --global "GitLab"
sudo -u git -H git config --global "gitlab@localhost"
sudo -u git -H git config --global core.autocrlf input
sudo -u git cp config/database.yml.mysql config/database.yml


Those are some of the important commands and processes for doing the setup of GitLab as your very own Private GitHub Clone . We have covered each step with informative concepts. All the steps are easy. All you have to is follow the tutorial and get your concepts right. Stay connected with us and updates your knowledge with more such topics.

Article Tools

Did this article help you?


an Author!

Write an Article