GitLab System Administration - Hands-on Lab: Install GitLab
Estimated time to complete: 30 minutes
Objectives
In this lab, you will install GitLab and its necessary dependencies on a virtual machine using the command line. Before you get started, complete the following:
- Open the GitLab Linux Installation page in a separate browser tab for reference.
- Open the lab setup instructions provided by the instructor to locate your assigned public IPv4 address for your Omnibus server. You will use SSH to access the training environment.
Task A. Access training environment
Your training environment consists of two EC2 instances in AWS. You will use the first instance to deploy GitLab and the second instance to deploy a runner for your GitLab instance. For this section of the lab, use the instance designated for the GitLab installation.
-
On your local computer, open a terminal window.
-
Navigate to the directory that contains the SSH key file for your server.
-
SSH connections require that your private key file is not accessible by others. On Linux and MacOS, you can do this with the following command:
chmod 400 <keyfile_name>
On Windows, you can do this with the following command:
icacls .\keyname.pem /inheritance:r
-
Use your assigned IP address and SSH key file to log in to the server that will host your GitLab Omnibus install:
ssh -i <keyfile_name> root@<vm_ip_address>
If you encounter an error like:
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
, you may need to reset your SSH known hosts. To do this, run the commandssh-keygen -R <vm_ip_address>
-
Press Enter.
-
If your system displays an authentication warning, type
yes
and press Enter. -
After typing yes, you will be connected to your server.
Task B. Install necessary dependencies
-
Install Postfix so GitLab can send notification emails by using the command below:
sudo apt-get install -y curl policycoreutils perl postfix
-
If you receive a Postfix Configuration Dialog when running this command, first select
Ok
by pressing the right arrow key to highlight the choice, and then pressing Enter. On the next page, selectNo configuration
using the up and down arrow keys, then press Enter.For a production system, you can use this configuration to be able to configure your email settings with postfix. This will allow you to send emails from GitLab.
-
Start and enable Postfix using the
systemctl enable
and thesystemctl start
commands:sudo systemctl enable postfix sudo systemctl start postfix
Task C. Install GitLab
-
Add the GitLab install repository via the
curl
command:curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
-
Install the GitLab package using the command below. Use your training system’s assigned public IP address in lieu of a fully qualified domain name. Make sure not to include the <> symbols.
sudo EXTERNAL_URL="http://<your_assigned_public_ip>" apt-get install -y gitlab-ee
This step may take a few minutes to complete. For this example, we added
https://
to the front of the URL. For this set of labs, we are using thehttp
protocol. If you are installing GitLab in a production environment, it is recommended to usehttps://
to use thehttps
protocol.
Task D. Login and reset password
-
During installation, a password is randomly generated and stored for 24 hours in
/etc/gitlab/initial_root_password
. To view the generated password, use the command below:sudo cat /etc/gitlab/initial_root_password
-
Copy the password shown in the output to your clipboard.
-
Using a web browser, navigate to
http://<your_assigned_public_IP>/
. -
To log in, type in
root
as your username, and the password copied previously for your password. -
Once logged in, in the upper left corner of the GitLab landing page, select your root user avatar, then Edit Profile.
-
In the left navigation pane, select Password.
-
In the Current password text box, enter the temporary root password used for initial login.
-
Complete the remaining fields with a new, permanent password of your choosing.
-
Click Save password to save the changes. You will be logged out, and will need to sign in again with your new password.
Lab Guide Complete
You have completed this lab exercise. You can view the other lab guides for this course.
Suggestions?
If you’d like to suggest changes to the GitLab System Admin Hands-on Guide, please submit them via merge request.
ac0e3d5e
)