Setting up a test server on Raspberry Pi is a simple process that can be completed in minutes. By following these steps, you can create a working environment for testing your applications and services.
- Choose the right Raspberry Pi model The first step is to choose the right Raspberry Pi model. There are three different models available: the A+, B+, and C+. The A+ has more features and is recommended for beginner users. The B+ has a faster processor and is good for those who want to use more powerful applications. The C+ is the most advanced model and should only be used by experts or those who have special needs.
- Configure your computer Once you have chosen the correct Raspberry Pi model, it’s time to configure your computer to work with it. You will need to install Python, Raspbian, and MySQL before starting the testing process. Once theserequisites are installed, you can start the testing process by running the following command: # apt-get update # apt-get install python3 raspbian mysql
The Raspberry Pi started out as an inexpensive device to help students learn about computing, but the Raspberry Pi also makes for an inexpensive test server. With a server operating system on a Raspberry Pi, you can quickly set up a test server at home.
I recently decided to reinstall my Raspberry Pi 3B+ to use as test server for new web projects. My production environment is an Intel rack server running Red Hat Enterprise Linux, and so doesn’t really match the Raspberry Pi at the hardware level. But at the application layer, Linux on Raspberry Pi is still “Linux,” Apache on Raspberry Pi is still “Apache,” and PHP 7 on Raspberry Pi is still “PHP 7.” As long as my Raspberry Pi is set up as a server, instead of a desktop-focused Linux distribution, my work on the Raspberry Pi will transfer pretty easily to my production environment with Red Hat Enterprise Linux on Intel.
While there is no Red Hat Enterprise Linux for Raspberry Pi, Fedora Server is close enough for my needs. I tried to install Fedora 33 ARM Server on the Raspberry Pi, but I couldn’t get wireless networking to work out of the box, despite a note on the Fedora ARM page that wireless networking is supported by default on Fedora 33. The problem seems to be that Fedora 33 ARM Server doesn’t include wpa_supplicant . However, I was able to get everything working by installing Fedora 33 ARM Minimal.
Download the Fedora 33 ARM Minimal image from the Fedora ARM website. You can find the download location in the wiki. Specifically, to install Fedora 33 Minimal on the Raspberry Pi 3, you will need to download Fedora-Minimal-33-1.3.aarch64.raw.xz from the aarch64 supported image for Raspberry Pi 3.
Once you have the Fedora 33 Minimal image, you can install it to a microSD card to boot on the Raspberry Pi later. On your Linux workstation or server, plug in your microSD card, and run this command:
That command writes the Fedora 33 Minimal image to the microSD card. My Linux desktop PC doesn’t have a built-in microSD slot, so I used a USB microSD card reader, which presents the microSD at /dev/sdb . Depending on your system, you might need to use a different media target device.
Installing Fedora 33 Minimal to the microSD essentially dumps a pre-installed image to the card. You’ll need to do all the configuration afterwards when you boot the microSD in the Raspberry Pi for the first time.
Connect your Raspberry Pi to an HDMI display and USB keyboard, plug in the microSD, and power it on. The first boot will take a while while it does some initial setup tasks, during which Fedora will prompt you for local settings including time zone, root password, and user account.
Once my system was up and running, I was able to login as the root user. Since I don’t have a network cable long enough to reach this Raspberry Pi, I needed to set up wireless networking. At the command line, run the Network Manager command line tool nmcli to list the available wireless networks:
If nmcli finds your wireless network, then connect to it with this nmcli “connect” command. Replace $SSID with your wireless network name:
After that, Network Manager automatically creates an entry for you under the /etc/NetworkManager/system-connections directory, so the system will connect to this network every time you boot the Raspberry Pi.
Since I run the Raspberry Pi is running as a server on my home network, I also need to ensure the Raspberry Pi gets the same IP address every time it connects to the network. On a home network, you can do this through your wireless router. Most routers let you recognize a MAC address and assign it a reserved IP address. My home router gives out IP addresses starting at 10.0.0.100, so I gave the Raspberry Pi a reserved IP address below that range, at 10.0.0.11:
I find the easiest way to manage my Linux systems is with the Cockpit tool. Cockpit makes it easy to pilot your Linux servers via a web browser, allowing you to view logs, manage storage, set up user accounts, and install services. Fedora 33 ARM Minimal doesn’t install Cockpit by default, but you can easily install it as a package using dnf :
Once you’ve installed Cockpit, you need to ensure the Cockpit service is running, and will get restarted whenever you reboot the system. Fedora uses systemd , so you need to start the service and enable it for each reboot with these two “system control” commands:
Fedora’s default firewall will prevent connections to your device, so you also need to open the port on the local firewall to accept connections to Cockpit. You can add the Cockpit service using the firewall-cmd command line tool:
Now you should be able to navigate your web browser to https://10.0.0.11:9090/ to control your Raspberry Pi remotely.
With Cockpit, you can complete any other system setup tasks that you need. To finish setting up this Raspberry Pi as a web server, I installed the Apache httpd web server and PHP 7, then used Cockpit to configure everything to match my production system as closely as possible:
You don’t need an expensive server to set up a robust test server environment. With a server operating system like Fedora 33 ARM Minimal, you can quickly set up an inexpensive test server at home on a Raspberry Pi. And with Cockpit, you can manage everything right from your browser.