Hostname changes on every reboot I want the hostname to be "server1.domain.com" it changes like it should but when I reboot it goes back to "server1" I dont have a clue what to do I type in hostname it responds with "server1" and then hostname -f "server1.domain.com" that does not change even after reboot I am bit new to this... :'(
Are you using AWS ec2 or Google cloud?
I am using a VPS from vpscheap.net
Kindly change the hostname through Change Hostname option in CWP admin panel.
I did but when it reboots or updating it reset back to "server1"
there are couple of places to specify the hostname. You may run a meta search for that string in question and see where it pops up and adjust accordingly.
grep --exclude-dir={boot,dev,media,mnt,proc,run,sys,root} -rnw '/' -e "server1"
Million things popped up dont know what to do with it really sorry
more refined search, yielding less results. it may take a few minutes to complete the searcch
grep --exclude-dir={boot,dev,media,mnt,proc,run,sys,root,var,postfix,dovecot,lvm} -rnw '/' -e "server1"
The most likely places where the hostname is stipulated are
Quote/etc/hosts
/etc/hostname
for some reason now all my pages are "HTTP Test Page" so everything is kinda broken and dont know what to do about it :(
Ok I sorted out the http test I accidentally changed the shared IP
But still sorting out host name
/etc/hosts
This does not change until I update the hostname from the web interface
127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
123.123.123.123 server1.domain.com server1
::1 localhost
/etc/hostname
This does change when I update or restart
that is what I change it to
server1.domain.com
after reboot
server1
Just want to add one thing its not the vps settings that is set to "server1.domain.com"
I am thinking I am getting confused between fqdn and hostnames but still not sure how to sort it out
I did some research on this problem and I have sort it out by locking the hostname file and I just did hosts aswell just incase I think its the hosting provider that did this but here i used this code.
To lock
chattr +i /etc/hosts /etc/hostname
To unlock
chattr -i /etc/hosts /etc/hostname
If there is a problem with this to cwp please some one let me know thank you
Good that you figured it out and shared your solution! The hosting provider though should not interfere in such manner after the installation of the server completed...