X
Popular Searches

Set Up a Test Server on Raspberry Pi

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.

Installing Fedora ARM Minimal

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:

# arm-image-installer --image=Fedora-Minimal-33-1.3.aarch64.raw.xz --media=/dev/sdb --target=rpi3

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.

Connecting to Your Wireless Network

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:

# nmcli device wifi list
nmcli device wifi list command
Use 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:

nmcli device wifi connect $SSID --ask

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:

Assign the Raspberry Pi its own IP address

Installing Remote Management with Cockpit

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 :

dnf -y install cockpit

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:

# systemctl start cockpit
# systemctl enable cockpit.socket

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:

# firewall-cmd --add-service=cockpit --permanent
# firewall-cmd --reload

Now you should be able to navigate your web browser to https://10.0.0.11:9090/ to control your Raspberry Pi remotely.

Manage your system with Cockpit

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:

Managing httpd with Cockpit

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.

Jim Hall Jim Hall
Jim Hall is an innovative, high-achieving Senior IT Leader with over 25 years' experience in Linux, open source, and IT Leadership. He has contributed to dozens of open source projects as developer or maintainer, including FreeDOS and GNOME. Jim is also CEO at Hallmentum, where he empowers IT Leaders to drive meaningful change through hands-on training, workshops, and coaching. Read Full Bio »

The above article may contain affiliate links, which help support CloudSavvy IT.