How to Build Your Own Raspberry Pi Home Server (Part 1)

People sick and tired of the big data companies peeking to the their privacy for datas -ads, etc..-. The web pages are using our browser cookies, the apps track us while using their apps and even some apps wants to track us what we do in other apps to gives us “better ads”. The manipulation of humans are very easy today because the big data companies know you better than your partner[1]. Facebook, twitter, etc. know your mood by your “likes” or “retweets”.The cloud services something like dropbox, google drive, Microsoft One Drive etc. are widely used for the purpose of documents, photos or whatever the people need to store. But, how can you be 100 % sure that this companies are not digging your files, artificial learning algorithms are digging your photos? Home servers are one of the best solution for this problems. We don’t need to forget that even big companies with many firewalls can be hacked, our home servers are not 100% unhackable systems. But there are also solutions for this problem.

Nextcloud : Alternative of Dropbox, Google Drive, One Drive etc…
Bitwarden :
Alternative of 1Password, LastPass, Keeper Password Manager etc…
Airsonic :
Alternative of Spotify, Youtube Music, Apple Music etc…
Plex :
Alternative of Streaming Services,
Code-Server :
Environment Setup for Coding.

Prometheus can be used for monitoring purposes, because we may want to see the temperature of the Raspberry, Remaining Disk Space, Bandwith usage, available ram informations etc.. Nginx is used for reverse proxy management to hide the ip address for attacking and get the server on-line to reach the services what we want to reach globally.

1.1 – What is Raspberry Pi?

Raspberry Pi is a credit-card size affordable computer which is produced by Raspberry Pi Foundation. It has GPIO pins which enable to control the sensors or motors for the projects.While I am writing this article, the latest version of the raspberry pi is 4. Raspberry Pi 4 has three different versions which are 2GB, 4GB and 8GB. Some of people like me also uses raspberry pi for home server. Personally, i prefer raspberry as a server because of the low energy consumption. You know, a server will run 24/7 and 365 days and the energy consumption is significant for the cost of the server and cleaner environmental impact.

9592691097650
Raspberry Pi Zero
Raspberry Pi 4

1.2 – Eqipments for RPi-Server

  • Raspberry Pi 4 with original adapter.
  • Cat5 or Cat6 (LAN) Cable
  • A Cooler. (Recommended)
  • Sata SSD. (Recommended)

I always found confusing “Install this, click that. OK. Done!” logic. So, I’d like to draw a scheme in figure 1.2 that what is the roadmap for reader to understand the pathway. If you never dealed with a server, probably you don’t know the steps, or you will feel confusion at the settings phase.

Figure 1. 2. RoadMap

2 – INSTALLATION

The installation may be divided into two path. SD card + USB or SSD. The process will be will follow with SSD because it is more detailed. Raspberry Pi boots from SD card automatically. If SSD will be used for booting and operating, we need to update firmware if it is not updated.

2.1 Preparing SD Card

Raspberry Pi Imager is very beautiful software for bootable SD Card. After Installation of Raspberry Pi Imager, we need to choose;

  • Operating Systems: If Raspberry Pi is 4GB or less, use 32-Bit. If it is 8GB, 32-Bit OS can’t handle to address the whole RAM. So, we need to install 64-Bit OS to use all ram.
  • Choose Storage: Choose your SD or SSD (if firmware is updated).

Before Clicking Write Button, Ctrl + Shift + X combination pops up the advanced options because we need to arrange SSH connections.

Figure 2.1 Raspberry Pi Imager Advanced Settings with the Key Combination CTRL + SHIFT + X

  • Click Write. And wait for the end of the process.

SD Card is mounted and Raspberry Pi is working now. Find the ip of the raspberry pi with using the interface of the rounter and make an ssh connection with using Command Window (cmd) or Terminal.

Update and Upgrade the System with these two commands.

$ sudo apt update
$ sudo apt upgrade

2.2 Firmware Update

The system firmware need to be check the current and lates version numbers.

$ sudo rpi-eeprom-update

Figure 2.3. Raspberry Pi EEPROM Check

$ sudo apt install rpi-eeprom
$ sudo reboot

Figure 2.3 is an example of that eeprom is latest and not need to be upgraded but your version may be different so you need to continue with upgrading eeprom and reboot it.
NOTE: if you still have a boot problem with usb devices, you can change the boot order to 0xf41 with following command.

$ sudo -E rpi-eeprom-config --edit

The meaning of the boot order codes.
1 = Check SD Card
4 = Check USB Drive
f = Start Again

2.3 Providing Static IP From Router to Raspberry Pi

The router assignes dynamic ip to the clients. In every boot the Raspberry Pi will have different IPs. The user need to check everytime for connections. Because of this problem, -yes this is a problem – Raspberry need to be assigned static ip. I recommend to use raspberry with a ethernet cable so the interface is eth0.

$ sudo nano /etc/dhcpcd.conf

This code opens a config file which is need to be changed. Remove # to activate the lines.

# Example static IP configuration:
interface eth0
static ip_address =192.168.X.X/24
#static ip6_address=fd51 :42f8:caae:d92e::ff/64
static routers =192.168.1.1
static domain_name_servers =192.168.1.1 8.8.8.8

Change X values for desired IP values and don’t forget to arrange your router ip address.

static ip_address =192.168.X.X/24
static routers =192.168.1.1
static domain_name_servers =192.168.1.1 8.8.8.8

This are the end of the Installation process. Now We will continue with Package Installations in the next article.

This article is also preparing as a PDF file. It will be published when it is ready.

References:
[1] – Frank Luerweg. The Internet Knows You Better Than Your Spouse Does. https://www.scientificamerican.com/article/the-internet-knows-you-better-than-your-spouse-does/. Accessed: 2022-01-30.
[2] https://tr.wikipedia.org/wiki/Raspberry_Pi#/media/Dosya:Raspberry_Pi_4_Model_B_-_Side.jpg

This Post Has One Comment

  1. Tucci

    Thank you, this information is useful.

Leave a Reply