How to change hostname from `localhost.localdomain` to something else?

I using started working on React apps. When I try and start npm start it tries to run on localhost.localdomain:3000. node gets the name from process.env.HOST. I want to change the hostname. How do I do it? (I guess I can simply change the configuration files for the React apps but I have to do it for every app.)

What I tried:

> sudo hostname pc0

> hostnamectl
   Static hostname: n/a
Transient hostname: pc0

Still node tries to start the server on localhost.localdomain:3000 instead of desired ‘pc0:3000’.

YaST > System > Network settings. There is a tab there to set the hostname.

Hi
Or hostnamectl set-hostname pc0 :wink:

1 Like

This worked. Thank you!

1 Like

Thanks worked great :+1: