Red Hat Enterprise Linux 7 and similar Linux distrobutions have a new command to set the hostname of the system easily. The command is hostnamectl. For example, to set the hostname of a RHEL 7 system to "flores", run:
The hostnamectl command provides some other interesting features.# hostnamectl set-hostname flores
For example, it can be used to set the deployment type of the system, for example "development" or "production" or anything else you like to give it (as long as it's a single word. You can do so, for example by setting it to "production", by running:
Another option is to set the location of the system (and here you can use multiple words):# hostnamectl set-deployment production
To retrieve all this information, use hostnamectl as well to query the status:# hostnamectl set-location "third floor rack A12 U24"
root@(enemigo) selinux # hostnamectl status
Static hostname: flores
Icon name: computer-laptop
Chassis: laptop
Deployment: production
Location: third floor rack A12 U24
Machine ID: 4d8158f54d5166ff374bb372599351c4
Boot ID: ae8e7dccf14a492984fb5462c4da2aa2
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.2.2.el7.x86_64
Architecture: x86-64
If you found this useful, here's more on the same topic(s) in our blog:
- Creating a large file
- Simple printer remediation
- How to show the timestamp in your shell history in AIX 5.3
- Set up private network between 2 VIO clients
- Use machstat to identify power or cooling issues
UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.
Interested in learning more?
Interested in learning more?




