How to upgrade systemd on CentOS 7?

First, you should know how to check systemd version on Linux. The system version command is:

You will see the output is “systemd 219″ on CentOS 7. This version is too low for many software that depend on systemd. Unless you use an unofficial repo, you cannot upgrade systemd to higher version on CentOS with yum. You can build systemd from source code yourself. But don’t try to build the latest systemd versions such as systemd v252 orĀ systemd v251 on CentOS 7 as they need higher kernel version of Linux(>=3.15) which is not shipped with CentOS 7. To check the kernel version in centos, use the following command:

The kernel version of centos 7 is 3.10.0. If you try to build the latest version of systemd, you will get the errors like:

../src/libsystemd/sd-netlink/netlink-message-nfnl.c:21:23: error: ‘NFPROTO_NETDEV’ undeclared (first use in this function)

 

../src/shared/loop-util.c:334:41: error: ‘LO_FLAGS_DIRECT_IO’ undeclared (first use in this function)

 

I’ve successfully built and installed systemd V247 using the following commands:

The commands mainly come (but different) from this post and this post. Note that you must use an earlier version of meson such as 0.59.4. Otherwise, you may get this error:

 

 

 

Posted in tips of hosting