{"id":15717,"date":"2019-03-01T09:20:34","date_gmt":"2019-03-01T09:20:34","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15717"},"modified":"2026-03-10T10:25:05","modified_gmt":"2026-03-10T10:25:05","slug":"change-hostname-on-centos","status":"publish","type":"post","link":"\/in\/tutorials\/change-hostname-on-centos\/","title":{"rendered":"How to change hostname on CentOS 9 Stream: 3 simple methods explained"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Managing multiple servers may be challenging, which is where hostnames can prove to be useful.<\/p><p>Hostnames enable users to name their servers and organize them more efficiently.<\/p><p>In this tutorial, we&rsquo;ll explain what a hostname is and show you three ways to change it on a CentOS 9 Stream machine.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Linux-Commands-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-69262\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet.png 2048w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-300x83.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-1536x425.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-150x41.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/Linux-cheat-sheet-768x212.png 768w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure>\n<\/div><p>\n\n\n<div class=\"protip\"><div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                   What Is a Hostname?\n                <\/p>\n            <\/div>\n            <p class=\"protip__content\">A hostname is an individual name assigned to a computer. It can be anything from <strong>myhostname<\/strong> to <strong>mycomputer1.domain.tld.<\/strong> Hostnames are used as identifiers designed to make it easier for people to separate different computers or servers on the network. <\/p><\/div>\n\n\n\n<\/p><p>An interesting feature is that hostnames can be private or exposed to a network. For example, a user won&rsquo;t be able to see a hostname like <strong>myhostname<\/strong> on a network. On the other hand, if a hostname gets combined with a domain, it will be seen on public networks.<\/p><p>Let&rsquo;s say <strong>server1<\/strong> is the computer&rsquo;s hostname you want to access, while <strong>mydomain<\/strong> is the domain and <strong>.com<\/strong> is the top-level domain. When combined, the hostname will look like this &ndash; <strong>server1.mydomain.com<\/strong>.<\/p><p>Such identifiable names are called <strong>Fully Qualified Domain Names (FQDN)<\/strong>,<strong> <\/strong>as they include the computer&rsquo;s name and the domain name associated with that computer.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-change-hostname-using-hostinger-s-control-panel\">How to Change Hostname Using Hostinger&rsquo;s Control Panel<\/h2><p>If you are using Hostinger&rsquo;s <a href=\"\/in\/vps-hosting\">virtual machine hosting<\/a>, you can easily change the server&rsquo;s hostname via hPanel.<\/p><p>To do this, open your VPS management page on hPanel and navigate to the <strong>Settings <\/strong>section.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/hpanel-vps-settings-sidebar.png\"><img decoding=\"async\" width=\"382\" height=\"898\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/hpanel-vps-settings-sidebar.png\/public\" alt=\"VPS section sidebar on hPanel. Settings page is selected\" class=\"wp-image-88297\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/hpanel-vps-settings-sidebar.png 382w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/hpanel-vps-settings-sidebar-128x300.png 128w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/hpanel-vps-settings-sidebar-64x150.png 64w\" sizes=\"(max-width: 382px) 100vw, 382px\" \/><\/a><\/figure><\/div><p>Then, find the <strong>Change Hostname<\/strong> section and fill in the details with your desired hostname. Don&rsquo;t forget to save the changes.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/Change-Hostname-section-on-Hostinger_s-hPanel-VPS-Settings-page.png\"><img decoding=\"async\" width=\"1080\" height=\"334\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Change-Hostname-section-on-Hostinger_s-hPanel-VPS-Settings-page.png\/w=1024,h=1024,fit=scale-down\" alt=\"Change Hostname section on Hostinger's hPanel VPS Settings page\n\" class=\"wp-image-77351\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/Change-Hostname-section-on-Hostinger_s-hPanel-VPS-Settings-page.png 1080w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/Change-Hostname-section-on-Hostinger_s-hPanel-VPS-Settings-page-300x93.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/Change-Hostname-section-on-Hostinger_s-hPanel-VPS-Settings-page-1024x317.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/Change-Hostname-section-on-Hostinger_s-hPanel-VPS-Settings-page-150x46.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2019\/03\/Change-Hostname-section-on-Hostinger_s-hPanel-VPS-Settings-page-768x238.png 768w\" sizes=\"(max-width: 1080px) 100vw, 1080px\" \/><\/a><\/figure><\/div><p>That&rsquo;s it &ndash; the hostname is now updated. You can check the new hostname from hPanel or by asking the <a href=\"\/blog\/kodee\/\">Kodee AI assistant<\/a>. Simply ask it, &ldquo;What is the current static hostname of my VPS?&rdquo;<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58ffad0a41c\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58ffad0a41c\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1460\" height=\"456\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/kodee-outputs-the-current-vps-hostname-1.png\/w=1024,h=1024,fit=scale-down\" alt=\"Kodee AI assistant outputs the current VPS hostname\" class=\"wp-image-122338\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/kodee-outputs-the-current-vps-hostname-1.png\/w=1460,fit=scale-down 1460w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/kodee-outputs-the-current-vps-hostname-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/kodee-outputs-the-current-vps-hostname-1.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/kodee-outputs-the-current-vps-hostname-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/kodee-outputs-the-current-vps-hostname-1.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1460px) 100vw, 1460px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>You can also change the hostname via Kodee. Simply type a prompt like &ldquo;Hey, please change my hostname to mynewhostname.tld.&rdquo;<\/p><p>    <div class=\"announcement-block announcement-block--warning\">\n        <span class=\"announcement-block__heading\">\n            <svg width=\"24\" height=\"26\" viewBox=\"0 0 24 26\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                d=\"M12 23.5C17.799 23.5 22.5 18.799 22.5 13C22.5 7.20101 17.799 2.5 12 2.5C6.20101 2.5 1.5 7.20101 1.5 13C1.5 18.799 6.20101 23.5 12 23.5ZM13.637 8.65198C13.637 7.74791 12.9041 7.01501 12 7.01501C11.0959 7.01501 10.363 7.74791 10.363 8.65198C10.5335 10.5375 10.875 14.383 10.875 14.383C10.875 15.0043 11.3787 15.508 12 15.508C12.6213 15.508 13.125 15.0043 13.125 14.383V14.38L13.637 8.65198ZM11.9927 16.714C11.3714 16.714 10.8677 17.2177 10.8677 17.839C10.8677 18.4603 11.3714 18.964 11.9927 18.964H12.0073C12.6286 18.964 13.1323 18.4603 13.1323 17.839C13.1323 17.2177 12.6286 16.714 12.0073 16.714H11.9927Z\"\n                fill=\"#BE1025\"\/>\n            <\/svg>\n            Warning        <\/span>\n        <p class=\"announcement-block__content\">\n            If you use Hostinger&rsquo;s VPS and decide to change the hostname via the command line, these changes won&rsquo;t be reflected on hPanel. For this reason, we highly recommend modifying the hostname via Hostinger&rsquo;s hPanel.        <\/p>\n    <\/div>\n\n    \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-change-hostname-on-centos-9-stream-using-hostname-and-hostnamectl-commands\">How to Change Hostname on CentOS 9 Stream Using Hostname and Hostnamectl Commands<\/h2><p>Another method to change a computer&rsquo;s hostname is via the terminal or an <a href=\"\/in\/tutorials\/ssh-tutorial-how-does-ssh-work\/\">SSH<\/a> client. First, connect to SSH or open the terminal window. After that, make sure that the root user is active. To gain this privilege, use the <strong>superuser <\/strong>command below:<\/p><pre class=\"wp-block-preformatted\">su<\/pre><p>Next, check the current hostname with the following command:<\/p><pre class=\"wp-block-preformatted\">hostname<\/pre><p>It is also possible to do it with other commands. For example, the one listed below will provide more information about the server, such as its kernel or architecture:<\/p><pre class=\"wp-block-preformatted\">hostnamectl<\/pre><p>To change the hostname, execute the following <a href=\"\/in\/tutorials\/linux-commands\/\">Linux command<\/a>:<\/p><pre class=\"wp-block-preformatted\">hostnamectl set-hostname mynewhostname.tld<\/pre><p>After that, run the <strong>hostnamectl<\/strong> command again to check if the changes were successful:<\/p><pre class=\"wp-block-preformatted\">hostnamectl<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58ffad0c0a8\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58ffad0c0a8\" class=\"aligncenter size-full wp-lightbox-container\"><img decoding=\"async\" width=\"1672\" height=\"762\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/hostname1.png\/public\" alt=\"hostname change \" class=\"wp-image-114674\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/hostname1.png\/w=1672,fit=scale-down 1672w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/hostname1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/hostname1.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/hostname1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/hostname1.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/hostname1.png\/w=1536,fit=scale-down 1536w\" sizes=\"(max-width: 1672px) 100vw, 1672px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-how-to-change-hostname-on-centos-9-stream-by-editing-the-etc-hostname-file\">How to Change Hostname on CentOS 9 Stream by Editing the \/etc\/hostname File<\/h2><p>It&rsquo;s also possible to change the hostname by editing the <strong>\/etc\/hostname<\/strong> file with a text editor such as <strong>nano<\/strong>. To do this, run the command below:<\/p><pre class=\"wp-block-preformatted\">sudo nano \/etc\/hostname<\/pre><p>The file will contain a single line with the current hostname:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"6a58ffad0d72f\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a58ffad0d72f\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"2134\" height=\"1312\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=1024,h=1024,fit=scale-down\" alt=\"etc\/hostname\" class=\"wp-image-114675\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=2134,fit=scale-down 2134w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=1536,fit=scale-down 1536w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2019\/03\/etchostname.png\/w=2048,fit=scale-down 2048w\" sizes=\"(max-width: 2134px) 100vw, 2134px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Simply replace it with a new one and save the changes. Then, verify that everything is working with the following command:<\/p><pre class=\"wp-block-preformatted\">hostnamectl<\/pre><h2 class=\"wp-block-heading\" id=\"h-static-transient-and-pretty-hostnames\">Static, Transient, and Pretty Hostnames<\/h2><p>The previous methods covered how to set a static hostname, which doesn&rsquo;t change. However, it&rsquo;s also possible to specify a temporary hostname, which is also called a transient hostname. It will stay active until the system reboots.<\/p><p>To set it, add the <strong>&ndash;transient<\/strong> option to the <strong>hostnamectl<\/strong> command like this:<\/p><pre class=\"wp-block-preformatted\">sudo hostnamectl set-hostname my.temporaryhostname.tld --transient<\/pre><p>Then, check the changes:<\/p><pre class=\"wp-block-preformatted\">hostnamectl<\/pre><figure class=\"wp-block-image size-large\"><a href=\"\/in\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Finally, there is an option to create a hostname with UTF-8 support to further improve its readability. This is known as a pretty hostname.<\/p><p>Add <strong>&ndash;pretty<\/strong> to the <strong>hostnamectl <\/strong>command to create one:<\/p><pre class=\"wp-block-preformatted\">sudo hostnamectl set-hostname my.prettyhostname.tld --pretty<\/pre><p>Then, verify that the changes are successful using the below command:<\/p><pre class=\"wp-block-preformatted\">hostnamectl<\/pre><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Changing hostnames can be useful if users want to quickly differentiate multiple servers and manage them with ease.<\/p><p>In this tutorial, we&rsquo;ve gone through the process of changing the hostname for a CentOS 9 Stream system and explained the differences between static, temporary, and pretty hostnames.<\/p><p>We hope you found this tutorial useful. In case you have any questions, leave them in the comments section below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Managing multiple servers may be challenging, which is where hostnames can prove to be useful. Hostnames enable users to name their servers and organize them more efficiently. In this tutorial, we&rsquo;ll explain what a hostname is and show you three ways to change it on a CentOS 9 Stream machine. An interesting feature is that [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/in\/tutorials\/change-hostname-on-centos\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":110,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Change Hostname CentOS 9 (3 Effective Methods)","rank_math_description":"Learn how to change hostname in CentOS 9: Go to your VPS controls in the control panel, click on Other Settings, and type in your new hostname.","rank_math_focus_keyword":"change hostname centos","footnotes":""},"categories":[22640],"tags":[],"class_list":["post-15717","post","type-post","status-publish","format-standard","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/change-hostname-on-centos\/","default":1},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/alterar-hostname-centos\/","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/como-cambiar-hostname-ubuntu\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-mengganti-hostname\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/change-hostname-on-centos\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/change-hostname-on-centos\/","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/change-hostname-on-centos\/","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/change-hostname-on-centos\/","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/change-hostname-on-centos\/","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/change-hostname-on-centos\/","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/change-hostname-on-centos\/","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-cambiar-hostname-ubuntu\/","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/como-cambiar-hostname-ubuntu\/","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/como-cambiar-hostname-ubuntu\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/alterar-hostname-centos\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/15717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/comments?post=15717"}],"version-history":[{"count":32,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/15717\/revisions"}],"predecessor-version":[{"id":129917,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/15717\/revisions\/129917"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media?parent=15717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/categories?post=15717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/tags?post=15717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}