Installing PyGopherd on Ubuntu 20.04
Published: 04-07-2020 | Author: Remy van Elst | Text only version of this article
Ubuntu 20.04 dropped the Pygopherd package. There is no way to install it from
the official repositories. In this guide I'll show you two ways to install the
version from Ubuntu 18.04, which still works perfectly on 20.04. Either via
just downloading the 2 deb packages, or via
apt pinning from the previous
repository. Ubuntu removed the package as seen here because it's not
in the current debian development release, due to debian removing all python 2
packages and their dependencies. IMHO that's stupid, but that is a discussion
for another time. The author of Pygopherd in the bug report says he is
working on a python 3 port, but as of now it's not in 20.04.
Here is a screenshot of the Castor browser showing my Ubuntu 20.04 server serving gopher pages via pygopherd:
Pygopherd is a gopher server written in python, as the name suggests. I use it to provide this website over gopher as well as over http. I've even written a log analyzer to get some statistics for pygopherd. Gopher is a protocol predating 'the web', a simple document (mostly text only) oriented protocol, which has seen a resurgence as of the last years because people are not happy with the current state of 'the web'. See also Gemini.
I recently came across Castor, a graphical client for Gopher and Gemini, for Linux, Windows and Mac OS X. Lynx is nice, but new shiny stuff is also fun to play with.
The easiest one off way is to just grab the
.deb packages from Ubuntu 18.04,
both pygopherd and python-simpletal. Download the files from the
two links to your server and use the following command to install them:
dpkg -i python-simpletal*.deb dpkg -i pygopherd*.deb
You might also need python2:
apt install python2 apt -f install
Start the server up and you're ready to go on port 70:
systemctl enable pygopherd systemctl restart pygopherd
Since it's just two packages without complicated dependencies this route is fine. If you want to use apt and also receive updates to this package, you might want to consider the next method (pinning).
Apt (the package manager) provides a way to handle multiple repositories that provide the same packages, named pinning. You add all the repositories, the one for the current ubuntu version is the default with the highest priority (all the packages will come from there by default), and all the packages you want from other repositories you add to a configuration file.
Lets gets started. Add the Ubuntu 18.04 repositories to your 20.04
Choose a mirror you like, I used this one close to me. Both our packages are
universe, therefore I just add that, not the rest of the repo's:
deb http://ams3.clouds.archive.ubuntu.com/ubuntu/ bionic universe deb http://ams3.clouds.archive.ubuntu.com/ubuntu/ bionic-updates universe
Do not apt update yet!.
Add a preferences file in which we tell apt to only install pygopherd from this older repository:
Add the following:
Package: * Pin: release n=focal Pin-Priority: -10 Package: pygopherd Pin: release n=bionic Pin-Priority: 500
The topmost block tells apt to use the default 20.04 (focal) repositories for all packages, the last blocks tell apt to use the older repository for our specific package.
Check that the system does not know about pygoherd yet:
apt-cache policy pygopherd
N: Unable to locate package pygopherd
You can now update the apt cache:
Afterwards, check that apt now knows about it in the repo:
apt-cache policy pygopherd
pygopherd: Installed: (none) Candidate: 188.8.131.52 Version table: 184.108.40.206 500 500 http://ams3.clouds.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages 100 /var/lib/dpkg/status
You can now use apt to install pygopherd:
apt install pygopherd
The python dependency will be installed as well:
The following NEW packages will be installed: pygopherd python-simpletal
Thats all there is to this method. The advantage is that you use the package manager for everything and also receive updates if they ever arrive.Tags: apt , debian , dpkg , gemini , gopher , linux , pygopherd , server , tutorials , ubuntu