How to Install Cobbler on nixOS Latest

Cobbler is a Linux installation server that helps you to automate Linux installations. In this tutorial, we will show you how to install Cobbler on nixOS Latest.

Prerequisites

Step 1 - Install Cobbler and Dependencies

  1. Open your terminal and switch to the sudo user account.

  2. Update your system's package list using the following command:

    sudo nix-channel --update
    
  3. Install Cobbler and its dependencies by running:

    sudo nix-env -iA nixos.cobbler
    
  4. Cobbler requires the TFTP server, install it with:

    sudo nix-env -iA nixos.tftp-hpa
    

Step 2 - Configure Cobbler

  1. Open the Cobbler configuration file located at /etc/cobbler/settings and configure it to your needs. Here’s an example:

    default_password_crypted: "$1$1234567890"
    manage_dhcp: 1
    system_password_crypted: "$1$1234567890"
    

    Note: Don't forget to replace the "1234567890" strings with your preferred password hash.

  2. Restart the cobbler daemon by running:

    sudo systemctl restart cobblerd
    

Step 3 - Configure DHCP Server

  1. To set up a DHCP server with Cobbler, we should edit the file /etc/cobbler/dhcp.template in your favorite text editor. Here’s an example:

    subnet 172.22.0.0 netmask 255.255.255.0 {
       option routers             172.22.0.1;
       option domain-name-servers 172.22.0.1;
       option subnet-mask         255.255.255.0;
       range dynamic-bootp        172.22.0.60 172.22.0.250;
       default-lease-time         21600;
       max-lease-time             43200;
       next-server                $next_server;
       filename                   "$pxe_image_name";
    }
    

    Note: Replace "172.22.0.0", "172.22.0.1", "60", and "250" with your desired DHCP settings.

  2. Make a backup of the current dhcp.conf file by running:

    sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak
    
  3. Fix the ownership of the DHCP configuration file with cobbler by running:

    sudo chown dhcpd:dhcpd /etc/cobbler/dhcp.template
    
  4. Apply the new configuration by running:

    sudo cobbler sync
    sudo systemctl restart dhcpd
    

Conclusion

You have successfully installed and configured Cobbler on your nixOS Latest system. You can now use it to automate Linux installations.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!