Following the installation of my little server, here is a brief overview of the “stack” used.
For my Pi, I didn’t go with the traditional Raspbian system. It works well, but I usually prefer to use Arch Linux for servers instead.
Arch Linux has several advantages:
- It is a lightweight distribution
- Arch only installs what is necessary, so you have more control over the software installed on your system.
- Arch Linux can be used in command-line mode, making it perfect for server environments where a graphical user interface (GUI) isn’t needed.
- Updating Arch Linux is easy and doesn’t require major version jumps with reinstallation of the entire system like some other distributions do.
In addition to the many packages available through the official Arch Linux repository, there is also the AUR (Arch User Repository). The AUR does not provide precompiled package files but rather source code that can be easily installed.
By the way, for your convenience when using AUR packages, I recommend you use yaourt instead of pacman, which is the default package manager. Yaourt directly pulls missing packages from AUR, simplifying the process.
To install yaourt, add the following repository to your /etc/pacman.conf file:
SigLevel = Never
Server = https://repo.archlinux.fr/$arch
Then update the package list:
and install yaourt:
pacman -S yaourt
To use yaourt just like pacman to update your system, simply run:
To install vim, for instance:
yaourt -S vim
The web server
For serving the pages, I don’t want to use Hugo’s built-in server for advanced features in the future (HTTPS and more). Therefore, I have decided to install NGINX.
yaourt -S nginx
Enable the service with systemctl:
systemctl enable nginx
systemctl start nginx
and the pages to publish must be stored in /usr/share/nginx/html.
The CMS : Hugo
Hugo is a fast and lightweight static site generator developed in Go. It has the advantage of being very quick and resource-efficient, making it perfect for a Raspberry Pi.
I chose to install Hugo from its sources so that I could contribute to the development of the tool (if only I had more time 😀 ). So we’ll need to start by installing Go, Git, and Mercurial:
yaourt -S go git mercurial
To define the location of Go sources and binaries (my Go tree will be at
$HOME/go; don’t forget to create the directory), you can add the following lines in your .bashrc file:
With Go handling Hugo installation and compilation along with its dependencies, you can use the following command to install Hugo from source:
go get -v github.com/spf13/hugo
And if everything goes well, a miracle: Hugo is installed!
Now all you need to do is follow the getting started guide to create your first website and deploy your pages into /usr/share/nginx/html. Enjoy !