🔌 Installing and configuring NUT (Network UPS Tools) for your home lab

📆 2025-06-28 13:20

Do you have an UPS ? And a home lab? Awesome. This post is about configuring all your servers, raspberry pi's and even your gaming PC to shutdown gracefully in the event of a power outage.

The thing is that you can plug in the power cord for multiple devices in your UPS but, usually, an UPS comes with 1 data cable and, wait for it, a Windows application. With the USB data cable the UPS communicates with only one computer.

To connect all your computers/servers to the UPS you are going to install Nut. Also known as Network UPS Tools.

What is Nut

It's an open UPS networking monitoring tool that runs on many different operating systems.

This means you can run the server on Linux, MacOS, or BSD and run the client on Windows, MacOS and Linux. It works well for your Raspberry Pi, server, or desktop.

It works with a lot of UPS devices, PDUs and many other power management systems.

Visit Network UPS Tools website

Setting up the hardware

It's easy. Plug your UPS into an power outlet, plug all your devices power cords into the UPS, connect it's data cable to the server or whatever device you know you'll choose to shutdown last. SSH into it and

Install Nut Server and Nut Client

I have an Ace Magician Tiny PC which is also the cluster leader. I chose this one to be the leader and the last pc to shutdown in case of a power outage because it draws the smallest amount of power. So I connected the UPS to it. This tiny pc will have both the NUT server and NUT client installed on it.

Locate UPS and setup driver

make sure the UPS is shown:

If your UPS shows up you can

Use nut-scanner to scan for the UPS

You should get something like:

Copy vendorit and productid as it's needed in the next step.

Configure Nut Server and Client on the connected PC with USB cable

sudo pico /etc/nut/nut.conf

sudo pico /etc/nut/ups.conf

sudo pico /etc/nut/upsd.conf

sudo pico /etc/nut/upsd.users

sudo pico /etc/nut/upsmon.conf

sudo pico /etc/nut/upssched.conf

sudo pico /bin/upssched-cmd

Remember to make it executable

We're done setting up the main computer ( the one connected to the UPS with the USB data cable) !

Setting up NUT client on network computers / workers

I have 3 Lenovo M53's and 1 Lenovo ThinkStation P510 as workers of my cluster. A 5 port switch is also plugged in and connects the Lenovo's to my main router.

🗄️ My Cluster information

I chose to shutdown these network computers/workers if the UPS is running on battery for 2 minutes and mains power did not return or the communication to the UPS has been lost for 2 minutes. This way I keep most of my UPS battery charge for my modem, router, switch and Ace Magician/Master.

sudo pico /etc/nut/nut.conf

sudo pico /etc/nut/upsmon.conf

sudo pico /etc/nut/upssched.conf

sudo pico /bin/upssched-cmd

What happens when a power outage occurs

My UPS battery can keep my cluster online with all computers, modem, switch and router turned on for about 15 minutes. If I shutdown the 3 Lenovo M53's and the P510 after 2 minutes, the battery can hold my Ace Magician Tiny, modem and router for about 35 minutes.

What NUT client does on the computer connected to the UPS with the data cable

Power goes down. What NUT server does:

What NUT client does on the other connected devices

Here's a diagram on how my cluster is connected and behaves in case of a power outage.

Be sure to click the image that coresponds to your light/dark preference.

Cluster diagram [light]

Cluster diagram [dark]

I've also created a GitHub repo containing all these files.

Nut Config on GitHub/SavaAlexandruStefan

It may be easier for you to just clone the repo and copy the files to /etc/nut/

🚶 Back to my blog

The page https://sava.rocks/blog/installing-and-configuring-nut-network-ups-tools-for-your-home-lab/ is served from my cluster by tiny and available on 2 other protocols:
Gemini:
gemini://sava.rocks/blog/installing-and-configuring-nut-network-ups-tools-for-your-home-lab/
Gopher:
gopher://sava.rocks/1/blog/installing-and-configuring-nut-network-ups-tools-for-your-home-lab/
How can you reach these protocols ?
It's simple. Details are found here for gopher and here for gemini on Wikipedia.
Website Meta
text/gemini
Mastodon