Skip to main content

CWP Installation Perquisite : Set Hostname Permanently

A computer hostname represents a unique name that gets assigned to a computer in a network in order to uniquely identify that computer in that specific network. The hostname is set at the time when the CentOS operating system is installed or if you are spinning up a virtual machine it is dynamically assigned to the instance at startup.

The hostname is used by many of the networking programs (such as sendmail, Apache servers) to identify the machine. By default, your server is started with the server’s given name as the hostname. Some software, such as cPanel, CWP requires a valid Fully Qualified Domain Name (FQDN) for the hostname.

Types of hostnames (The hostname can be configured as follows):
Static host name assigned by sysadmin. For example, “server1”, “wwwBot2”, or “host.datahead.biz”.
Transient/dynamic host name assigned by DHCP or mDNS server at run time.
Pretty host name assigned by sysadmin/end-users and it is a free-form UTF8 host name for presentation to the user. For example, “Rubel’s netbook”.

On a CentOS Linux 7 server you can use any one of the following tool to manage hostnames:
hostnamectl command : Control the system hostname. This is a recommended method.
nmtui command : Control the system hostname using text user interface (TUI).
nmcli command : Control the system hostname using CLI part of NetworkManager.

1.Show Present Hostname :
# hostnamectl 
OR
# hostnamectl status

# hostname 
OR
# cat   /etc/hostname
2.Change Hostname Temporary :
# hostname host.datahead.biz 
3.Change Hostname Permanently:
# hostnamectl set-hostname host.datahead.biz
# hostnamectl
   Static hostname: host.datahead.biz
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 7400071490ea4f7d931374824ad4b52c
           Boot ID: 6e1f2d76495d4b318c25c4a1195aa130
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-862.14.4.el7.x86_64
      Architecture: x86-64 
It also writes this information to the /etc/hostname file as well.
# cat /etc/hostname
host.datahead.biz

# vi   /etc/hostname      (To Edit)
host.datahead.biz
:x  (save & quit) 
4.One thing the hostnamectl command doesn’t do is modify the /etc/hosts file, so we’ll still need to do that
# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
SERVER_IP    host.datahead.biz     host
:x  (save & quit)

# vi   /etc/sysconfig/network
# Created by anaconda  
HOSTNAME=host.datahead.biz
:x  (save & quit) 
# vi  /etc/resolve.conf
# Generated by NetworkManager
search datahead.biz
nameserver   8.8.4.4
nameserver   8.8.8.8
:x  (save & quit)
5.Restart The services
# systemctl status  systemd-hostnamed

# systemctl enable  network.service
# systemctl restart network.service
hostnamectl status

Comments

Most Popular

CWP DNS Part 1 : How to Configure DNS properly for CentOS WebPanel on CentOS 7.6

After hosting my parent domain on CWP7.admin, I am getting dns error and i'm not able access my server using my server FQDN but i can access using my server IP.
So what can i do for that problem ?

Yes, you have to fix the error .

Environment Details:
Distro Name: CentOS Linux release 7.6.1810 (Core)
CentOS-Web Panel version: CWP7.admin
CWP version: 0.9.8.757
WebServer: Apache Only
FQDN: host.datahead.biz
IP: 192.120.10.3

1.Change Hostname Permanently:
# hostnamectl set-hostname host.datahead.biz# hostnamectl Static hostname: host.datahead.biz Icon name: computer-vm Chassis: vm Machine ID: 7400071490ea4f7d931374824ad4b52c Boot ID: 6e1f2d76495d4b318c25c4a1195aa130 Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-862.14.4.el7.x86_64 Architecture: x86-64 It also writes this information to the /etc/hostname file as well.
# cat /etc/hostname host.d…

CWP: How to Configure Let's Encrypt SSL Certificate for your server Hostname/FQDN on CWP7.admin

I wrote a blog on http://forum.centos-webpanel.com regarding Let's Encrypt SSL Certificate for CentOS Web Panel when "Letsencrypt Manager"  option was exist under Apache Settings >> Letsencrypt Manager >> Install Letsencrypt .

At Present CWP Team has been removed "Letsencrypt Manager"  that's why it will not renew any cert automatic . They made Auto SSL by default but Auto SSL grade is B and I'm not satisfied with Auto SSL.

Previous Article Link Install Letsencrypt SSL Certificate for your Server Hostname/FQDN, 100% Working 

N.B: I am using the below cipherlist 
https://cipherli.st/
https://mozilla.github.io/server-side-tls/ssl-config-generator/
https://wiki.mozilla.org/Security/Server_Side_TLS

So now I am writing this solution again for all of guys and I hope that it will be 100% working again on your CentOS-Webpanel as mine .

Environment Details:
CPU Model: Intel(R) Xeon(R) CPU X3440 @ 2.53GHz
CPU Details: 2 Core (2527 MHz)
Distro Name: Ce…