Skip to content

Use domain on Linux

Aron Heesakkers edited this page Jun 10, 2021 · 1 revision

DNS

How to add a DNS to Linux Ubuntu 20.04 server.

Step 1

Login to your server.

ssh ubuntu@123.456.78.90

Note

IP address is an example. Use your own IP addresss!

Step 1

Change the file hostname to use your DNS.

# /etc/hostname
ubuntu

->

# /etc/hostname
fipost.nl

Then run:

sudo hostname $(cat /etc/hostname)

Source:

Step 2

Change the resolver.

vim /etc/systemd/resolved.config

Add domain fipost.nl

Result:

#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
domain fipost.nl
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
...                     

Step 2

127.0.0.1 hostname.domain.com hostname localhost

# /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu

To

# /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu
Clone this wiki locally