How to install apcupsd on Centos 8?

Issues related to applications and software problems and general support
User avatar
TrevorH
Forum Moderator
Posts: 30168
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to install apcupsd on Centos 8?

Post by TrevorH » 2019/10/28 20:42:30

If you do want to use apcupsd then I tested and the existing SRPM from EPEL 7 will rebuild quite happily using mock on CentOS 8 if you patch the .spec file with:

Code: Select all

--- apcupsd.spec.orig	2017-05-04 21:20:35.000000000 +0100
+++ apcupsd.spec	2019-10-28 19:52:12.291282368 +0000
@@ -18,8 +18,10 @@
 Patch1:       apcupsd-3.14.4-shutdown.patch
 
 BuildRequires: glibc-devel, gd-devel
-BuildRequires: net-snmp-devel, tcp_wrappers-devel, libusb-devel
-BuildRequires: gtk2-devel, gnome-vfs2-devel, desktop-file-utils
+BuildRequires: net-snmp-devel, libusb-devel
+BuildRequires: gtk2-devel, desktop-file-utils
+BuildRequires: glib2-devel, GConf2-devel, gtk2-devel
+#BuildRequires: gtk2-devel, gnome-vfs2-devel, desktop-file-utils
 # This is part of util-linux in Fedora, but on EL7 it's in sysvinit-tools.
 BuildRequires: /usr/bin/wall
 Requires:      /bin/mail /usr/bin/wall
@@ -85,7 +87,7 @@
         --enable-modbus-usb \
         --enable-gapcmon \
         --enable-pcnet \
-        --with-libwrap=%{_libdir} \
+        --without-libwrap \
         --with-serial-dev= \
         --with-upstype=usb \
         --with-upscable=usb \
The resulting packages are untested since I don't have a CentOS 8 system with an APC UPS hooked up to it. I had to remove gnome-vfs2-devel and tcp_wrappers from the spec to allow it to build and I have no idea what those were used for before.

If you haven't used mock before then you need to install it from the epel-playground or epel-testing repos and update to the latest mock-core-configs package from those repos too. Once it's installed you have to add your user to the 'mock' group with usermod -a -G mock $me then logout and back in to pick up that change (or use newgrp). Once you've done that, set up your user's rpm tree using rpmdev-setuptree (from rpmdevtools) and rpm --install the apcupsd SRPM as your own user. That will place apcupsd.spec in ~/rpmbuild/SPECS and you can apply that patch and then rebuild the SRPM with rpmbuild -bs apcupsd.spec and then feed that into mock --rebuild ~/rpmbuild/SRPMS/apcupsd-3.14.14-5.el8.src.rpm

At the end it should say something like : INFO: Done(/home/trevor/rpmbuild/SRPMS/apcupsd-3.14.14-5.el8.src.rpm) Config(default) 1 minutes 50 seconds
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

leo8888
Posts: 27
Joined: 2015/01/28 20:51:14

Re: How to install apcupsd on Centos 8?

Post by leo8888 » 2019/11/18 21:50:46

TrevorH wrote:
2019/10/28 16:51:50
dnf --enablerepo=epel-testing install nut
Hello TrevorH. It's great to see you are still here. You helped me tremendously when I was first learning Linux and setup my first CentOS server so thank you!

I am working on a new CentOS 8 server to replace my existing CentOS 7 and am at the point where I am trying to get NUT installed since I used it in CentOS 7. I ran the command above but it seems I am missing the epel-testing repo because the command just keeps showing me syntax help.

How do I install the missing epel-testing repo? I tried "dnf install epel-testing -y" but I get "Unable to find a match". And when I run "dnf install epel-release -y" it says "already installed".

User avatar
TrevorH
Forum Moderator
Posts: 30168
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to install apcupsd on Centos 8?

Post by TrevorH » 2019/11/18 22:27:18

The epel-testing repo is part of epel-release but it's disabled by default (and should be).
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

leo8888
Posts: 27
Joined: 2015/01/28 20:51:14

Re: How to install apcupsd on Centos 8?

Post by leo8888 » 2019/11/19 13:34:32

TrevorH wrote:
2019/11/18 22:27:18
The epel-testing repo is part of epel-release but it's disabled by default (and should be).
I searched the NUT website and found a link to a page that I believe has an RPM compatible with CentOS 8. This is the page I found:

https://koji.fedoraproject.org/koji/bui ... ID=1401644

Would this be the correct one to install on CentOS 8? I don't want to junk up my brand new install.

User avatar
TrevorH
Forum Moderator
Posts: 30168
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to install apcupsd on Centos 8?

Post by TrevorH » 2019/11/19 15:17:47

Probably but the safe way to install it and keep it up to date is to install the epel-release package which gives you access to the epel repo and its -testing and -playground (even more testing than -testing) repos, both of which are disabled by default. Then you can run dnf --enablerepo=epel-testing list nut\* and install the bits you want. Also checking -playground to see if it has more recent copies or even ones that haven't reached -testing at all yet.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

leo8888
Posts: 27
Joined: 2015/01/28 20:51:14

Re: How to install apcupsd on Centos 8?

Post by leo8888 » 2019/11/19 15:48:21

TrevorH wrote:
2019/11/19 15:17:47
Probably but the safe way to install it and keep it up to date is to install the epel-release package which gives you access to the epel repo and its -testing and -playground (even more testing than -testing) repos, both of which are disabled by default. Then you can run dnf --enablerepo=epel-testing list nut\* and install the bits you want. Also checking -playground to see if it has more recent copies or even ones that haven't reached -testing at all yet.
Trevor, thanks for the info. So I'm back to my original problem. I can't enable the epel-testing repo. Here is what I tried:
dnf --enablerepo=epel-testing list nut\*
Error: Unknown repo: 'epel-testing'
dnf install epel-testing
Last metadata expiration check: 1:39:33 ago on Tue 19 Nov 2019 09:07:23 AM EST.
No match for argument: epel-testing
Error: Unable to find a match
Almost forgot to add that I checked to make sure the epel-release is installed:
dnf install epel-release
Last metadata expiration check: 1:42:41 ago on Tue 19 Nov 2019 09:07:23 AM EST.
Package epel-release-8-7.el8.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

User avatar
TrevorH
Forum Moderator
Posts: 30168
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to install apcupsd on Centos 8?

Post by TrevorH » 2019/11/19 16:10:42

Run rpm -V epel-release and see what it complains is missing. If anything is then yum reinstall epel-release
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

leo8888
Posts: 27
Joined: 2015/01/28 20:51:14

Re: How to install apcupsd on Centos 8?

Post by leo8888 » 2019/11/19 16:34:08

TrevorH wrote:
2019/11/19 16:10:42
Run rpm -V epel-release and see what it complains is missing. If anything is then yum reinstall epel-release
So it shows I have all these missing which I don't understand because when I checked epel-release shows as being installed?
rpm -V epel-release
missing c /etc/yum.repos.d/epel-playground.repo
missing c /etc/yum.repos.d/epel-testing.repo
missing c /etc/yum.repos.d/epel.repo

User avatar
TrevorH
Forum Moderator
Posts: 30168
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to install apcupsd on Centos 8?

Post by TrevorH » 2019/11/19 16:47:27

Just yum reinstall epel-release and it will replace the missing files.
CentOS 6 died in November 2020 - migrate to a new version!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

leo8888
Posts: 27
Joined: 2015/01/28 20:51:14

Re: How to install apcupsd on Centos 8?

Post by leo8888 » 2019/11/19 16:48:58

TrevorH wrote:
2019/11/19 16:47:27
Just yum reinstall epel-release and it will replace the missing files.
Sorry, I should have mentioned I already tried that:
yum reinstall epel-release
Last metadata expiration check: 2:40:28 ago on Tue 19 Nov 2019 09:07:23 AM EST.
Installed package epel-release-8-7.el8.noarch (from epel) not available.
Error: No packages marked for reinstall.

Post Reply

Return to “CentOS 8 - General Support”