0% found this document useful (0 votes)
14 views4 pages

gitlab_installation

This document provides a comprehensive guide for installing and configuring GitLab on a Linux-based system, detailing system requirements, installation steps, and optional configurations such as SMTP settings and Docker installation. It includes commands for installation, user management, and GitLab Runner setup for CI/CD. Additional resources and links to official documentation are provided for further assistance.

Uploaded by

killianjohns938
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

gitlab_installation

This document provides a comprehensive guide for installing and configuring GitLab on a Linux-based system, detailing system requirements, installation steps, and optional configurations such as SMTP settings and Docker installation. It includes commands for installation, user management, and GitLab Runner setup for CI/CD. Additional resources and links to official documentation are provided for further assistance.

Uploaded by

killianjohns938
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

NetOps (DevOps for Network Engineers):

Automating Networks
***** Step 1. Installation Preparation *****

- Latest Installation Documentation:


https://docs.gitlab.com/ee/install/
- System Requirements:
https://docs.gitlab.com/ee/install/requirements.html
Note. Gitlab is developed for Linux-based operating systems. It does not run on Microsoft Windows, and we have
no plans to support it in the near future.
Minimum Requirements: 2 vCPU, 8GB RAM, 50GB HDD

***** Step 2. GitLab Installation *****

- Latest Installation Documenation:


https://about.gitlab.com/install/#ubuntu
- Ubuntu Installation:

$ sudo apt-get update


$ sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

(recommend setting up external DNS and make sure ports are opened)

$ sudo apt-get install -y postfix


$ curl --silent "https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh" | sudo bash
$ sudo apt-get install gitlab-ee

$ sudo vim /etc/gitlab/gitlab.rb

Change
external_url 'https://gitlab.com/'
external_url 'http://x.x.x.x/'

- Initial Password

$ sudo cat /etc/gitlab/initial_root_password

- Modify ‘Open Registration’ to more restrictive settings if desired: Menu -> Admin -> Settings ->

General -> Sign-up restrictions

NetOps (DevOps for Network Engineers): Automating Networks 1 of 4


- Change root password:

Click on user icon on top right hand corner -> preferences -> password

- (Optional) Create separate user: Menu ->

Admin -> Users -> New User

- (Reference) For starting and stopping:

$ sudo gitlab-ctl stop


$ sudo gitlab-ctl start

- (Reference) Uninstall (If needed)

$ sudo gitlab-ctl uninstall


$ sudo gitlab-ctl cleanse
$ sudo gitlab-ctl remove-accounts

***** Step 3. (Optional) Configure GitLab SMTP *****

- Demonstration available in Section 2.

- Steps after Installing GitLab:


https://docs.gitlab.com/ee/install/next_steps.html
- SMTP Settings: https://docs.gitlab.com/omnibus/settings/smtp.html

- Modify the settings in /etc/gitlab/gitlab.rb

$ sudo vim /etc/gitlab/gitlab.rb


...
gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = “smtp.sendgrid.net”
gitlab_rails[‘smtp_port’] = 587
gitlab_rails[‘smtp_user_name’] = “<username>”
gitlab_rails[‘smtp_password’] = “<password>”
gitlab_rails[‘smtp_domain’] = “smtp.sendgrid.net”
gitlab_rails[‘smtp_authentication’] = “plain”
gitlab_rails[‘smtp_enable_starttls_auto’] = true

gitlab_rails[‘smtp_tls’] = false

gitlab_rails[‘gitlab_email_from’] = ‘[email protected]
gitlab_rails[‘gitlab_email_display_name’] = ‘Admin’
gitlab_rails[‘gitlab_email_reply_to’] = ‘[email protected]
...

$ sudo gitlab-ctl reconfigure

***** Step 4. Install Docker (For GitLab Runner) ***** - Caution for

Production:

GitLab strongly advice against installation GitLab runner on the same machine GitLab is installed on.

NetOps (DevOps for Network Engineers): Automating Networks 2 of 4


- Install Docker Engine:
https://docs.docker.com/engine/install/ubuntu/
$ sudo apt-get update
$ sudo apt-get install \
> ca-certificates \
> curl \
> gnupg \
> lsb-release

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-


archive-keyring.gpg
$ echo \
> “deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

$ sudo apt-get update


$ sudo apt-get install docker-ce docker-ce-cli containerd.io

- Test Docker Engine

$ sudo docker run hello-world

- Run Docker as non-root user

$ sudo groupadd docker


$ sudo usermod -aG docker $USER
$ newgrp docker
$ docker run hello-world

- Install Docker Compose

$ sudo curl -L “https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-


$(uname -m)” -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose $ docker-
compose --version

***** Step 5. Configure GitLab Runner for CI/CD *****

- Demonstration available in Section 2.

- GitLab Runner:
https://docs.gitlab.com/runner/
- Run GitLab Runner in a container:
https://docs.gitlab.com/runner/install/docker.html

$ docker run --rm -t -i gitlab/gitlab-runner --help

$ docker run -d --name gitlab-runner --restart always \


> -v /srv/gitlab-runner/config:/etc/gitlab-runner \
> -v /var/run/docker.sock:/var/run/docker.sock \
> gitlab/gitlab-runner:latest

NetOps (DevOps for Network Engineers): Automating Networks 3 of 4


- Register Runner https://docs.gitlab.com/runner/register/index.html#docker

1. Retrieve registration Token Menu -> Admin -> Runners -> Register an

instance runner 2. Register

$ docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/ gitlab-runner register

Example:

Enter the GitLab instance URL (for example, https://gitlab.com/):


https://<url>/
Enter the registration token:
<your token>
Enter a description for the runner:
[41c02d02a86a]: local-runner-1
Enter tags for the runner (comma-separated):
<leave empty, press enter>
Registering runner... succeeded runner=bJqrmspz
Enter an executor: virtualbox, docker-ssh+machine, kubernetes, docker-ssh, parallels, shell, ssh, custom,
docker, docker+machine: docker

Enter the default Docker image (for example, ruby:2.6):


ubuntu:latest
Runner registered successfully. Feel free to start it, but if it’s running already the config should be
automatically reloaded!

***** Step 6. (Optional) Add SSH Key & Test Project *****

- Demonstration available in Section 2.

- Add SSH Key

User -> Prerences -> SSH Keys

- Launch Test Project

Menu -> Projects -> New Project

NetOps (DevOps for Network Engineers): Automating Networks 4 of 4

You might also like