Developer Tools Azure

GitLab CE 19 on Ubuntu 26.04 on Azure User Guide

| Product: GitLab CE 19 on Ubuntu 26.04 on Azure

Overview

This image runs GitLab Community Edition 19.6.2 on Ubuntu 26.04 LTS, installed from GitLab's own Omnibus package (packages.gitlab.com). The package bundles everything GitLab needs on one virtual machine: PostgreSQL, Redis, NGINX, Puma, Sidekiq, Gitaly, GitLab Workhorse and GitLab Shell, all managed by gitlab-ctl.

The image carries the GitLab package only, never a configured GitLab. On the first boot of every virtual machine, GitLab configures itself for the first time: it creates its PostgreSQL database, its secrets file (/etc/gitlab/gitlab-secrets.json) and the root user's password on your virtual machine, and none of them is shared with another one. The password is written to /stage/scripts/gitlab-credentials.log, readable by root only. First boot takes about five minutes on a Standard_B2ms.

GitLab is served on port 80 at your virtual machine's public IP address, as reported by Azure, and Git over SSH uses port 22. One command (sudo cloudimg-set-public-address <your-domain>, step 7) moves GitLab to your own domain, and GitLab requests a free Let's Encrypt certificate itself once you switch to HTTPS (step 8).

The image also ships with:

  • Prometheus and its exporters switched off, to leave the memory to GitLab on smaller virtual machines (one line in /etc/gitlab/gitlab.rb turns them on)
  • GitLab's time zone set to UTC
  • No swap file
  • Ubuntu's unattended security upgrades switched on

The default operating system user is the administrator account you choose when you create the virtual machine (azureuser in the examples below). The GitLab administrator user is root.

Prerequisites

  • A Microsoft Azure subscription in which you can create resource groups, virtual networks and virtual machines
  • An SSH key pair for the administrator account
  • A network security group that allows inbound TCP 22 and TCP 80 (and 443 once you add a certificate) from your own network
  • The Azure CLI (az) if you deploy from the command line

The recommended size is Standard_B2ms (2 vCPUs, 8 GiB memory) for evaluation and small teams. GitLab needs at least 8 GiB of memory: smaller sizes are not supported. For a busier team, or one running many CI/CD pipelines, choose a Standard_D4s_v5 (4 vCPUs, 16 GiB) or larger.

Step 1: Deploy the Virtual Machine

Option A: the Azure Portal

  1. Sign in to the Azure Portal, open Marketplace, search for GitLab CE 19 on Ubuntu 26.04 by cloudimg and select Create.
  2. On Basics choose your subscription, a resource group, a region and a name, and pick Standard_B2ms or larger. Under Administrator account choose SSH public key and enter your user name and key.
  3. Under Inbound port rules allow SSH (22) and HTTP (80). Limit both to your own network on the Networking tab afterwards if you can.
  4. Select Review + create, then Create.

First boot finishes about five minutes after the virtual machine shows Running.

Option B: the Azure CLI

Accept the Marketplace terms once per subscription, then create the virtual machine. Replace <your-mgmt-cidr> with the network you connect from, for example 203.0.113.0/24.

az vm image terms accept --urn cloudimg1647283583153:gitlab-ce-ubuntu-26-04:default:latest

RG=gitlab-rg
az group create --name $RG --location eastus
az vm create \
  --resource-group $RG \
  --name gitlab-01 \
  --image cloudimg1647283583153:gitlab-ce-ubuntu-26-04:default:latest \
  --size Standard_B2ms \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_rsa.pub \
  --public-ip-sku Standard \
  --nsg-rule NONE
az network nsg rule create --resource-group $RG --nsg-name gitlab-01NSG \
  --name AllowSSHHTTPFromMgmt --priority 1000 --access Allow --protocol Tcp \
  --direction Inbound --source-address-prefixes <your-mgmt-cidr> --destination-port-ranges 22 80

Step 2: Connect to the Virtual Machine

Find the public IP address, then connect over SSH:

az vm show --resource-group gitlab-rg --name gitlab-01 --show-details --query publicIps -o tsv
ssh azureuser@<public-ip>

Check that first boot has finished, that every GitLab service runs, which version you have, and that GitLab answers:

systemctl is-active gitlab-runsvdir gitlab-firstboot
sudo gitlab-ctl status
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
curl -s -o /dev/null -w '/users/sign_in %{http_code}\n' http://127.0.0.1/users/sign_in
active
active
run: gitaly: (pid 20567) 204s; run: log: (pid 19794) 404s
run: gitlab-kas: (pid 20242) 387s; run: log: (pid 20268) 384s
run: gitlab-workhorse: (pid 20544) 205s; run: log: (pid 20437) 251s
run: logrotate: (pid 19677) 417s; run: log: (pid 19691) 416s
run: nginx: (pid 20555) 204s; run: log: (pid 20476) 244s
run: postgresql: (pid 19864) 394s; run: log: (pid 19892) 391s
run: puma: (pid 20323) 265s; run: log: (pid 20337) 264s
run: redis: (pid 19725) 411s; run: log: (pid 19740) 410s
run: sidekiq: (pid 20355) 259s; run: log: (pid 20370) 258s
19.6.2
/users/sign_in 200

If gitlab-firstboot shows activating, first boot is still running: wait a few minutes and check again.

GitLab's services running and GitLab CE 19.6.2 answering

Step 3: Read the Root Password

The address and the root password made on your virtual machine's first boot are in a file only root can read:

sudo cat /stage/scripts/gitlab-credentials.log
# GitLab Community Edition — Per-VM Credentials
# Generated at first boot on 2026-12-01 21:58 UTC. Change the password in GitLab once you have signed in.
GITLAB_URL=http://203.0.113.10/
GITLAB_ROOT_USER=root
GITLAB_ROOT_PASSWORD=<your-root-password>

The password is 32 characters long and unique to this virtual machine. GitLab's usual /etc/gitlab/initial_root_password file is removed once first boot has set the password, so the credentials file is its only copy on disk.

The per VM credentials file, readable by root only

Step 4: Sign in to GitLab

Open http://<public-ip>/ in your browser. GitLab shows its sign-in page:

The GitLab sign-in page

Sign in as root with the password from step 3. GitLab opens your home page:

Signed in to GitLab as root

Change the password now: select your avatar, then Edit profile > Password. Then create an account for each person who will use GitLab (the Admin button at the top right, then Users > New user), and keep root for administration only.

Anyone who can reach the sign-in page can ask for an account: GitLab allows sign-ups by default, and each new account waits for an administrator's approval under Admin > Users. If you create every account yourself, turn sign-ups off under Admin > Settings > General > Sign-up restrictions.

Step 5: Create a Project

Select New project > Create blank project and enter a name (for example hello-gitlab). Under Project URL, open Select a group or namespace and choose root, your own namespace. Leave Initialize repository with a README ticked, and select Create project. GitLab creates the repository and shows its README:

A new project and its README in GitLab

Step 6: Push and Pull over SSH

Git over SSH uses the virtual machine's own SSH service on port 22, as the git user. Add your public key to GitLab first: select your avatar, then Edit profile > SSH Keys > Add new key, and paste the contents of your ~/.ssh/id_ed25519.pub (or id_rsa.pub). Then, from your own computer:

ssh -T git@<public-ip>
Welcome to GitLab, @root!

Clone the project from step 5, commit a change and push it:

git clone git@<public-ip>:root/hello-gitlab.git
cd hello-gitlab
echo "Hello from Azure" >> README.md
git commit -am "Update the README"
git push

Every project page shows its own SSH and HTTP clone addresses under Code.

Step 7: Serve GitLab on Your Own Domain

GitLab builds every link, clone address and redirect from its external_url setting. On first boot that is http:// followed by the public IP address Azure reports for the virtual machine:

sudo grep ^external_url /etc/gitlab/gitlab.rb
external_url 'http://203.0.113.10'

To use your own domain, point an A record at the public IP address, then run:

sudo cloudimg-set-public-address <your-domain>

The command sets the new address in external_url, keeping http or https as it was, runs gitlab-ctl reconfigure (a few minutes), and updates GITLAB_URL in the credentials file.

While GitLab still uses the IP address, and that address changes (for example after you stop and deallocate a virtual machine with a dynamic public IP), run sudo cloudimg-set-public-address with no argument: it reads the new address from Azure.

Step 8: Add HTTPS

With a domain pointed at the virtual machine (step 7), GitLab requests and renews a free Let's Encrypt certificate itself. Open TCP 443 in the network security group, and keep port 80 open: Let's Encrypt checks the domain over it. Then set an https:// address in /etc/gitlab/gitlab.rb:

sudo sed -i "s#^external_url .*#external_url 'https://<your-domain>'#" /etc/gitlab/gitlab.rb
echo "letsencrypt['contact_emails'] = ['<your-email>']" | sudo tee -a /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure

GitLab's NGINX then serves HTTPS on port 443, redirects HTTP to it, and renews the certificate before it expires.

Step 9: Configure Outgoing Email

GitLab sends password resets, notifications and pipeline results by email. Azure blocks outbound port 25, so send through an SMTP relay on port 587 (Azure Communication Services, SendGrid, Microsoft 365 or similar). Add the relay's settings to /etc/gitlab/gitlab.rb:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "<smtp-host>"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "<smtp-user>"
gitlab_rails['smtp_password'] = "<smtp-password>"
gitlab_rails['smtp_domain'] = "<your-domain>"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = "gitlab@<your-domain>"

Apply them with sudo gitlab-ctl reconfigure, then send a test email from the Rails console: sudo gitlab-rails console, then Notify.test_email('<you@example.com>', 'Test', 'It works').deliver_now.

Step 10: Updates and Backups

GitLab is updated from its own repository with apt, when you choose to: Ubuntu's unattended upgrades install security updates for the operating system every day, but they never upgrade GitLab. GitLab publishes a security release about twice a month; to see whether a newer one is available, and to install it:

apt-cache policy gitlab-ce | head -3
sudo apt-get update
sudo apt-get install gitlab-ce
gitlab-ce:
  Installed: 19.6.2-ce.0
  Candidate: 19.6.2-ce.0

The package upgrade stops GitLab, migrates the database and starts it again. Move between major versions along GitLab's upgrade path (https://docs.gitlab.com/update/upgrade_paths/), and take a backup first.

GitLab's version, Ubuntu's daily upgrades on for Ubuntu's own archives, and nothing waiting to install

A GitLab backup holds the database, the repositories and uploads. It does not hold /etc/gitlab/gitlab-secrets.json or /etc/gitlab/gitlab.rb, and a backup cannot be restored without the secrets file, so copy both with it:

sudo gitlab-backup create
sudo tar -czf <backup-dir>/gitlab-config.tgz -C /etc gitlab/gitlab-secrets.json gitlab/gitlab.rb

Backups are written to /var/opt/gitlab/backups. Copy them off the virtual machine, for example to Azure Blob Storage. Azure Backup can also take scheduled snapshots of the whole virtual machine.

The Admin Area

The Admin button at the top right (or http://<public-ip>/admin) shows the instance's version, its users and projects, and the state of its components:

The GitLab Admin area

Server Components

Component Version Notes
GitLab Community Edition 19.6.2 Omnibus package gitlab-ce from packages.gitlab.com, MIT licence
PostgreSQL 18.7 Bundled, local socket only, data in /var/opt/gitlab/postgresql
Redis 7.2.16 Bundled, local socket only
NGINX 1.31.9 Bundled, port 80 (and 443 with HTTPS)
Git 2.55.1 (Gitaly's), 2.53.0 (Ubuntu's) Gitaly serves the repositories with its own Git
Ruby 3.3.14 Bundled, runs Puma and Sidekiq
Ubuntu 26.04.1 LTS Azure kernel, unattended security upgrades on

Filesystem Layout

Mount Size What is there
/ 30 GB OS disk (28 GB root partition) Ubuntu, GitLab in /opt/gitlab, its configuration in /etc/gitlab, its data (repositories, database, uploads, backups) in /var/opt/gitlab, its logs in /var/log/gitlab
/boot 989 MB Kernels
/boot/efi 105 MB EFI system partition
/mnt Azure temporary disk (size depends on the VM size) Scratch space only: Azure may wipe it on a stop, resize or redeploy. Never keep GitLab data here

GitLab uses about 8 GB of the root partition on a new virtual machine. For many or large repositories, attach a managed data disk, mount it, and move GitLab's repository storage and gitlab_rails['backup_path'] onto it as GitLab's configuration guide describes (https://docs.gitlab.com/omnibus/settings/configuration/).

Managing the Services

sudo gitlab-ctl status
sudo gitlab-ctl restart

sudo gitlab-ctl restart puma restarts one service; let it finish starting before you restart another. sudo gitlab-ctl tail nginx follows one service's logs (Ctrl+C stops it), and sudo gitlab-ctl tail follows them all. gitlab-ctl manages every GitLab service; systemctl sees them as the one unit gitlab-runsvdir. After any change to /etc/gitlab/gitlab.rb, apply it with sudo gitlab-ctl reconfigure. To check the whole installation, run sudo gitlab-rake gitlab:check SANITIZE=true.

Scripts and Log Files

Path What it does
/usr/local/sbin/gitlab-firstboot.sh First boot: sets external_url to the public address, runs GitLab's first gitlab-ctl reconfigure with a new root password, checks that root can sign in, then writes /var/lib/cloudimg/gitlab-firstboot.done
/usr/local/sbin/cloudimg-set-public-address Points GitLab at a new address or domain (step 7)
/stage/scripts/gitlab-credentials.log The GitLab address and the root password (root only)
/etc/gitlab/gitlab.rb GitLab's configuration (root only)
/var/log/gitlab-firstboot.log The first boot log (also journalctl -u gitlab-firstboot)
/var/log/cloudimg-gitlab-reconfigure.log The output of the first boot's reconfigure (root only)
/var/log/gitlab/ Every GitLab service's logs, one directory each

On Startup

On the first boot gitlab-firstboot.service runs once, after the rest of the system is up: it reads the virtual machine's public IP address from Azure, writes it into external_url, runs GitLab's first reconfigure (which creates the database, the secrets file and the root password), and records /var/lib/cloudimg/gitlab-firstboot.done so it never runs again. On every later boot gitlab-runsvdir starts GitLab's services as normal, and Ubuntu's unattended upgrades run on their usual timers.

Troubleshooting

The browser shows 502 or cannot connect. First boot may still be running, or GitLab is still starting after a reboot (allow a few minutes). Check systemctl status gitlab-firstboot --no-pager, sudo cat /var/log/gitlab-firstboot.log and sudo gitlab-ctl status. Also check that the network security group allows TCP 80.

Links or clone addresses show an old address. external_url still holds the previous address. Run sudo cloudimg-set-public-address <your-domain> (step 7).

ssh -T git@<public-ip> asks for a password. GitLab does not know your key yet: add it under Edit profile > SSH Keys (step 6), and check that you connect with the matching private key (ssh -i <key> -T git@<public-ip>).

GitLab answers 502 for a minute or two. When Ubuntu's unattended upgrades update a system library that GitLab uses, needrestart restarts gitlab-runsvdir, and GitLab takes a minute or two to start again. sudo journalctl -u gitlab-runsvdir shows when that happened.

GitLab is slow or services restart. GitLab needs at least 8 GiB of memory. Check free -m and sudo gitlab-ctl status; resize to a larger virtual machine if memory is short.

Security Recommendations

The image answers on SSH (22) and HTTP (80) from outside. PostgreSQL and Redis use local sockets only, and GitLab's internal services listen on the local machine only. NGINX's status page on port 8060 answers only to the virtual machine itself (any other address gets 403); keep it closed in the network security group:

Listening ports, no initial root password file, and first boot ordered after the system is up

  • Change the root password after the first sign in, and give every person their own account.
  • Turn off sign-ups if you create every account yourself (step 4).
  • Allow SSH and HTTP only from your own network in the network security group.
  • Add HTTPS (step 8) before you sign in from a public network.
  • Turn on two-factor authentication for administrators (Edit profile > Account).
  • GitLab loads profile pictures from Gravatar by default; turn that off under Admin > Settings > General > Account and limit if you would rather not.
  • Install GitLab's security releases promptly (step 10), and leave Ubuntu's unattended upgrades on.
  • Keep /etc/gitlab/gitlab-secrets.json readable by root only, and back it up somewhere safe: it holds the keys that encrypt GitLab's database secrets.

Support

cloudimg's support team is on hand 24 hours a day by email at support@cloudimg.co.uk, with a guaranteed response within 24 hours. For GitLab itself, see the documentation at https://docs.gitlab.com/ and the forum at https://forum.gitlab.com/.