How to GitLab on Ubuntu 24.04
GitLab on Ubuntu 24.04 puts a private code server on your own hardware to store project files, track bugs, and run build tests in one place. GitLab Community Edition (CE) is the free, self-hosted version of this popular software development platform.
Running this server gives you total control over your code without paying for cloud storage. You need a computer with at least 4 gigabytes of memory and a clean Ubuntu 24.04 install to get started. A fresh install matters because GitLab bundles its own web server, database and background services. It can clash with software that is already using the same ports.
The setup has four parts: install OpenSSH server, install a mail server, install GitLab itself, then sign in. Do them in that order. You need a user with sudo rights and a working internet connection on the server.
To install GitLab on Ubuntu 24.04, add the official GitLab CE package repository with the script.deb.sh file, then run sudo apt install gitlab-ce in a terminal as a user with sudo rights. Install OpenSSH and Postfix first, since GitLab needs both. The install completes with a GitLab welcome banner.
Install OpenSSH
How to install OpenSSH server on Ubuntu
Move on to the next part once the OpenSSH server runs properly on the system. A quick check is to connect to the server over SSH from another computer. If the login works, you are ready.
Install SMTP server
Installing an SMTP server on Ubuntu 24.04 lets GitLab send email notifications, such as password resets and project alerts. To set this up, install Postfix before you run the main GitLab installer. Postfix is a mail transfer agent, which means it routes outgoing email from the server. Having it in place first prevents email errors later.
The guide linked below walks through the Postfix installation. Follow it to the end, then come back here.
How to install Postfix on Ubuntu
Mail services are now ready, so it is time for the core installation.
Install GitLab
To install GitLab on Ubuntu 24.04, you add the official package repository and run the setup commands in a terminal. You first install system dependencies such as ca-certificates, then download the official repository script with curl, and finally use apt to install the GitLab package. Run each command in the order shown, and wait for one to finish before you start the next.
Run every command as a user with sudo rights. The package is large, so the download and install can take several minutes, depending on your connection.
Step 1. Open a terminal on the server and run the command below to install the required dependencies. These packages let the server fetch and verify software over a secure connection.
sudo apt install ca-certificates tzdata perl
Step 2. Download the official package script with the command below. The script adds the GitLab package repository to your system, so apt knows where to find GitLab CE. When it finishes, you should see a message saying the repository has been set up.
curl -O https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh sudo bash ./script.deb.sh
Step 3. Install GitLab CE with the command below. Be patient here. The package is large, and the terminal can look idle for a while during the unpacking.
sudo apt update sudo apt install gitlab-ce
When the install completes successfully, the terminal shows a confirmation message like the example below. If you see an error instead, check that the server has enough free memory and disk space and that it can reach the internet. Then run the install command again.
*. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,.
_______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ `/ __
/ /_/ / / /_/ /___/ /_/ / /_/ /
____/_/__/_____/__,_/_.___/
Thank you for installing GitLab!
Step 4. Configure GitLab by running the command below. It applies the settings and starts GitLab’s services. This step can also take several minutes, and the terminal prints a lot of output while it works. Let it finish before you do anything else.
sudo gitlab-ctl reconfigure
Open that file as an administrator, then copy the password and store it somewhere safe, because you need it to sign in. GitLab deletes this file automatically 24 hours after the first configuration run. Change the password after your first login, or note it down before the file disappears.
Access GitLab
You access GitLab on Ubuntu 24.04 by typing your server’s IP address or hostname into a web browser on any computer on your network. For the first login, use root as the username and the temporary password from the initial password file.
If the page does not load, check that the server is running and that its firewall allows web traffic (ports 80 and 443). Also confirm that you typed the right IP address or hostname. GitLab can take a minute or two to start responding after the configuration step, so wait briefly and refresh.
On the sign-in page, enter root as the username and paste in the temporary password. Then click the sign-in button. A wrong-password message usually means a copy mistake, such as a missing character or an extra space.

Once you are signed in, you land on the GitLab home screen and can start using it. Good first steps are changing the root password to one you choose, then creating your first project and any extra user accounts.

The setup process is finished.
Conclusion:
Installing GitLab on Ubuntu 24.04 gives you a solid platform for managing software development projects on your own server. Here are the key takeaways from the installation:
- PrerequisitesMake sure both the OpenSSH server and an SMTP server (like Postfix) are installed before you start the GitLab install.
- Installation StepsInstall the necessary packages, download the GitLab repository installer, and install GitLab with the commands shown, in that order.
- ConfigurationRun the configuration command after installation so GitLab is set up properly and its services start.
- AccessOpen your new GitLab instance in a web browser using the server’s IP address or hostname.
- Temporary PasswordNote down the temporary root password in
/etc/gitlab/initial_root_passwordfor your first login. GitLab removes that file after 24 hours.
With these steps done, the server is ready for your development work. Before real projects go on it, change the root password and set up regular backups.
Have a question about this guide?
Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.
Did this guide fix your problem?
About the Author
Richard
Tech Writer, IT Professional
Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.
No comments yet — be the first to share your thoughts!