Issue 2: After modifying the hostname, how to make it effective immediately without restarting the operating system.
Method 1: After you modify the hostname under/etc/sysconfig/network, then use echo servername >/proc/sys/kernel/hostname.
[Email protected] ~]# echo Test >/proc/sys/kernel/hostname
Note that the current session still does not change, but subsequent new sessions will take effect.
Method 2: After modifying the hostname under/etc/sysconfig/network, then use the Sysctl kernel.hostname command to make it effective immediately
[Email protected] ~]# sysctl Kernel.hostname=test2
Kernel.hostname = Test2
Note that the current session still does not change, but subsequent new sessions take effect.
Method 3: After modifying the hostname under/etc/sysconfig/network, then use the hostname command to make it effective
[Root@test ~]# hostname db-server
Note that the current session still does not change, but subsequent new sessions take effect.
In fact, these methods are only combined with permanent modification and temporary modification of hostname, so that it does not have to restart the Linux server, haha, do not know you understand.
If you want to dive into the Linux system novice, you can also download a German Linux software center trial.
Free: Http://www.nfs-cloud.cn:81/appCenter/open/softcenter
Five questions about modifying hostname under Linux (ii)