[Cloudmatika] How to Install and Configure a Nameserver on Ubuntu Server

/etc/resolv.conf is the main configuration file for library resolver name DNS. Resolver is a set of functions in C library which provide access to Internet Domain Name System (DNS)

Why Edit the /etc/resolv.conf File?

The main reason is probably because the system DNS settings is wrongly configured or you prefer to use a specific name server or your own. The following command shows the default name server in the /etc/resolv.conf file on my Ubuntu system.

$ cat /etc/resolv.conf
HTML

Installing resolvconf in Ubuntu and Debian

  1. First, update the system software packages and then install the resolvconf of the official repository by carrying out the following commands.
    $ sudo apt update
    $ sudo apt install resolvconf
    HTML
  2. Once the resolvconf installation is completed, the systemd will trigger the resolvconf.service to start and be automatically activated. To check if it is already active and running, run the following command.
    $ sudo systemctl status resolvconf.service
    HTML
  3. If the service is not started and activated automatically for any reason, you can start and activate it as follows.
    $ sudo systemctl start resolvconf.service
    $ sudo systemctl enable resolvconf.service
    $ sudo systemctl status resolvconf.service
    HTML
  4. Click on New template and start creating your template

Set Permanent DNS Nameservers in Ubuntu and Debian

  1. Next, open the /etc/resolvconf/resolv.conf.d/head configuration file.
    $ sudo vi /etc/resolvconf/resolv.conf.d/head
    HTML
  2. and add the following lines in it:
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    HTML
  3. Save changes and start resolvconf.service or reboot the system.
    $ sudo systemctl start resolvconf.service
    HTML

  4. Now when you check the /etc/resolv.conf file, the name server entry should be kept there permanently. For the next, you can also add your custom nameserver
Containers (CT) vs. Virtual Machines (VM)
[Cloudmatika] How to Install PHP on CentOS