Transforming a Bicycle into a Motorcycle – Building a Personal Server!

Source: WeChat Official Account 【Osprey Talks Microcontrollers】

Author: Osprey

ID: emOsprey

Introduction

Recently, I set up a personal server at home. With the home broadband, I decided to build a server, YYDS (forever). I used a Raspberry Pi 3B+, with a 16GB (TF card) + 1GB configuration, but after adding various functions, it became clear that it was insufficient.

Therefore, I planned to upgrade the server using Raspberry Pi 5. The configuration is as follows:

  • 2.4GHz Quad-core 64-bit Arm Cortex-A76 CPU

  • VideoCore VII GPU, supports OpenGL ES 3.1, Vulkan 1.2

  • Dual 4Kp60 HDMI display output

  • 4Kp60 HEVC decoder

  • Dual-band 802.11ac wireless network

  • Bluetooth 5.0 / Low Energy Bluetooth (BLE)

  • High-speed microSD card interface, supports SDR104 mode

  • 2 × USB 3.0 ports, supports simultaneous 5Gbps operation

  • 2 × USB 2.0 ports

  • Gigabit Ethernet, supports PoE+

  • 2 × 4-channel MIPI camera/display interfaces

  • PCIe 2.0 x1 interface for fast peripherals

  • Standard 40-pin GPIO interface of Raspberry Pi

  • Onboard real-time clock (RTC)

  • Power button

I purchased 4GB of RAM (thinking it would be sufficient, but later found that GitLab’s memory usage was very high, so I had to optimize the configuration). The performance is 2-3 times better than the 4B, not to mention the comparison with my 3B+:

  • Quad-core 1.2GHz Broadcom BCM2837 64-bit CPU

  • 1GB RAM

  • Wireless LAN and Low Energy Bluetooth (BLE)

  • Ethernet

  • 40-pin GPIO expansion

  • 4 USB 2 ports

  • 4-pole stereo output and composite video port

  • Full-size HDMI

  • CSI camera port

  • DSI display port

  • Micro SD port for operating system and data storage

  • Upgraded switchable micro USB power supply, up to 2.5A current

It can be considered as transforming a bicycle into a motorcycle.

Functions + User Experience

The main functions of the server currently are as follows:

1. GitLab V14.6.1, where I organize all the code I develop for easy management, while using Gitee as a backup.

2. Added firewall UFW, SSH key remote login, closed port 22, changed to another port, disabled key login, ensuring login security.

3. Samba, a network resource sharing server at home (can also be used with Xiaomi TV, etc.), but this can only be used in the local area network, as the current port is blocked by the operator, and opening it is quite troublesome. So now I mainly use MobaXterm to log in and transfer files (this tool is quite powerful, supporting serial, SSH, etc., highly recommended).

4. Nginx, an open-source web server, which I mainly use to share some courses and resources from my WeChat official account (if I had set up this server earlier, I would have shared on my own server instead of using Baidu Cloud).

5. FRP, an internal network penetration tool, I plan to set up my own internal penetration server, so that some useful boards I develop can be accessed remotely.

6. DDNS dynamic domain service, currently I am using the free service provided by public cloud, so I can directly access my home server via domain name (although my home has a public IP, it is dynamic, so this is necessary). Dynamic domain service DDNS, YYDS (forever). Of course, the free service also has certain risks; previously, the f3322.net domain became invalid, and I had to change the domain. However, since my home router is TP-LINK and has been bridged, I can directly check my home IP address on the mobile APP (it is said that TP-LINK routers also have free DDNS services available, but I haven’t explored that in detail).

7. Automatic mounting of hard drives, I bought a 2TB hard drive, initially formatted as ext4, but due to possible errors when handling large files (copying a large number of files and then forcefully interrupting because I couldn’t wait, I recommend using rsync -a –info=progress2 to copy files, so you can see the progress bar), it frequently resulted in file loss. Considering the inconvenience of transferring files with Windows, I later formatted it to NTFS, but permission issues are not very friendly, so special configuration is needed for mounting in /etc/fstab:

proc                  /proc           proc    defaults          0       0PARTUUID=b85799d8-01  /boot           vfat    defaults          0       2PARTUUID=b85799d8-02  /               ext4    defaults,noatime  0       1UUID=FCEA-85D9        /u-disk         vfat    defaults,utf8,uid=1000,gid=1000,dmask=022,fmask=133,noatime,nofail,x-systemd.mount-timeout=2min  0 0UUID=B8CCD0FCCCD0B5BA /samba          ntfs    defaults,user,rw,iocharset=utf8,umask=000,nls=utf8,noatime,nofail,x-systemd.mount-timeout=2min 0 0UUID=8482362482361ADE /back           ntfs    defaults,user,rw,iocharset=utf8,umask=000,nls=utf8,noatime,nofail,x-systemd.mount-timeout=2min 0 0UUID=1c95153b-6f4a-4348-9f48-fbb9b08f1747 /gitlab-data  ext4    defaults,noatime,nofail,x-systemd.mount-timeout=2min 0 0
#check: sudo mount -a  # Use this command to check for errors after configuration to prevent mounting failure

Additionally, the hard drive may fail to mount. To ensure that our system can always run (for convenient remote login), we need to set a mounting timeout. Previously, there was an issue with the solid-state drive, and I couldn’t log in at all, and had to power cycle it. Considering that remote power cycling is inconvenient, I purchased a WiFi remote control socket, so in case of special situations, I can remotely restart it at any time.

8. TV Box

Xiaomi TV (other TV boxes are similar) can use the HD Player app to play movies, TV shows, music, and other resources in Samba, so family members can watch any movie they want by remotely placing it in the TV.

Transforming a Bicycle into a Motorcycle - Building a Personal Server! Life never stops, and neither does the tinkering.

Leave a Comment