GitLab is a powerful, open-source DevOps platform that provides source code management (SCM), continuous integration (CI/CD), and project management tools in one application. It is an essential tool for managing software development workflows. In this guide, we will show you how to install GitLab on Rocky Linux 9. Hosting GitLab on a WindowsVPS ensures optimal performance and scalability for managing your code repositories using the dedicated resources of a VPS server.
Step 1: Update Your VPS Server
Before installing GitLab, ensure that your VPS server is up to date. Run the following commands to update your system:
sudo dnf update -y
Using a WindowsVPS provides you with dedicated resources, ensuring GitLab performs efficiently, especially for large-scale development teams.
Step 2: Install Required Dependencies
GitLab requires several dependencies, including the ability to send email notifications. Install the necessary dependencies using the following command:
sudo dnf install -y curl policycoreutils openssh-server perl
Next, start and enable the SSH service:
sudo systemctl enable sshd
sudo systemctl start sshd
If your server has a firewall enabled, allow OpenSSH through the firewall:
sudo firewall-cmd --permanent --add-service=ssh && sudo firewall-cmd --reload
Step 3: Add the GitLab Repository
GitLab provides an easy-to-use installation script that sets up the repository for you. Run the following command to download and add the GitLab repository:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
Step 4: Install GitLab
After adding the repository, install GitLab using the following command (replace your-domain.com
with your server's domain or IP address):
sudo EXTERNAL_URL="http://your-domain.com" dnf install gitlab-ce -y
This will install GitLab and set it up to run on your server.
Step 5: Configure GitLab
Once GitLab is installed, you can configure it by editing the configuration file located at /etc/gitlab/gitlab.rb
. Open the file using your preferred editor:
sudo nano /etc/gitlab/gitlab.rb
In this file, you can configure GitLab's external URL, SSL settings, and other options. If you plan to use SSL, you will need to set up Let's Encrypt or add your own certificates.
After making changes, apply the configuration by running:
sudo gitlab-ctl reconfigure
Step 6: Open Firewall for GitLab
By default, GitLab runs on port 80 (HTTP) or 443 (HTTPS). To allow access, open the necessary ports in the firewall:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Step 7: Access the GitLab Web Interface
After installation, you can access GitLab via a web browser. Open your browser and go to http://your-domain.com
(or https://your-domain.com
if you configured SSL). The first time you access the interface, you will be prompted to set the GitLab root password.
Step 8: Set Up GitLab Admin Account
Once you've set the root password, log in to GitLab using the default username root
and the password you just created. After logging in, you can create new users, set up projects, and configure your GitLab instance to meet your team's needs.
Step 9: Manage GitLab Services
GitLab comes with a command-line tool to manage its services. To start, stop, or check the status of GitLab, use the following commands:
- Start GitLab:
sudo gitlab-ctl start
- Stop GitLab:
sudo gitlab-ctl stop
- Check the status of GitLab:
sudo gitlab-ctl status
Step 10: Optimize Your VPS Server for GitLab
For optimal performance, it is highly recommended to host GitLab on a WindowsVPS. A VPS server provides dedicated resources such as CPU, memory, and storage, which are crucial for managing large repositories, running CI/CD pipelines, and handling high traffic. As your development team grows, a VPS allows you to scale your GitLab instance smoothly, ensuring continuous integration and code management workflows operate efficiently.
Conclusion
Installing GitLab on Rocky Linux 9 provides a robust platform for managing your source code, projects, and CI/CD pipelines. By hosting GitLab on a WindowsVPS, you gain better performance, scalability, and control, allowing your team to work more efficiently and securely.
For more information about VPS hosting and optimizing your GitLab setup, visit WindowsVPS today.