Part 1 - Starting with Raspberry Pi + GitLab

This is the first post in the series of how to host your own git server on a Raspberry Pi

Since its original release in 2012, Raspberry Pi has been a key companion to developers around the world for automating software tasks and building low-cost networking projects. Its capabilities have grown significantly over the years, so much so that I have started to use my Pi to self-host a git server (GitLab) at home.

I am going on a journey to document how to set up a git server with all the tools you need on Raspberry Pi, so you can do the same in 2021 and beyond. Let’s start baking our pi…

What you will need:

Raspberry Pi comes in 2, 4, and 8 GB variants in 2021. Your git server would require a version with at least 4 GB of RAM, though I do recommend to get the Raspberry Pi 8 GB to get the most performance out of your system. For the SD card, you can pick up a Samsung Evo 64GB for $10. It is best bang for your buck option on the market in 2021. You also need to get a bundle of equipment to power your Pi and protect it from dust and heat. I got this Smraza Case Bundle, which came with a power cable and active cooling fan for $15. The total cost for this system will be something around $120.

1. Download Operating System

Raspberry Pi OS Lite and Ubuntu Server LTS are the two leading options in this space. Due to being a fast, stable and widely used 64-bit Operating System, we will use Ubuntu Server in this tutorial.

Ubuntu Server — Download Page for Raspberry Pi

You can get a copy of the latest version here — Ubuntu Server 20.04-LTS (64-Bit). This will download a compressed image for you to use in the next step.

2. Flash SD Card Image

Etcher - SD Card Flashing Tool

Select image > Select drive > Flash!

It will take several minutes for Etcher to flash and validate all files. Once done, proceed to the next step to edit some files on the SD card.

3. Edit WiFi Credentials (Optional)

Edit the ‘network-config’ file (no extension) in the SD card to look like the following, where <WIFI-SSID> and <PASSWORD> are the name (SSID) and password of the wireless network you plan to connect.

version: 2
ethernets:
eth0:
dhcp4: true
optional: true
wifis:
wlan0:
dhcp4: true
optional: true
access-points:
"<WIFI-SSID>":
password: "<PASSWORD>"

3. Boot!

Router - Network Client List

4. Assign Static IP

Router - DHCP Server (Manually Assigned IPs)

Your local static ip address range will be in the order of 192.168.X.X — You can see that I have assigned 192.168.1.2 to my PC, and 192.168.1.3 to my Pi (ubuntu).

You can also set the hostname for your devices at this step, which will allow you use a name to access your devices rather than typing the IP address. We will talk more about this in the next part of our series.

Once you are done, click Apply and give all your devices a reboot to make sure your new IP addresses fully propagate.

5. SSH into Pi

The authenticity of host '192.168.1.3 (192.168.1.3)' can't be established. ECDSA key fingerprint is SHA256:<SHA-KEY>.
Are you sure you want to continue connecting (yes/no)?

Type yes to approve and establish the connection. You will then need to enter the password for Pi, which is ubuntu by default.

Ubuntu will ask you to change your default password, follow the prompts as necessary. The next time you log in through ssh using the new password, your Pi will be ready to run some commands!

6. Update Pi

sudo apt update will update the package list.

sudo apt upgrade will install the packages from the updated list.

7. Set the Time Zone

Once you find the timezone you are in, run the following command:

sudo timedatectl set-timezone <TIMEZONE>

Once you are done, you can check if the date and time are set correctly by running the date command.

Congratulations — You have finished setting up your Pi! Next chapter is going to talk about creating user accounts and further customizing your Raspberry Pi.

You can follow my future articles on building Internet of Things devices and general chat regarding to life at Google at Baking Pi — An IoT Blog. :)

Systems Engineer, specialized in building Internet of Things (IoT) devices and applications. Harvesting crops at Google. 💻

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store