Introduction
Introduction Statistics Contact Development Disclaimer Help
### Setting up a gopher server on a RaspberryPi B+ ###
Until now, my gopher was running on a full-blown Debian server (that was also
tasked with a few other things). I decided to terminate this server due to
maintenance cost, and pondered about shutting down the gopher service as well,
after 12 years of solid service. But before doing so, I thought I'd try
running it at home on some cheap RPi box. If it proves not to be too flaky
or time consuming, I might leave it on for another 12 years or so.
I have a few RPis laying around. For this gopher hosting task, I decided to
go with the oldest one: a Raspberry Pi B+ from 2014. I chose this one mostly
out of concern for power consumption - according to benchmarks found on the
internet, all newer RPis have a higher consumption, even at idle time.
Besides, gopher being a tech from the '90, it needs no CPU power anyway.
I downloaded the latest available Raspbian release (took the "lite" variant,
in the hope it was indeed light - but it was not). The image I downloaded was
dated August 2020 and nicknamed "Buster" (/etc/debian_version says "10.4").
I made some minor changes to the boot/config.txt file:
arm_freq=100 (sets CPU speed to 100 MHz, should keep it cool and low-power)
gpu_mem=16 (limits GPU memory to minimum, 16 MB, so OS can use the rest)
I also created an empty "ssh" file in the boot partition of the SD card, for
enabling out-of-the-box ssh support.
Powered the RPi and... yes, it actually booted and allowed me to log in via
ssh using the default "pi" account.
Then, I tweaked the ssh and IP configuration:
/etc/ssh/sshd.conf -> enabled root login, disable password auth (and PAM)
/etc/dhcpcd.conf -> set up a static IP address
Since the distribution, despite claiming to be "lite", is kind of bloated, I
removed (apt-get purge) "some" packages that I didn't feel useful to me:
bluez bluez-firmware avahi-daemon dphys-swapfile dc logrotate libx11-6 ed
libx11-data libxau6 libxcb1 libxdmcp6 bind9-host geoip-database libdaemon0
libavahi-common-data libavahi-common3 libavahi-core7 libbind9-161 libdns1104
libfstrm0 libgeoip1 libisc1100 libisccc161 libisccfg163 liblmdb0 liblwres161
libprotobuf-c1 avahi-daemon bluez bluez-firmware libnss-mdns pi-bluetooth
firmware-atheros firmware-realtek firmware-libertas g++ lua5.1 luajit nano
manpages manpages-dev ncdu ntfs-3g parted pigz rpcbind rsync triggerhappy
alsa-utils fuse g++-8 libasound2 libasound2-data libbabeltrace1 libc6-dbg gdb
libdw1 libevent-2.1-6 libfftw3-single3 libfuse2 libluajit-5.1-2 libtirpc3
libluajit-5.1-common libnfsidmap2 libntfs-3g883 libparted2 libpython3.7 iw
libsamplerate0 libstdc++-8-dev libtirpc-common rsyslog curl wpasupplicant
xkb-data console-setup-linux libcurl4 libnghttp2-14 libnl-route-3-200 dbus
libpcsclite1 librtmp1 libssh2-1 man-db htop netcat-openbsd netcat-traditional
rfkill unzip wireless-tools wireless-regdb libiw30 zlib1g-dev libfreetype6
libdbus-1-3 v4l-utils libnl-3-200 libnl-genl-3-200 libpng-tools libpng16-16
libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libncursesw5
python3-urllib3 python3-six python3-requests python3-idna openresolv libv4l-0
libjpeg62-turbo libv4l2rds0 libv4lconvert0 python3-certifi python3-chardet
python3-pkg-resources libraspberrypi-doc gcc-5-base gcc-6-base gcc-7-base
libboost-iostreams1.58.0 libfastjson4 liblognorm5
And proceeded with a minor upgrade:
apt-get update
apt-get upgrade
apt-get dist-upgrade
Once all was done, the OS was taking about 1 GiB of SD space... Still way too
much to my taste, but I will leave it as it is for the time being. I can't
fight progress forever.
When configuring the network, I had set up the static IP by editing the
/etc/dhcpcd.conf file, as advised by Debian. Weird idea to configure a static
IP through a DHCP client if you ask me, but whatever works, right? Well, I
then noticed that the DHCP daemon was still listening on a UDP/68 socket:
root@raspberrypi:~# netstat -anup
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:68 0.0.0.0:* 280/dhcpcd
Not cool!
So I ended up doing it the good old way by adding a configuration file named
/etc/network/interfaces.d/eth0, and removed all DHCP clients:
apt-get purge isc-dhcp-client isc-dhcp-common dhcpcd5
Next, I downloaded the latest version of the Motsognir gopher server, built
it (make), configured it and copied all my gopher content to the RPi.
Finally, added a tmpfs-based /tmp in fstab and switched the partitions into
read-only mode to forbid the system to wear off the SD card.
Mounting / as read-only requires to pass a "ro" argument through the
/boot/cmdline.txt file. I added there "fastboot" as well, to disable boot-time
fsck checks (useless, since partitions are read-only anyway).
Final reboot. Done. Let's see how stable this setup will be.
You are viewing proxied material from gopher.viste.fr. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.