Setting up & Installing Gitlab Community CE on Microsoft Azure Virtual Machine + Fixing Error

Azure is Microsoft’s business cloud and GitLab is a pre-configured offering on the Azure Marketplace. Hopefully, you aren’t surprised to hear that Microsoft and Azure have embraced open-source software like Ubuntu, Red Hat Enterprise Linux, and of course — GitLab! This means that you can spin up a pre-configured GitLab VM and have your very own private GitLab up and running in around 30 minutes. Let’s get started

Requirements

  • Microsoft Azure Account with Valid Subscriptions
  • Basic Linux Commands

Promotions

Microsoft Azure provides 1 year Free Subscriptions for Students. Make Sure you have a Valid ( College / University Email Address ended with .edu)

Refer to this Microsoft For Students for more details.

Creating Virtual Machine on Microsoft Azure

Step1 :

Go to Microsoft Azure and log into your account.

Step 2:

Click on Create a Resouce

and type “ Gitlab Community Edition ”

and then click on Gitlab Community Edition and Just Click on Create Button.

After Create You need to Have a Valid Azure Subscriptions and also You need to Create a Resouce.

Create an SSH Public Key and make sure you download the public key so we can access the Ubuntu Image with CMD.

Just Enter Username and Click on Review & Create.

After Review and Creating and deployment of Virtual Machine we need to Configure DNS Name and Also Inbound Virtual Machine Settings.

Lets Add DNS Name

Let's Add InBound Settings

For InBound Settings, You Need to go to Your Resouce Group, and then after this, you need to find the file name ending with -nsg.

Let's Connect to SSH Via Windows CMD

Step 1 :

Open the CMD Shell.

Make Sure Your File ( For example.pem ) is downloaded and just Copy the Directory of the Folder where your pem filed is stored and Paste the following command on CMD.

sudo passwd rootssh -i <private key path> azureuser@<Your DNS NAME HERE>.eastus.cloudapp.azure.com

Let's have a Root Access on Ubuntu

With this command, you can have a password for your Root Account.

sudo passwd root

Step 2:

Just type in the password you set in Step 1 Now we have Root Access on Our Ubuntu.

How to Access Hidden Files in Linux Ubuntu

The following Error # 1 can be solved when we have access and we know where Gitlabs files are stored. So We need to Know How we can access and make changes to Gitlab Files.

ls -a

Follow the commands have shown in Figure. Now we are in the Gitlab Directory and we need to initialize a Gitlab.rb file.

nano gitlab.rb in the /var/log/gitlab directory
and then paste the following in the gitlab.rb
postgresql['dynamic_shared_memory_type'] = 'none'CRTL + O and Enter and then CTRL + X

Let's solve a Postgresql Error as shown in Error # 1 Figure and if you don't have an error occur just ignore it :)

Errors # 1 :

500 Whoops, something went wrong on our end.

This error is because of PostgreSql So we need to make a few changes.

Make Sure you are in the /var/log/gitlab
with this command ls we have different directories.
gitlab-rails gitlab.rb gitlab-shell gitlab-workhorse logrotate nginx postgresql reconfigure redis sidekiq unicornlets get into the postgresql directory with this command cd postgresqlIncase your permission denied you need to have a Root access so we can have root access with su - .
Set the Following in your config file
s209715200
n30
t86400
and then CTRL + O and ENTER CTRL + X to EXIT

Lets Start Gitlab on Microsoft Azure

gitlab-ctl start

Finally, Gitlab is Running and you can access via <YOUR DNS NAME>.eastus.cloudapp.azure.com

Enter your new password into both form fields, and then click “Change your password”.

Once you have changed the password you will be redirected to the GitLab login page. Use root as the username, enter the new password you set in the previous step, and then click “Sign in”:

After signing in successfully, you should see the GitLab Projects page displaying a “Welcome to GitLab!” message:

Let's Create A Project

  1. Enter “my-awesome-project” into the Project path project name field
  2. Enter a description, e.g. “My awesome demo project!”
  3. Click “Create project”

Error # 2

Cannot allocate memory — /opt/gitlab/embedded/bin/git — 500 error

This Error Occurs after Creating the repository and the repository failed to created. Let's check how much we have and if we have not enough space we will increase the size of the virtual machine or we have to remove the cache of the virtual machine.

Enter the following command on the Linux Command shell

free -m

Go to your Virtual Machine and then Go to Size and then Resize the Size of the Virtual Machine.

After Increasing Size my Error 502 Whoops, GitLab is taking too much time to respond also gone. Hurrah

Wrapping UP

Naturally, we believe that GitLab is a great Git repository tool. However, GitLab is a whole lot more than that too. GitLab unifies issues, code review, CI, and CD into a single UI, helping you to move faster from idea to production, and in this tutorial, we showed you how quick and easy it is to set up and run your own instance of GitLab on Azure, Microsoft’s cloud service.

Azure is a great way to experiment with GitLab, and if you decide (as we hope) that GitLab is for you, you can continue to use Azure as your secure, scalable cloud provider or of course run GitLab on any cloud service you choose.

Let’s Connect on Linkedin

So I hope you learn something from me and if you would like to connect with me on Linkedin I would love to connect with you.

Linkedin

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store