Setting Up a Local Webserver on Debian: Solving the Mystery of .local Domain Advertisement with Avahi

I recently purchased an Intel N100 based mini PC with the idea of turning it into a local webserver hosting many services like RSS feed reader, pi-hole, an open source memos app, and a few other smaller open source projects. I currently host all of these on an ailing Macbook Pro which has a tendency to go into “darkwake”, i.e. it wakes up when I send it a Wake-on-LAN command, and then within 15 seconds it goes back to sleep. Rather a lethargic fellow, that.

Initially wanting to install ubuntu on this new machine, I opted for debian because I’ve recently had some interaction with the OS at work and I’ve found it to be very stable and light. I’m sure someone might disagree and I’ll gladly experiment with other Linux OS somewhere down the line.

While I was installing debian, it asked me what the domain should be and I answered “local” because I want to access the server on my local network with the completely innovative domain name “server.local”. My other machines are “laptop.local” and “macserver.local”.

The latter two are Macbooks, so they automatically advertise the .local domain on the network using Apple Bonjour. But the debian wasn’t doing so. I was googling around but didn’t even know what to ask. Some stackoverflow answers spoke of how Ubuntu automatically advertises the “.local” while debian does not.

Before I rued my fate and having to wipe out my just setup server, I decided to ask the AI powers how I can solve this problem. My go-to is Bing Chat, since it has internet access. I asked the

Does debian 12 advertise itself on the lan with a .local domain name like Ubuntu and MacOS do?

Bing Chat looked around and regurgitated an answer I’d already found on Stackoverflow – that while it is possible to do so, the SO answer author decided to leave out the vital detail of what the heck this service is called on the Linux side of things (Apple Bonjour is a damn well known name in tech circles). The alternatives that the SO answer mentioned and Bing Chat vomited were to setup a local DNS server or to use /etc/hosts. The latter option is NOT available on iOS devices, which are painfully inadequate in terms of actually completely owning your device.

Before I gave up, I went to ChatGPT and pasted the question above exactly as is. I wasn’t really expecting a different answer, but I sure got it.

According to ChatGPT, as of its January 2022 cutoff date, Debian 12 hadn’t been released. But, the technology I’m talking about is called Avahi. Ubuntu and MacOS have it preinstalled and I can check if Avahi is installed using the following command –

dpkg -l | grep avahi

My debian install was of the netinstall flavor, which means it installed all the basic packages it thought were relevant and everything else was left to this poor user to figure out. I googled and found a method to install avahi-daemon on debian and the tutorial even mentioned that after installing it, I basically have to do nothing.

Lo and behold! One quick install step later, I can now access “server.local” on my LAN. Nice!

I don’t often do this, but I dropped the following feedback to the ChatGPT team regarding this excellent answer their LLM provided to me –

Though it doesn’t know that Debian 12 has been released after its cutoff date, ChatGPT was nevertheless point me in the right direction because the underlying technology – avahi – has been around for a while and is clearly the answer to the question I was looking for. In contract, Bing Chat was not able to come to the same answer even though I asked it the same question.

Spelling mistake and all.

The title of this post was created by ChatGPT after I fed it the entire post above and asked it what to name the post. I gave it the title “ChatGPT still wins over Bing Chat”, but that felt too sensational.

Cheers.

Year of Social

The season is changing and here, in Boulder, Colorado, it means colder nights and shorter days. It’s time for animals to wrap up their food gathering operations and finish working on cozy homes for the all too familiar winter.

 

This hibernation is also coming┬áto a very important aspect of my life. Last year, at about the same time, I dumped Facebook in favor of Twitter. I had been inactive on the micro blog since long and returned to it, only to discover so many new and amazing connections and services. I found people worth talking to and got help where I needed it. I also posted a lot on this blog here, taking it through many iterations, themes and (free) hosting providers. Now I’ve moved it to a paid provider – NearlyFreeSpeech in order to maintain a better uptime ratio.

Continue reading