Want to deploy your own CI/CD server but aren't ready for multi-thousand dollar cloud solutions or dedicated hardware? Great news: GitLab on a VPS is not only real but also very affordable, starting from just $10/month. With it, you get a full-fledged platform for repository management, automated build, testing, and code deployment, all while maintaining full control over your data and processes.
Why choose self-hosted GitLab on a VPS?
Deploying your own GitLab on a virtual private server offers many advantages, especially for small to medium-sized teams, startups, and individual developers:
- Full Control: You own all your data and can configure GitLab to your needs without the limitations of cloud providers.
- Cost Savings: Cloud solutions can quickly become expensive as usage grows. With GitLab VPS, you pay a fixed amount for the server, and using GitLab CE (Community Edition) is free.
- Flexibility: The ability to install any plugins, integrations, and custom settings that might not be available in SaaS versions.
- Security and Privacy: Your data remains on your server, which is critical for projects with high security requirements or for companies handling confidential information.
- Resource Optimization: You only pay for the resources you actually use and can easily scale them as your project grows.
For many teams, GitLab server hosting on a VPS strikes the ideal balance between functionality, control, and cost.
Minimum Requirements for GitLab CE on a VPS: 4GB RAM — It's Real!
Many believe that GitLab requires vast resources, but this isn't always the case. For small teams (up to 10 users) with moderate load, a VPS with 4GB of RAM is quite sufficient. Of course, it won't be the fastest server, but it will operate stably.
Here are the minimum and recommended requirements for comfortable operation:
Minimum Requirements (up to 5-10 users, light load):
- CPU: 2 cores (modern Intel Xeon or AMD EPYC).
- RAM: 4GB RAM.
- Storage: 50GB SSD (minimum, for OS and GitLab itself). 80-100GB SSD is recommended for repositories and artifacts.
- Operating System: Ubuntu 22.04 LTS (recommended), Debian 11+, CentOS 7+.
Recommended Requirements (up to 25 users, medium load, active CI/CD):
- CPU: 4 cores.
- RAM: 8GB RAM.
- Storage: 100-200GB SSD (fast, for optimal performance).
- Operating System: Ubuntu 22.04 LTS.
It's important to remember that the main resource consumers in GitLab are the Ruby on Rails, Sidekiq, and PostgreSQL processes. With active CI/CD and a large number of repositories, the requirements for the disk subsystem and RAM may increase.
Looking for a reliable server for your projects?
Valebyte offers VPS and dedicated servers with guaranteed resources and fast activation.
View offers →
Choosing a VPS for GitLab on Valebyte.com
On Valebyte.com, you'll find plans ideally suited for hosting GitLab VPS. We offer:
- Fast SSD drives: Critical for GitLab performance, especially when working with large repositories and CI/CD artifacts.
- Modern processors: Intel Xeon E5/E7 or AMD EPYC for efficient task processing.
- Flexible plans: From 4GB RAM for starting up to 8GB and more for growing projects.
- High-speed internet channel: For fast code and artifact upload/download.
Example Valebyte.com Plans for GitLab:
| Plan |
CPU |
RAM |
SSD |
Price (approx.) |
Recommendation |
| Valebyte Start |
2 Core |
4 GB |
80 GB NVMe |
From $10/month |
Minimum for GitLab CE (up to 10 users, light load) |
| Valebyte Pro |
4 Core |
8 GB |
160 GB NVMe |
From $20/month |
Recommended for GitLab CE (up to 25 users, active CI/CD) |
| Valebyte Expert |
6 Core |
16 GB |
320 GB NVMe |
From $40/month |
For large teams, high load, multiple CI/CD runners |
Start with the Valebyte Start plan, and as your needs grow, you can always easily scale resources by upgrading to a more powerful plan without reinstallation.
Step-by-Step Installation of GitLab CE on Ubuntu 22.04 LTS
We assume you already have a clean VPS with Ubuntu 22.04 LTS and SSH access. Make sure you have a domain name (e.g., gitlab.yourdomain.com) pointing to your VPS's IP address.
1. System Update and Dependency Installation
Connect to your VPS via SSH and execute the commands:
sudo apt update
sudo apt upgrade -y
sudo apt install -y curl ca-certificates apt-transport-https postfix tzdata perl
During Postfix installation, select the "Internet Site" option and enter your domain name (e.g., yourdomain.com) as the "System mail name".
2. Adding the GitLab Repository
Download and install the script that will add the GitLab repository:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
3. Installing GitLab CE
Now you can install GitLab CE. Replace gitlab.yourdomain.com with your actual domain:
sudo EXTERNAL_URL="https://gitlab.yourdomain.com" apt install gitlab-ce -y
The installation may take some time (10-20 minutes) as GitLab pulls many dependencies, including its own Nginx, PostgreSQL, and Redis.
4. SSL Configuration (Let's Encrypt)
GitLab will automatically configure Let's Encrypt if you specified https:// in EXTERNAL_URL. Ensure that ports 80 and 443 are open in your firewall (if using UFW):
sudo ufw allow http
sudo ufw allow https
sudo ufw enable # if not enabled previously
If GitLab could not automatically configure SSL, you can edit the /etc/gitlab/gitlab.rb file:
sudo nano /etc/gitlab/gitlab.rb
Find and uncomment (remove #) the following lines, replacing the domain with your own:
external_url 'https://gitlab.yourdomain.com'
letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['[email protected]'] # Specify your email
After making changes, apply them:
sudo gitlab-ctl reconfigure
5. Initial Login
After successful installation and configuration, open your domain (e.g., https://gitlab.yourdomain.com) in your browser. You will be prompted to set a password for the root account. After setting the password, you can log in.
Optimizing GitLab on a VPS with 4GB RAM
To make GitLab on a VPS with 4GB RAM run more stably, you can make several changes to the /etc/gitlab/gitlab.rb configuration file.
sudo nano /etc/gitlab/gitlab.rb
Find and modify the following parameters (or add them if they are missing) to reduce memory consumption:
- Unicorn (Ruby on Rails web server):
unicorn['worker_processes'] = 2 (default is 2, but can be reduced to 1 if resources are very tight).
unicorn['per_worker_memory_limit_min'] = "200MB"
unicorn['per_worker_memory_limit_max'] = "300MB"
- Sidekiq (background tasks):
sidekiq['concurrency'] = 5 (default is 25, which is too much for 4GB).
- PostgreSQL (database):
postgresql['shared_buffers'] = "64MB" (default is 256MB).
postgresql['effective_cache_size'] = "1GB"
- Prometheus (monitoring):
prometheus_monitoring['enable'] = false (disable if not used).
- Grafana:
grafana['enable'] = false (disable if not used).
After all changes, save the file and apply them:
sudo gitlab-ctl reconfigure
It is also recommended to create a swap file if you have low RAM:
sudo fallocate -l 2G /swapfile # Create a 2GB swap file
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
This will help the system avoid OOM (Out Of Memory) errors, but remember that swap on an SSD wears it out faster.
Configuring GitLab CI/CD Runner
To execute CI/CD pipelines, GitLab requires Runners. It is recommended to install the Runner on a separate VPS so that it does not compete for resources with the main GitLab server. This is especially relevant if you are using a GitLab VPS with 4GB RAM.
Let's assume you have a second VPS for the Runner (e.g., another Valebyte Start plan).
1. Installing Docker on the Runner VPS
GitLab Runner most often uses the Docker executor, so let's install Docker:
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER # Add the current user to the docker group
newgrp docker # Apply changes without logging out and back in
2. Installing GitLab Runner
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
sudo apt install gitlab-runner -y
3. Registering the Runner with your GitLab Server
In the GitLab web interface, go to Admin Area -> Overview -> Runners. There you will find your GitLab server's URL and registration token.
On the Runner VPS, execute the command:
sudo gitlab-runner register
During registration, you will need to enter:
- GitLab instance URL: Your GitLab domain (e.g.,
https://gitlab.yourdomain.com).
- Registration token: The token from the GitLab admin panel.
- Description for the runner: For example,
My-Docker-Runner.
- Tags for the runner: For example,
docker, linux, build (important for selection in .gitlab-ci.yml).
- Executor: Select
docker.
- Default Docker image: For example,
ubuntu:latest or alpine:latest.
Example .gitlab-ci.yml
Here's a simple example of .gitlab-ci.yml that uses the registered Runner:
stages:
- build
- test
build_job:
stage: build
tags:
- docker
- linux
script:
- echo "Building project..."
- mkdir build
- echo "Build artifact" > build/artifact.txt
artifacts:
paths:
- build/
test_job:
stage: test
tags:
- docker
- linux
script:
- echo "Testing project..."
- cat build/artifact.txt
- echo "Tests passed!"
dependencies:
- build_job
When to Consider a GitLab Dedicated Server?
While GitLab VPS is an excellent solution for startups and medium-sized teams, there comes a point when a VPS can become a bottleneck. This happens when:
- The number of active users exceeds 50-100 people.
- You run many CI/CD pipelines simultaneously, requiring significant CPU and RAM resources.
- You have very large repositories (hundreds of gigabytes) or many artifacts requiring high-speed disk subsystem performance.
- Maximum performance and resource isolation are required, which is not possible in a virtualized environment.
- There are strict compliance requirements that are easier to implement on dedicated hardware.
In such cases, migrating to a GitLab dedicated server becomes a justified step. Valebyte.com offers a wide selection of dedicated servers that will provide maximum performance and reliability for your GitLab instance and CI/CD infrastructure.
Conclusion
Deploying your own GitLab on a VPS is an effective and economical solution for getting a full-fledged CI/CD platform. Starting with the Valebyte Start plan from $10/month, you can get a functional GitLab on a VPS with 4GB RAM that will perfectly handle the tasks of a small team.
Remember to optimize your GitLab configuration and use a separate VPS for CI/CD Runners to make the most efficient use of available resources. As your team and projects grow, Valebyte.com will provide you with all the scaling options — from more powerful VPS to full-fledged GitLab dedicated servers.
Start your journey to efficient development today by choosing suitable GitLab server hosting on Valebyte.com!
Ready to choose a server?
Compare VPS and dedicated servers from trusted providers on Valebyte.
Get started now →