Introduction
GitLab is a comprehensive DevOps platform that provides source code management, CI/CD pipelines, issue tracking, container registry, and much more in a single application. By self-hosting GitLab on RamNode, you benefit from full data ownership, customizable configurations, and the performance of dedicated VPS resources without recurring per-user licensing fees.
Source Control
Git repository management with merge requests
CI/CD Pipelines
Automated testing and deployment workflows
Issue Tracking
Built-in project management and tracking
Container Registry
Store and manage Docker images
System Requirements
GitLab is a resource-intensive application. Selecting the appropriate RamNode VPS plan is crucial for optimal performance.
⚠️ Note: GitLab recommends a minimum of 4 GB RAM. With less memory, GitLab may run slowly or fail to start. Consider enabling swap space as a safety buffer.
Prerequisites
Before beginning the installation, ensure you have:
- A RamNode VPS with Ubuntu 22.04 LTS or 24.04 LTS installed
- Root or sudo access to your server
- A registered domain name pointing to your VPS IP address
- SSH access configured for secure remote management
- Basic familiarity with Linux command line operations
Initial Server Setup
Update System Packages
sudo apt update && sudo apt upgrade -yInstall Required Dependencies
sudo apt install -y curl openssh-server ca-certificates tzdata perlConfigure Firewall
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw enableConfigure Swap Space (Recommended)
If your VPS has limited RAM, add swap space to prevent out-of-memory issues:
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstabGitLab Installation
Add GitLab Repository
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bashInstall GitLab CE
Install GitLab Community Edition, replacing the URL with your domain:
sudo EXTERNAL_URL="https://gitlab.yourdomain.com" apt install gitlab-ce💡 Important: Replace "gitlab.yourdomain.com" with your actual domain name. This URL will be used for all GitLab access and must have proper DNS records pointing to your VPS IP.
Retrieve Initial Root Password
sudo cat /etc/gitlab/initial_root_password⚠️ Security Note: This password file is automatically deleted after 24 hours. Save the password securely and change it immediately after your first login.
Post-Installation Configuration
Access GitLab Web Interface
- Open your browser and navigate to your GitLab URL (https://gitlab.yourdomain.com)
- Log in with username "root" and the password from the previous step
- Navigate to User Settings → Password to set a new secure password
- Configure two-factor authentication for enhanced security
Configure Email Notifications
Edit the GitLab configuration file to set up email:
sudo nano /etc/gitlab/gitlab.rbAdd or modify the following SMTP settings (example using Gmail):
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "your-email@gmail.com"
gitlab_rails['smtp_password'] = "your-app-password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = "gitlab@yourdomain.com"Apply the configuration changes:
sudo gitlab-ctl reconfigureSSL/TLS Configuration
GitLab automatically configures Let's Encrypt SSL when installed with an HTTPS external URL. Ensure these settings are in /etc/gitlab/gitlab.rb:
letsencrypt['enable'] = true
letsencrypt['contact_emails'] = ['admin@yourdomain.com']
letsencrypt['auto_renew'] = trueManual Certificate Renewal
sudo gitlab-ctl renew-le-certsBackup Configuration
Manual Backup
Create a full backup of your GitLab instance:
sudo gitlab-backup createBackups are stored in /var/opt/gitlab/backups by default.
Automated Backups with Cron
Set up daily automated backups:
sudo crontab -eAdd the following line for daily 2 AM backups:
0 2 * * * /opt/gitlab/bin/gitlab-backup create CRON=1Backup Configuration Files
⚠️ Important: The backup command does not include configuration files. Manually backup these critical files:
sudo cp /etc/gitlab/gitlab.rb /var/opt/gitlab/backups/
sudo cp /etc/gitlab/gitlab-secrets.json /var/opt/gitlab/backups/Performance Optimization
Optimize GitLab for your VPS resources by adjusting these settings in /etc/gitlab/gitlab.rb:
Reduce Memory Usage (4-8 GB RAM)
# Reduce Puma workers
puma['worker_processes'] = 2
# Reduce Sidekiq concurrency
sidekiq['concurrency'] = 10
# Reduce PostgreSQL shared buffers
postgresql['shared_buffers'] = "256MB"
# Disable monitoring if not needed
prometheus_monitoring['enable'] = falseApply changes after editing:
sudo gitlab-ctl reconfigureTroubleshooting
GitLab Not Starting
Check service status and logs:
sudo gitlab-ctl status
sudo gitlab-ctl tail502 Bad Gateway Errors
This usually indicates Puma hasn't finished starting. Wait a few minutes or check memory:
free -h
sudo gitlab-ctl restart pumaSSL Certificate Issues
If Let's Encrypt fails, verify DNS and retry:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl renew-le-certsCommand Reference
gitlab-ctl statusgitlab-ctl restartgitlab-ctl reconfiguregitlab-ctl tailgitlab-backup creategitlab-rake gitlab:check