How to Install Unbound on NixOS Latest
Unbound is a DNS resolver that provides high performance, recursive DNS resolution. It is designed to be secure, reliable, and scalable. Installing Unbound on NixOS is a straightforward process that can be done in a few simple steps.
Step 1: Update Package List
Before installing Unbound, it is recommended to update the package list. This can be done by running the following command:
sudo nix-channel --update
Step 2: Install Unbound
To install Unbound, use the following command:
sudo nix-env -iA nixos.unbound
This will download and install Unbound and its dependencies.
Step 3: Configure Unbound
Once Unbound is installed, you need to create a configuration file. You can use the default configuration file located at /etc/unbound/unbound.conf or create a new file.
To create a new configuration file, run the following command:
sudo nano /etc/unbound/unbound.conf
This will open a new file in the Nano text editor. You can then copy and paste the following configuration:
server:
interface: 0.0.0.0
access-control: 0.0.0.0/0 allow
verbosity: 1
do-daemonize: yes
logfile: ""
forward-zone:
name: "."
forward-addr: 8.8.8.8
forward-addr: 8.8.4.4
This configuration enables Unbound to listen on all interfaces, logs to the system log (since logfile is blank), and forwards all DNS queries to the Google DNS servers.
Step 4: Start Unbound
After configuring Unbound, you can start the service using the following command:
sudo systemctl start unbound
This will start the Unbound service and it will be running in the background.
Step 5: Verify Unbound is Running
To verify that Unbound is running, you can use the following command to check its status:
sudo systemctl status unbound
This will display information about the service and show whether it is currently running. If everything is working properly, you should see the status as active (running).
Congratulations! You have successfully installed Unbound on NixOS Latest. You can now use it to resolve DNS queries securely and reliably.