Today, I will guide you for making your own Git server with Raspberry Pi device.
If you are associated with the field of developing and programming, then you may well aware about the GitHub which is the popular Git repository monitor. If you are a beginner in programming or do not know about GitHub, read the brief info about it below.
What is GitHub?
A versioning software called as Git is used for operating a web service known as GitHub. Here, a user can create a Wikipedia for a project guideline, can have various management tools, can track the bugs in software or application, and can even host a programming project. It is one of the biggest code-sharing platforms in the globe.
Why Gitlab on Raspberry Pi?
Though GitHub is potentially useful for the coders and hosting needs, it still has some drawbacks which lead to creating a personal Gitlab Raspberry Pi server.
- GitHub is not an open source platform itself which may not be liked by many users.
- In the free version of GitHub, your codes are accessible to all the users using this web service.
- GitHub itself does not host the data for your project or other info. It depends on third-party hosting sites to do that.
The main reason for using Gitlab to make GitHub server on Raspberry Pi is that it allows using all the functions of GitHub as well as helps to have a self-hosting on Pi device. Also, the Gitlab is an open source and free software which offers a quick installation for even the latest and fastest Raspberry Pi 3.
How to Create a Gitlab Server with the Raspberry Pi
Before going through the step-by-step process of making a Gitlab Raspberry Pi server, lets’ look at the things you will need for this project:
- A Raspberry Pi board (Pi 3 recommended)
- Pi compatible power supply
- Ethernet cable or a USB WiFi adapter (if you don’t have Pi 3)
- A Micro SD card (16GB recommended)
- USB keyboard and mouse
- A Raspberry Pi display
- Protective case (optional)
Installing Gitlab on Raspberry Pi is not as difficult as many users think. In fact, if you follow the right path, it is straightforward. Let’s see it below:
Step-1: Install the packages
Before installing the server itself, you need to get some needed packages on your Pi.
1. Open the Raspberry Pi terminal
2. Enter the command below
sudo apt-get install curl openssh-server ca-certificates postfix apt-transport-https
3. After the postfix software installed on the device, click on ‘Ok’ to continue
4. In the next postfix configuration screen, choose ‘Local Only’ option to get an easy setup process. If you want to get emails from the server, then choose the option of ‘Internet Site’ from the list
5. Select ‘Ok’ and press the ‘Enter’ key to continue
6. Now, the mail utilization screen will open. If you want to utilize emails, then enter the domain name (for ex. If the mail id is [email protected], then enter domain.com at the ‘system mail name’) for that and if you don’t want to do this, then just write RPi and click on ‘Ok’ button
Step-2: Install key to encrypt Pi
After the above process finishes, you will need to install the GNU privacy guard key which will help to encrypt the Raspberry Pi. It will also allow making easier communication with the servers.
- Open the command terminal and enter the command
curl htps://packages.gitlab.com/gpg.key | sudo apt-key add –
- Wait until the process finishes. Once completed, enter the command below to run the script
sudo curl -o /etc/apt/sources.list.d/gitlab_ce.list “https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/config_file.list?os=debian&dist=jessie” && sudo apt-get update
Step-3: Install Gitlab on Raspberry Pi
Now, it is the time to install the Gitlab server community edition itself on the Pi device.
- Enter the command below to install Gitlab server on Pi
sudo apt-get install gitlab-ce
- As the download is about of 150MB, wait for it to finish
- After that, you will need to setup the server and finish the installation of the needed database. Enter the command below to do that
sudo gitlab-ctl reconfigure
Step-4: Create the Gitlab account
Now, you will need to finish the configuration and set up the Gitlab account on the server.
1. Get the Raspberry Pi IP address using the command terminal
2. Open the web browser on Raspberry Pi
3. Enter the IP location of your Pi and then set up your Gitlab account
4. When you are setting it up for the first time, you will be asked to reset the password, and then you will be redirected to the login screen. So, enter the credentials and login to your account
5. Enjoy the Gitlab server on Pi and put your data and projects there
Once, you setup Gitlab server on Raspberry Pi, start doing your first project and list them in the Gitlab. Here, you can code, test the program, and then can deploy it by following an easy process.
Share your thoughts on this guide and your experience with the Gitlab on Raspberry Pi setup.