How To Install apcupsd on CentOS 8

apcupsd is APC UPS Power Control Daemon

Introduction

In this tutorial we learn how to install apcupsd on CentOS 8.

What is apcupsd

Apcupsd can be used for controlling most APC UPSes. During a power failure, apcupsd will inform the users about the power failure and that a shutdown may occur. If power is not restored, a system shutdown will follow when the battery is exausted, a timeout (seconds) expires, or the battery runtime expires based on internal APC calculations determined by power consumption rates. If the power is restored before one of the above shutdown conditions is met, apcupsd will inform users about this fact. Some features depend on what UPS model you have (simple or smart).

We can use yum or dnf to install apcupsd on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install apcupsd.

Install apcupsd on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install apcupsd using dnf by running the following command:

sudo dnf -y install apcupsd

Install apcupsd on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install apcupsd using yum by running the following command:

sudo yum -y install apcupsd

How To Uninstall apcupsd on CentOS 8

To uninstall only the apcupsd package we can use the following command:

sudo dnf remove apcupsd

apcupsd Package Contents on CentOS 8

/etc/apcupsd
/etc/apcupsd/apccontrol
/etc/apcupsd/apcupsd.conf
/etc/apcupsd/changeme
/etc/apcupsd/commfailure
/etc/apcupsd/commok
/etc/apcupsd/offbattery
/etc/apcupsd/onbattery
/etc/logrotate.d/apcupsd
/lib/systemd/system-shutdown/apcupsd_shutdown
/lib/systemd/system/apcupsd.service
/sbin/apcaccess
/sbin/apctest
/sbin/apcupsd
/sbin/smtp
/usr/lib/.build-id
/usr/lib/.build-id/8b
/usr/lib/.build-id/8b/0e2c7670b3ebaabd55931b089d7a94cf6c8efa
/usr/lib/.build-id/9a
/usr/lib/.build-id/9a/01d0ddc7ce1db669f26757d543db641c3c8fc3
/usr/lib/.build-id/ab
/usr/lib/.build-id/ab/e3a11c5f820208d0d72d8c935aa58d9cc98697
/usr/lib/.build-id/b1
/usr/lib/.build-id/b1/7664aead80ee3f78fbe241f104e7929ba03de1
/usr/share/doc/apcupsd
/usr/share/doc/apcupsd/ChangeLog
/usr/share/doc/apcupsd/ReleaseNotes
/usr/share/doc/apcupsd/examples
/usr/share/doc/apcupsd/examples/Makefile
/usr/share/doc/apcupsd/examples/SmartUPS1400.snmp
/usr/share/doc/apcupsd/examples/client.c
/usr/share/doc/apcupsd/examples/gui
/usr/share/doc/apcupsd/examples/gui/about.tcl
/usr/share/doc/apcupsd/examples/gui/apcupsd.tcl
/usr/share/doc/apcupsd/examples/gui/dialog.tcl
/usr/share/doc/apcupsd/examples/gui/events.tcl
/usr/share/doc/apcupsd/examples/gui/mainwindow.tcl
/usr/share/doc/apcupsd/examples/gui/pkgIndex.tcl
/usr/share/doc/apcupsd/examples/gui/splash.tcl
/usr/share/doc/apcupsd/examples/gui/status.tcl
/usr/share/doc/apcupsd/examples/hid-set.c
/usr/share/doc/apcupsd/examples/hid-ups.c
/usr/share/doc/apcupsd/examples/hiddev.h
/usr/share/doc/apcupsd/examples/index.php
/usr/share/doc/apcupsd/examples/libusb.h
/usr/share/doc/apcupsd/examples/make-hiddev
/usr/share/doc/apcupsd/examples/megaclient.c
/usr/share/doc/apcupsd/examples/nagios_plugin_check_apcupsd.c
/usr/share/doc/apcupsd/examples/newslave.c
/usr/share/doc/apcupsd/examples/offbattery.cpufreq
/usr/share/doc/apcupsd/examples/onbattery.cpufreq
/usr/share/doc/apcupsd/examples/php-monitor.txt
/usr/share/doc/apcupsd/examples/rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-350-USB.rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-350ES.rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-500-USB.rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-500ES.rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-BR-800.rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-CS-650.rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-ES-550.rpt
/usr/share/doc/apcupsd/examples/rpt/Back-UPS-XS-1300-LCD.rpt
/usr/share/doc/apcupsd/examples/rpt/BackUPS.rpt
/usr/share/doc/apcupsd/examples/rpt/Smart-UPS-1500.rpt
/usr/share/doc/apcupsd/examples/rpt/SmartUPS-USB.rpt
/usr/share/doc/apcupsd/examples/rpt/SmartUPS.rpt
/usr/share/doc/apcupsd/examples/rpt/hid-ups.rpt
/usr/share/doc/apcupsd/examples/safe.apccontrol
/usr/share/doc/apcupsd/examples/smartsim.c
/usr/share/doc/apcupsd/examples/snoopdecode.c
/usr/share/doc/apcupsd/examples/status
/usr/share/doc/apcupsd/examples/status/Back-UPS-BX-1500.status
/usr/share/doc/apcupsd/examples/status/Back-UPS-Pro-1000.status
/usr/share/doc/apcupsd/examples/status/BackUPS-USB.status
/usr/share/doc/apcupsd/examples/status/JapaneseUPS.status
/usr/share/doc/apcupsd/examples/status/PowerStack450.status
/usr/share/doc/apcupsd/examples/status/SmartUPS-vs-650.status
/usr/share/doc/apcupsd/examples/status/SmartUPS1000.status
/usr/share/doc/apcupsd/examples/status/SmartUPS1400.status
/usr/share/doc/apcupsd/examples/status/SmartUPS3000.status
/usr/share/doc/apcupsd/examples/status/SmartUPS5000.status
/usr/share/doc/apcupsd/examples/status/SmartUPS600.status
/usr/share/doc/apcupsd/examples/status/SmartUPS700-2.status
/usr/share/doc/apcupsd/examples/status/SmartUPS700.status
/usr/share/doc/apcupsd/examples/status/newbackupspro1.status
/usr/share/doc/apcupsd/examples/status/newbackupspro2.status
/usr/share/doc/apcupsd/examples/upsapm.c
/usr/share/doc/apcupsd/examples/usb_hid_usages
/usr/share/doc/apcupsd/examples/usbsnoop.txt
/usr/share/hal/fdi/policy/20thirdparty/80-apcupsd-ups-policy.fdi
/usr/share/licenses/apcupsd
/usr/share/licenses/apcupsd/COPYING
/usr/share/man/man5/apcupsd.conf.5.gz
/usr/share/man/man8/apcaccess.8.gz
/usr/share/man/man8/apccontrol.8.gz
/usr/share/man/man8/apctest.8.gz
/usr/share/man/man8/apcupsd.8.gz

References

Summary

In this tutorial we learn how to install apcupsd on CentOS 8 using yum and dnf.