Super noob installation question

Peter Rathlev peter at rathlev.dk
Thu May 23 16:01:40 UTC 2019


On Thu, 2019-05-23 at 14:34 +1000, Pranchisco Castro wrote:
> I have a new CentOS 7.6 server and unpacked dhcp 4.4.1 in
> /usr/local/src/
[...]
> Once it completed, I wanted to see if the service was available so I
> entered:
> 
> # systemctl status dhcpd
> Unit dhcpd.service could not be found.
> 
> # systemctl enable dhcpd
> Failed to execute operation: No such file or directory
> 
> It seems the server doesnt see the service. I can't figure out where
> I went wrong and googling would just bring up pages of normal "yum
> install dhcp" or archlinux 

Though Rick is right about there being a pre-compiled version in
RHEL/CentOS, it's kind of old. Even though RedHat probably does a good
job of back porting fixes, you can expect many people to advise you to
use the official release when asking on this list.

Compiling you own does work best if you're comfortable with compiling
stuff and writing your own configuration and service files.

The ISC DHCP source doesn't contain a systemd ".service" file so you
have to make one yourself. The contents depend on how you configured
dhcpd regarding where executables and configuration and lease files are
placed.

With "--prefix=/usr" the executable is installed in /usr/sbin/dhcpd.
The lease files seem to be placed in "/var/db" from the output you
pasted.

The systemd service file from a CentOS 7 vendor version of ISC dhcpd is
placed in /usr/lib/systemd/system/dhcpd.service when installed and
looks like this:

  [Unit]
  Description=DHCPv4 Server Daemon
  Documentation=man:dhcpd(8) man:dhcpd.conf(5)
  Wants=network-online.target
  After=network-online.target
  After=time-sync.target
  
  [Service]
  Type=notify
  ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
  
  [Install]
  WantedBy=multi-user.target

I'm not sure if a plain build can use this, but you could try.

We configure with the following command:

CFLAGS="-Wno-unused-but-set-variable" ./configure --prefix=/usr \
  --with-srv-lease-file=/var/lib/dhcpd/dhcpd.leases \
  --with-srv-pid-file=/var/run/dhcpd.pid \
  --enable-failover --enable-execute --enable-binary-leases

We use a service unit file (in /etc/systemd/system/dhcpd.service to
override any built in) with the following contents:

   [Unit]
   Description=DHCPv4 Server Daemon
   Documentation=man:dhcpd(8) man:dhcpd.conf(5)
   Wants=network-online.target
   After=network-online.target
   After=time-sync.target
   
   [Service]
   Type=forking
   ExecStart=/usr/sbin/dhcpd -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd.pid -lf /var/lib/dhcpd/dhcpd.leases bond0
   PIDFile=/var/run/dhcpd.pid
   
   [Install]
   WantedBy=multi-user.target

-- 
Peter




More information about the dhcp-users mailing list