Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
GitLab is an open source GIT repository manager based on Rails and developed by
GitLab Inc. It is a web-based GIT repository manager that allows your team to work
on code, perform feature requests, track bugs, and test and implement applications.
GitLab provides features such as a wiki, issue tracking, code reviews, activity feeds,
and merge management. It is able to host multiple projects.
Gitlab CE (Community Edition) - self-hosted, free and support from the Community
forum.
Gitlab EE (Enterprise Edition) - self-hosted, paid app, comes with additional
features.
GitLab.com - SaaS, free.
GitLab.io - Private GitLab instance managed by GitLab Inc.
In this tutorial, I will show you step-by-step how to install GitLab CE (Community
Edition) on your own Ubuntu 18.04 LTS (Bionic Beaver) server. I will be using the
'omnibus' package provided by GitLab for easy installation.
Prerequisites
Ubuntu 18.04 Server
Min RAM memory 4GB - for better performance, use 8GB
Root privileges
What we will do
Update Repository and Upgrade Packages
Install Dependencies
Install GitLab Community Edition
Generate SSL Letsencrypt and DHPARAM Certificate
Configure HTTPS for GitLab
Configure Ubuntu UFW Firewall
GitLab Post-Installation
Testing
Before installing any packages on the system, update all available repositories and
then upgrade all packages on the system.
Run apt commands below.
GitLab needs some packages dependencies for the installation, including curl,
postfix, and ca-certificates.
During postfix installation, you will be prompted about the configuration, select
'Internet Site'.
And then enter the server domain name that shall be used for sending an email.
In this step, we will install GitLab using the omnibus packages. The Omnibus will
install all packages, services, and tools required for running GitLab on the server.
The command will download and install the GitLab CE package, and when the
installation is complete, you will see the results as below.
Next, we should configure the URL that will be used to access our GitLab server. We
will be using a domain named 'git.hakase-labs.pw' for the GitLab access URL and
will enable the HTTPS on it.
In this step, we will generate a new Letsencrypt certificate and DHPARAM certificate
for the GitLab domain name 'git.hakase-labs.pw'.
Install the lets encrypt tool using the apt command below.
And after the installation is complete, run the letsencrypt command below.
And when it's complete, you will get the result as shown below.
Next, we will generate the DHPARAM certificate using the OpenSSL command.
Create a new directory '/etc/gitlab/ssl' and run the OpenSSL command below.
And all certificates needed for GitLab HTTPS configuration have been generated.
In order to enable the HTTPS for GitLab installation, we need to edit the 'gitlab.rb'
file.
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/letsencrypt/live/git.hakase-la
bs.pw/fullchain.pem"
nginx['ssl_certificate_key'] = "/etc/letsencrypt/live/git.hakas
e-labs.pw/privkey.pem"
nginx['ssl_dhparam'] = "/etc/gitlab/ssl/dhparams.pem"
This command will install and configure GitLab based on the '/etc/gitlab/gitlab.rb'
configuration file.
And when it's complete, you will see the result as below.
The GitLab installation is complete, and HTTPS for GitLab has been enabled.
Step 6 - Configure Ubuntu UFW Firewall
In this step, we will enable the Ubuntu UFW firewall. It's already installed on the
system, we just need to start the service. We will run GitLab behind the Ubuntu
UFW firewall, so we must open the HTTP and HTTPS ports.
And enable the Ubuntu UFW firewall with the command below.
And you will get ssh, http, and https services on the list.
Step 7 - GitLab Post-Installation
Open the web browser and type in the gitlab URL 'git.hakase-labs.pw', and you will
be redirected to the HTTPS connection.
Type your new password for root GitLab user, and click the 'Change your password'
button.
Now Login as a 'root' user with your own password and click the 'Login' button.
Now you will get the GitLab Dashboard.
Change Profile
Change Username
ssh keygen
cat ~/.ssh/id_rsa.pub
Copy the 'id_rsa.pub' key.
Now back to the GitLab user dashboard and click the 'SSH Key' menu on the left.
Paste the ssh public key 'id_rsa.pub' and click the 'Add key' button.
Sign up Restrictions
Click the 'Admin area' button on the middle, then click 'Settings'.
Uncheck the 'signup enabled' option and click the 'Save changes' button.
Account Limit
Click on the 'Account and limit' section and set the default project limit to 20.
Finally, we will do some tests to ensure that our GitLab system is working properly.
Now we will start adding new content to the repository. Make sure Git is installed on
your computer, and we need to set up the global username and email for git with
the command below.
You will be asked for the 'hakase' user password. Please type the same password
that you used when we accessed GitLab the first time.
Type in your password and press Enter to continue. You will see the result as below.
Now open the 'project01' project from your web browser, and you will see that the
new README.md file has been added to the repository.
GitLab installation guide on Ubuntu 18.04 has been completed successfully.
Reference
https://docs.gitlab.com/omnibus/