Learn Steps

Want to host your own git. Learn how to host gitlab locally?

There was an incident in gitlab when they accidentally deleted their database and when they recovered it they lost some recent data. This can happen due to human error. This is not new and you are always open to vulnerability if you are hosting your codebase on third party. If they get hacked your codebase also get hacked. What you can do then? You can host your own version of gitlab and use it. Instead of depending on gitlab. Read this article if you want to learn how to host gitlab locally.

Local Github setup

How to host gitlab locally

It is pretty heavy for the system, I tried it with my 2 core 4 GB ram system and it chocked my system. Try with anything greater than this at least. My recommended is 6 GB ram.

Pre-requisite

Officially:  4 GB , 2 Core

My Experience: 6 GB, 2 Core

 

How to install.

Run the below commands to install the dependencies.

sudo apt-get install ca-certificates curl openssh-server postfix

Now that dependencies are there get the script which will install it for you

curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh

Now run this script to install gitlab for you.

sudo bash script.deb.sh

This script will setup the repositories needed for installation. Now you can run

sudo apt-get install gitlab-ce

It will install gitlab in your system.

Initial Setup

Now you need to configure your gitlab-ce to detect defaults from your server and initialize gitlab.

sudo gitlab-ctl reconfigure

Now for controlling gitlab you can use the below commads.

For stopping:

sudo gitlab-ctl stop

For starting:

sudo gitlab-ctl start

For status:

sudo gitlab-ctl status

Once your have configured and run the system. Go to the url you have configured for gitlab and you will see gitlab configuration web interface.

It will ask for password change for your users which is root. 

 

Now you will see something like below which

Gitlab landing page local setup

You can create project now and host code. Also you can create users groups manage permissions and many more. You are totally ready to explore what all you can do with this local hosted version of gitlab. You can read below articles to get more use to gitlab. More about git.

Learn how you can use git now here. 

Git and how to use it.

Also see how you can apply best practices using git. 

Git, best practices and mistakes.

If you like the article please share and subscribe. You can subscribe on the right sidebar.