CoreDNS is a customizable and extensible DNS server that can be used for service discovery and other DNS-related tasks. In this tutorial, we will go through the steps required to install CoreDNS on Linux Mint.
Before we proceed with the installation, you will need the following:
Begin by downloading the latest CoreDNS package from the CoreDNS website. You can download the package using the following command in the terminal:
wget https://github.com/coredns/coredns/releases/download/v1.8.5/coredns_1.8.5_linux_amd64.tgz
This command downloads the package for version 1.8.5, the current stable release at the time of writing. You can check for the latest release at the CoreDNS releases page.
Once you have downloaded the package, extract its contents using the following command:
tar -xvzf coredns_1.8.5_linux_amd64.tgz
This command extracts the package into a subdirectory named coredns
in your current working directory.
Next, move the coredns
directory to the /usr/local/bin
directory using the following command:
sudo mv coredns /usr/local/bin
This command moves the coredns
directory and its contents to the /usr/local/bin
directory, which is already in your system's PATH
.
First, you need to create a directory to store your CoreDNS configuration files. You can do this using the following command:
sudo mkdir /etc/coredns
Next, create a configuration file for CoreDNS in the /etc/coredns
directory. You can use your favorite text editor to create the file:
sudo nano /etc/coredns/Corefile
In this file, you can configure CoreDNS as per your requirements. Here is a basic example configuration file that you can use to get started:
. {
forward . 8.8.8.8
}
This configuration forwards all DNS queries to the Google public DNS server at 8.8.8.8
. You can find more examples and detailed configuration instructions in the CoreDNS documentation.
To run CoreDNS with your custom configuration file, use the following command:
sudo coredns -conf /etc/coredns/Corefile
This command starts CoreDNS with the Corefile
configuration file that you created in the previous step.
To run CoreDNS as a daemon that starts automatically at boot time, you can create a systemd service file as follows:
sudo nano /etc/systemd/system/coredns.service
In this file, define the following parameters:
[Unit]
Description=CoreDNS DNS server
After=network.target
[Service]
ExecStart=/usr/local/bin/coredns -conf /etc/coredns/Corefile
Restart=always
[Install]
WantedBy=multi-user.target
Save the file and reload the systemd daemon using the following command:
sudo systemctl daemon-reload
Finally, enable and start the CoreDNS service using the following commands:
sudo systemctl enable coredns.service
sudo systemctl start coredns.service
This command enables the coredns.service
unit and starts the CoreDNS service automatically at boot time.
In this tutorial, you learned how to install and configure CoreDNS on Linux Mint. CoreDNS is a powerful DNS server that can be used for a variety of tasks such as service discovery, load balancing, and more. You can now experiment with different configurations and explore the many features offered by CoreDNS.
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!
Alternatively, for the best virtual desktop, try Shells!