Skip to content
www.mytechnote.ru
Menu
  • Administration
    • Scripts
  • Equipment
    • Reviews
    • Instructions
  • Other
  • English
    • English
    • Русский
Menu

Step-by-step Guide to Setting Up a GitLab Server on Ubuntu 16.04

If you’ve ever dabbled in scripting, configuration, or programming, understanding the importance of a version control system like GitLab is crucial. With platforms like GitHub available for public projects, what happens when you want a private repository? Enter GitLab, your solution for hosting private git repositories.

Why Consider GitLab for Your Projects?

GitLab offers a unique space for those who wish to maintain the confidentiality of their codebase while still enjoying the benefits of git repositories.

Setting up GitLab on Your Ubuntu Server

Preparing the Ubuntu Server

Start with a fresh installation of Ubuntu Server 16.04. Ensure you have superuser privileges with:

sudo su

Installing Necessary Dependencies

To facilitate the GitLab installation, download these essential packages:

apt install ca-certificates curl openssh-server postfix

When configuring postfix, ensure your server’s domain name is correctly set, especially if it’s publicly accessible.

ubuntu terminal, entering domain name during installation of postfix

Installing and Configuring GitLab

Download the GitLab repository setup script and execute it:

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

Follow this with the actual GitLab installation:

apt install gitlab-ce

Domain Configuration for GitLab

Correct your server’s domain with:

nano /etc/gitlab/gitlab.rb

Ensure the external_url points to the correct address.

ubuntu editing gitlab domain name in gitlab.rb with nano editor

Update, then initiate server configuration with

gitlab-ctl reconfigure

Make sure you’ve opened ports 80 (HTTP) and 22 (SSH) in your firewall.

Accessing GitLab and Setting Up Your First Repository

You can now access GitLab through its web interface using the domain name or server IP. On your first login, set up the administrator’s password and use the default username, root, to sign in.

gitlab web interface - setting up root password during first login

first login to gitlab with root account

Create your first project by clicking “New project”, and follow the on-screen instructions.

gitlab web interface main page

gitlab creating the first project

How to Generate and Integrate SSH Keys

Y’ll see a message, that SSH key should be added.

gitlab page after new project creation. SSH key warning.

Use the command:

ssh-keygen -t rsa -C "name@test.test" -b 4096

This command generates an RSA key pair. The -C flag is for your email, providing a label for the key.

During the process, you’ll be prompted for a location. Remember this, especially the public key’s location (with .pub extension).

Copy the contents of your public key and paste it into GitLab’s SSH Key section.

entering ssh key to gitlab form in web interface

Test the Connection

After setting up a repository, pull it, add files, commit changes, and push them to the server.

git clone git@git-test.mytechnote.ru:root/test.git
cd test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Refresh your GitLab project page, and you’ll see the updated repository.

changed gitlab project

Final Thoughts

With GitLab on Ubuntu 16.04, you have the power to create and manage private projects. Follow this guide to ensure smooth setup and configuration.

In future, when you will update your GitLab server, I suggest you to read this post.

Posted on 26.06.201730.05.2024 by sanglyb

Post navigation

← Customize Your Windows Start Menu: Bringing Back the Control Panel & More
HyperV performance monitoring. →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Подписывайтесь

Youtube
vk
telegram
github
twitter
rss
  • Форум
  • Об авторе
  • Поддержать автора

Популярные записи

Новые записи

  • How to Extend an LVM Partition in Linux
  • SCCM Reporting Errors After Migrating from SQL Server 2016 to 2019
  • Problem Using PassFiltEx on Older CPUs
  • How to remove attachments from old calendar events in Exchange using a script
  • How to download and install Office 2024 LTSC

Архивы

  • 2026 (3)
  • 2025 (5)
  • 2024 (7)
  • 2023 (30)
  • 2022 (4)
  • 2020 (17)
  • 2017 (82)
  • 2016 (5)
© 2015-2026 www.mytechnote.ru
Использование материалов сайта возможно только с разрешения владельца или обязательна индексируемая, прямая, передающая вес ссылка на материал.