How to Set Up a GitLab Server on Windows Server with Hyper-V

To set up GitLab Self-Managed on Windows Server, run a supported Ubuntu Server virtual machine in Hyper-V and install GitLab inside the Linux guest. Windows Server remains the host; GitLab runs from its official Linux package. GitLab’s current Ubuntu package guide lists Ubuntu 22.04 and 24.04, so this walkthrough uses Ubuntu Server 24.04 LTS.

Before you begin, confirm the host can spare CPU, RAM, and disk for the guest. GitLab’s single-node baseline is 8 vCPUs and 16 GB RAM; budget 40 GB for the application, 5–12 GB for the database, plus repository storage. Use SSD-backed disks and leave resources for Windows Server.

1. Install the Hyper-V role

In Server Manager, choose Manage > Add Roles and Features, select the local server, and enable Hyper-V. Include the management tools and allow the required restart. You can also run PowerShell as an administrator and install the local role with:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

Hyper-V installation restarts the host. Check Microsoft’s Hyper-V installation guide if your server uses a different management setup.

Server Manager Add Roles and Features wizard with the Hyper-V server role selected
Select the Hyper-V role in Server Manager, then install its management tools.

2. Create a virtual switch for the guest

In Hyper-V Manager, open Virtual Switch Manager and create an External switch on the host’s LAN adapter. Choose whether Windows should share it. This gives Ubuntu a LAN address and lets authorized devices reach GitLab. Use a trusted LAN or VPN; follow your network policy before public access. See Microsoft’s virtual switch guide.

Hyper-V Virtual Switch Manager showing an external switch connected to an Ethernet adapter
An external switch connects the Ubuntu guest to the selected physical network.

3. Create the Ubuntu virtual machine

Download Ubuntu Server 24.04 LTS. In Hyper-V Manager, create a VM named GitLab-Ubuntu, choose Generation 2, connect the external switch, and create an SSD-backed VHDX. Use GitLab’s 8-vCPU/16-GB baseline for a single node; a lab can start smaller, with slower performance.

Attach the ISO to the virtual DVD drive. If Ubuntu does not boot, set the Generation 2 VM’s Secure Boot template to Microsoft UEFI Certificate Authority.

Hyper-V New Virtual Machine wizard summary for a Generation 2 Ubuntu Server virtual machine
This sample Generation 2 VM has GitLab’s published CPU and memory baseline; size its expandable disk for the application, database, and repository growth.
Hyper-V VM settings window with the Ubuntu Server installation ISO attached to the virtual DVD drive
Mount the Ubuntu Server ISO here, then confirm the external switch under Network Adapter settings.

4. Install Ubuntu and give it a stable address

Start the VM and complete the Ubuntu Server installer. Create an administrator account, use a hostname such as gitlab, and enable OpenSSH for remote administration. Give the VM a static IP or DHCP reservation so its address stays stable.

Ubuntu Server installer network and hostname screen with an Ethernet interface and the hostname gitlab
Set the VM’s hostname and choose a stable network configuration during Ubuntu installation.

After the first login, install available updates and restart if prompted:

sudo apt update && sudo apt upgrade -y
Ubuntu Server terminal showing package updates and the guest network address
Update Ubuntu and confirm the guest has a reachable network address before installing GitLab.

5. Set DNS and allow only the required traffic

Create a DNS record such as gitlab.example.com that resolves to the VM’s stable address. Allow inbound TCP ports 22 for Git over SSH, 80 for HTTP and Let’s Encrypt certificate validation, and 443 for HTTPS. Apply matching rules in Ubuntu’s firewall, the Windows/network firewall, and any router or cloud firewall in front of the host. Restrict SSH and web access to intended users or networks where possible.

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

6. Install the GitLab Linux package

These commands install the Community Edition package. Replace the example hostname with the DNS name you configured. For Enterprise Edition, use the EE option in GitLab’s official Ubuntu installation guide. Review the repository setup script before running it as an administrator.

sudo apt update
sudo apt install -y curl
curl --location "https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh" | sudo bash
sudo EXTERNAL_URL="https://gitlab.example.com" apt install gitlab-ce

With a valid public DNS name and inbound HTTP access, GitLab can request a Let’s Encrypt certificate during installation. For an internal-only server, configure a certificate trusted by your organization and follow GitLab’s current TLS instructions. Check the GitLab installation requirements before sizing a production VM.

7. Sign in, secure the instance, and test a repository

When installation finishes, open https://gitlab.example.com. Sign in as root; retrieve the initial password from /etc/gitlab/initial_root_password on the Ubuntu VM. GitLab removes that file after 24 hours, so change the password immediately and store the new credential securely.

Browser open to a GitLab sign-in page over HTTPS with empty username and password fields
Use the configured HTTPS hostname to reach the GitLab sign-in page.

Create a test project, add a README, and clone it over HTTPS or SSH from a client machine to confirm DNS, firewall rules, and authentication work. Before inviting a team, review GitLab’s recommended next steps, enable two-factor authentication, and restrict public sign-ups if the instance is private. Configure scheduled backups and copy them off the VM; the GitLab backup guide explains what the backup command includes and what must be backed up separately.

GitLab project repository page with a clone menu showing HTTPS and SSH connection choices
Use the project’s clone menu to verify the HTTPS or SSH route your team will use.

Keep Windows and Ubuntu patched, watch disk growth, and test a backup restore before relying on the instance for important repositories.

Leave a Comment

How to Set Up an Email Signature in Outlook.com

How to Set Up an Email Signature in Outlook.com

Create a reusable Outlook.com email signature, choose when it appears automatically, and insert it manually when you need a different sign-off.

How to Open Command Prompt in Windows 11, 10, and Older Versions

How to Open Command Prompt in Windows 11, 10, and Older Versions

Open Command Prompt with Start search, Run, File Explorer, or Windows Terminal. See how to launch it as an administrator and find it on older PCs.

How to Host a Nextcloud Sync Server on Windows Server

How to Host a Nextcloud Sync Server on Windows Server

Set up a Nextcloud sync server on Windows Server with the AIO virtual machine, VirtualBox, bridged networking, domain, HTTPS, and backup guidance.

How to Create and Apply Group Policies in Windows Server

How to Create and Apply Group Policies in Windows Server

Learn how to create, link, configure, and verify a Windows Server Group Policy Object with a pilot OU, a wallpaper example, and troubleshooting checks.

Windows 7 System Maintenance Tools: What to Use and When

Windows 7 System Maintenance Tools: What to Use and When

Learn how Windows 7 Disk Cleanup, Disk Defragmenter, System Restore, and built-in troubleshooters handle common maintenance tasks, with important safety limits.

12 Simple Ways to Improve Windows 7 Performance

12 Simple Ways to Improve Windows 7 Performance

Speed up a Windows 7 PC by finding bottlenecks, reducing startup load, clearing disk space, adjusting visual effects, and upgrading wisely.

How to Install Microsoft Configuration Manager (SCCM) on Windows Server

How to Install Microsoft Configuration Manager (SCCM) on Windows Server

Set up Configuration Manager as a standalone primary site with supported Windows Server, SQL Server, evaluation media, and current setup prerequisites.

How to Set Up a GitLab Server on Windows Server with Hyper-V

How to Set Up a GitLab Server on Windows Server with Hyper-V

Host GitLab Self-Managed on Windows Server by running Ubuntu Server in Hyper-V, then configure its network, HTTPS address, first login, and backups.

How to Install Abyss Web Server on Windows Server

How to Install Abyss Web Server on Windows Server

Install Abyss Web Server X1 on Windows Server, create the console login, publish a test page, and configure the service to start at boot.

Installing and Configuring SharePoint Server on Windows Server

Installing and Configuring SharePoint Server on Windows Server

Install SharePoint Server Subscription Edition on Windows Server with current hardware, SQL, prerequisite, setup, and farm-configuration guidance.