In Part 7 of the tutorial we'll install Git and create a CI/CD user with dedicated pipeline ssh keys on our remote server.
It's recommended that you have read the previous steps of this course. You'll find the overview at the end of this blogpost.
14. Install Git on Remote Server
Install on remote server:
sudo apt-get update
sudo apt install git
15. Create CI/CD user and ssh keys for Gitlab on Remote Server
Create CI/CD group and user
First log into your remote server via ssh (see step 3 of this tutorial).
Add a new user called cicd:
sudo useradd -d /home/cicd -m -s /bin/bash cicd -G www-data
-m creates the home directory if it does not exist.
-d overrides the default home directory location.
-s sets the login shell for the user.
-G expects a comma-separated list of groups that the user should belong to in addition to the primary group.
Type in a password, then full name, leave everything else empty and confirm with Yes.
Check for all users on the system
Alternatively check with id cicd to see name, gid and groups created.
Generate ssh key for Gitlab on remote server
On remote server:
ssh-keygen -t rsa
Enter file path when asked:
Check if keys have been created:
Show public key:
Select the entire key, then copy key with cmd + c
Create the file authorized_keys:
Open file as sudo in nano text editor:
sudo nano authorized_keys
Paste key with cmd + v into the file nano authorized_keys
Save and close nano: ctrl + o, press enter, ctrl + x
You should now see the public key in the terminal:
The Course Syllable:
22.05.2021 – Part 1
- Introduction & reasoning
29.05.2021 – Part 2
- Create Hetzner Cloud Server
- Connect to Server
05.06.2021 – Part 3
- Update and upgrade Ubuntu installation and install apache2
- Install PHP
12.06.2021 – Part 4
- Establish ssh keys
- Add new sudo user
- Deactivate root user
- Make new sudo user owner of ssh service
19.06.2021 – Part 5
- Buy Domain and point it to Hetzner Server
- Create Virtual Host for domain
26.06.2021 – Part 6
- Get free Let's Encrypt SSL certificates
- Request certificate, active https and force SSL
03.07.2021 – Part 7
- Install Git on Remote Server
- Create CI/CD user and ssh keys for Gitlab on Remote Server
10.07.2021 – Part 8
- Create Gitlab Repository
- Establish ssh keys and configure CI/CD
17.07.2021 – Part 9
- Install MySQL
- Install phpMyAdmin
24.07.2021 – Part 10
- Summary of project development workflow
- I'll be back – The course update log
See you next week for more