Score:-1

How do I assign Ubuntu PC a domain

br flag

I want to assign domain name to Ubuntu 20 server. I have assigned ip manually to server. Looking out for free free dns, I found out this link https://freedns.afraid.org/ I am totally confused how to proceed things and what are the per-requisites. Do I have to use apache or nginx on ubuntu 20.04 ?

Score:0
cn flag

You can use hostnamectl set-hostname xxxx in order to set the name of your server. However, your server doesn't need to know how it's called in the network. You can check the /etc/hosts file if you want to force the local resolution, or use netplan in order to use a particular DNS with the search parameter :

network:
  version: 2
  renderer: networkd
  ethernets:
    int001:
        addresses:
        gateway4: 
        nameservers:
            addresses:

            #here the line
            search: ['subdomain.domain.de', 'otherdomain.nl']
br flag
Thanks for the reply. So, basically I need domain name from authentic domain provider like GoDaddy or this will work with freedns?
cn flag
exactly, you first need a DNS record somewhere ! I don't know freeDNS but if you can have a DNS record, it'll works fine :) However, you don't need a hosting service like GoDaddy while you already have your server. The differences between free services and paid services is that you can have YOUR OWN domain. For example if you want to contact your server with https://www.abcdefgij.nl/, you have to buy the abcdefgij.nl domain, then create a DNS record with your public server IP and the domain. For free services, you use already created domains that you don't choose.
br flag
I have setup Apache webserver on my pc ip that I assigned manually. I can access my pc by `http:192.168.0.xxx ` Howerver, I tried adding domain name in `/etc/apache2/sites-available/myDomain.conf` but, it failed to load through domain name. I also added these lines in `/etc/hosts` `127.0.0.1 localhost advice.com www.advice.com`
cn flag
The domain is extern of the server. It's just a way to convert an IP to a name. If you use a public DNS and not a local one (like by installing bind) you have to use a public IP and then create a redirection from a port (80/443 ?) to your local webserver. In any way, your local server doesn't need to know it's accessible via a URL ; he just serve the webpage when someone ask it via him IP address. The DNS is just here to convert the IP to name.
br flag
I have configured DNS as [link](https://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-configure-dns-server-on-ubuntu-18-04.html) After that,I used open ssl to generate self signed certificates for domain. Website of domain is running with warning of Not Secure and cant be fetched by certbot.
cn flag
I let you pin my answer as right answer, upvoting it and create a new question on the forum if something else doesn't work properly
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.