knxd on RPM based systems - knxd/knxd GitHub Wiki
On RPM-based systems (RedHat, CentOS, Fedora, ...) it is possible to compile and install knxd. Here are some points to watch out for.
Fedora 25
- works for knxd-0.14.x and upwards
- first install dependencies, then follow build steps like for RHEL 7
sudo dnf install wget rpm-build make gcc gcc-c++ libtool systemd-devel libusbx-devel libev-devel fmt-devel
openSUSE LEAP (42.3)
- works for knxd-0.14.x and upwards (with gcc6 installed)
- it does not have libfmt as rpm! build works because it can be pulled at configure time and is statically(?) linked to knxd.
- first install dependencies, then follow build steps like for RHEL 7
sudo zypper install gcc6 gcc6-c++ libusb-1_0-devel libev-devel rpm-build libtool cmake systemd-devel
# needed to make gcc v6 default
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 50
# check your alternatives with
sudo update-alternatives --config gcc
Centos 7, RHEL 7
- You can only use the knxd-0.12.x releases, the compiler is too old on those systems to support more recent releases
- Just use the provided specfile found in
rpm/knxd.spec
OpenSUSE 13
- You can only use the knxd-0.12.x releases, the compiler is too old on those systems to support more recent releases
- Just use the provided specfile found in
rpm/knxd.spec
- Instead of the yum line use else follow the steps in the RHEL 7 documentation.
sudo zypper install libev-devel libusb-1_0-devel gcc-c++ rpm-build systemd-devel libtool
Centos 6, RHEL 6
- You can only use the knxd-0.10.x releases, the compiler is too old on those systems to support more recent releases
- working spec file to build v0.10.x on RHEL 6/7 can be found here: https://github.com/mike-kfed/knxd/blob/stablerpm/rpm/knxd.elX.spec
- it is not advised to run knxd with usb devices on RHEL 6, because libusb is superancient and flaky
- pthsem is needed, download and compile pthsem-2.0.8
Compiler environment
You will need a working compiler environment with the required header files for some key components. Depending on which features you want to activate in knxd, some libraries may be needed. Typically, if you want to compile knxd with usb support, you will need libusb and its headers. These often have names that end with -devel.
Furthermore, you will need automake and libtool, as the make process for knxd needs these.
To download knxd, using git is the easiest way.
Using bootstrap.sh
Not yet tested
Making RPMs
The code to make RPMs can be called using the make RPM command. However, the master branch of early 2016 does not work yet, as some files are missing.
Manual installation for systemd
Whilst the RPM code is in the making, you can take these steps to set up a working systemd service:
- define a new group and user named knxd
- copy the systemd/knxd.socket and systemd/knxd.service to your systemd folder (e.g. /etc/systemd/system)
- use systemctl daemon-reload to refresh the systemd system with your changes
- copy the systemd/knxd.conf file to the /etc folder. Adapt it as needed. Ensure the KNXD_OPTS reflect the correct options you want to use.
- ensure the knxd binary is correctly installed.
- start first the socket, then the service.
Tested on
Please add here which RPM-based systems where knxd was compiled and installed, and whether it worked.
- Fedora 21, compiled and installed OK, USB connection does not work (Issue 126)
- CentOS 7, compiled and installed OK (stable branch)
Steps to build knx-0.10.x on RHEL6
(if, for whatever reason, you like to install v0.10.x on RHEL7, the spec file is compatible)
# install needed tools
cd ~
sudo yum -y install wget rpm-build make gcc gcc-c++ libtool
# for RHEL7
sudo yum -y install systemd-devel
# get, build and install pthsem
wget https://www.auto.tuwien.ac.at/~mkoegler/pth/pthsem_2.0.8.tar.gz
rpmbuild -ta pthsem_2.0.8.tar.gz
sudo rpm -i ~/rpmbuild/RPMS/x86_64/*.rpm
# fetch a v0.10.x release from https://github.com/knxd/knxd/releases
wget https://github.com/knxd/knxd/archive/v0.10.18.tar.gz
tar xzf v0.10.18.tar.gz
cd knxd-0.10.18
./bootstrap.sh
cd ..
# build knxd rpm
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
tar czf ~/rpmbuild/SOURCES/knxd-0.10.18.tar.gz knxd-0.10.18/
wget -O ~/rpmbuild/SPECS/knxd.elX.spec https://github.com/mike-kfed/knxd/raw/stablerpm/rpm/knxd.elX.spec
rpmbuild -ba ~/rpmbuild/SPECS/knxd.elX.spec
Steps to build current on RHEL7
steps are similar to RHEL6 but without pthsem (no longer needed) and with libev
# install needed tools
cd ~
sudo yum -y install wget rpm-build make gcc gcc-c++ libtool systemd-devel libusbx-devel libev-devel
# fetch a v0.12.x release from https://github.com/knxd/knxd/releases
wget https://github.com/knxd/knxd/archive/v0.12.10.tar.gz
tar xzf v0.12.10.tar.gz
cd knxd-0.12.10
./bootstrap.sh
cd ..
# build knxd rpm
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
tar czf ~/rpmbuild/SOURCES/knxd-0.12.10.tar.gz knxd-0.12.10/
rpmbuild -ba ~/knxd-0.12.10/rpm/knxd.spec