{"id":907,"date":"2026-10-23T13:00:00","date_gmt":"2026-10-23T13:00:00","guid":{"rendered":"https:\/\/vpslake.com\/blog\/?p=907"},"modified":"2026-10-23T13:00:00","modified_gmt":"2026-10-23T13:00:00","slug":"change-hostname-almalinux-10","status":"publish","type":"post","link":"https:\/\/vpslake.com\/blog\/2026\/10\/23\/change-hostname-almalinux-10\/","title":{"rendered":"How to Change Hostname in AlmaLinux 10 (Step-by-Step)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Change hostname on AlmaLinux 10 with <code>hostnamectl<\/code>, a local <code>\/etc\/hosts<\/code> entry, and a quick verification pass. You can finish the change in about five minutes without rebooting, although long-running services may need a restart or a new SSH session.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>An AlmaLinux 10 VPS with root access or a regular account that can run commands with <code>sudo<\/code>.<\/li>\n\n\n<li>An SSH client connected to the server; the commands below are designed for a headless installation.<\/li>\n\n\n<li>A hostname that uses letters, numbers, hyphens, and dots; use an FQDN such as <code>app01.example.com<\/code> if the server has a domain name.<\/li>\n\n\n<li>If you plan to use an FQDN, access to the domain&#8217;s DNS records and the VPS&#8217;s primary IP address.<\/li>\n\n\n<li>A <a href=\"https:\/\/vpslake.com\/buy-vps\">VPSLake Linux VPS<\/a> running AlmaLinux 10 if you need a server for this procedure.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Inspect the current hostname<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Record the existing values first so you can identify whether the server currently has a static, pretty, or transient name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/almalinux-release\nhostnamectl status --static\nhostnamectl status --pretty\nhostnamectl status --transient\nhostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On a new VPS, the static and pretty values may be empty while the transient value comes from the image or network configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>AlmaLinux release 10.x\nold-server.example.net\nold-server.example.net\nold-server<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">An empty line is normal when a particular hostname type has not been configured. The static hostname is the important value for the operating system and most services.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Set the new static hostname<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use <code>hostnamectl<\/code> so systemd, <code>\/etc\/hostname<\/code>, and the running kernel receive the change through the supported interface.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo hostnamectl set-hostname NEW_HOSTNAME<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>NEW_HOSTNAME<\/code> with the name you chose, such as <code>app01.example.com<\/code> or <code>app01<\/code>. A static hostname cannot contain spaces. AlmaLinux accepts an FQDN, but each DNS label should be no longer than 63 characters and the complete name should stay within normal hostname limits.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you also want a human-readable description, set the optional pretty hostname separately. It may contain spaces and does not replace the machine&#8217;s static name:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo hostnamectl set-hostname \"NEW_PRETTY_NAME\" --pretty<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>NEW_PRETTY_NAME<\/code> with a description such as <code>Production application server<\/code>. The command normally produces no output; check the result with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostnamectl status --static\nhostnamectl status --pretty<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output is similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app01.example.com\nProduction application server<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">According to the <a href=\"https:\/\/docs.redhat.com\/en\/documentation\/red_hat_enterprise_linux\/10\/html\/configuring_and_managing_networking\/changing-a-hostname-by-using-hostnamectl\" target=\"_blank\" rel=\"noopener\">RHEL 10 hostname documentation<\/a>, <code>hostnamectl<\/code> activates the new value through <code>systemd-hostnamed<\/code>, so manually restarting that service is normally unnecessary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Add local name resolution<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An <code>\/etc\/hosts<\/code> entry lets the VPS resolve its own name even when DNS is unavailable during boot or when the DNS record has not propagated yet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First identify the address used by the default route:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ip -4 route get 1.1.1.1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Look for the <code>src<\/code> value in the output. It is the server address to use as <code>SERVER_IP<\/code>. Open the hosts file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/hosts<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the existing <code>localhost<\/code> and IPv6 lines. Add one line using your actual address, the FQDN, and its short alias:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SERVER_IP NEW_HOSTNAME NEW_SHORT_NAME<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if the address is <code>203.0.113.40<\/code> and the hostname is <code>app01.example.com<\/code>, the line would be <code>203.0.113.40 app01.example.com app01<\/code>. Replace all three uppercase placeholders before saving. If you selected only a short hostname, use <code>SERVER_IP NEW_HOSTNAME<\/code> instead. Do not replace the localhost records with the new name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Test the mapping immediately:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>getent hosts NEW_HOSTNAME\nhostname --fqdn<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Successful output contains the server address and the new name:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>203.0.113.40  app01.example.com\napp01.example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your hostname is public, also create the matching A or AAAA record in DNS. The hosts file affects this VPS only; it does not publish the name to the rest of the internet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Use NetworkManager&#8217;s text interface instead<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The command line is quickest, but <code>nmtui<\/code> is useful when you prefer a guided terminal menu or need to set the name while reviewing NetworkManager settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install the optional text interface if it is not already present:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y NetworkManager-tui<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nmtui<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Choose <strong>Set system hostname<\/strong>, enter the new static hostname, select <strong>OK<\/strong>, then choose <strong>Quit<\/strong>. <code>nmtui<\/code> changes the same system hostname managed by <code>hostnamectl<\/code>; it does not create public DNS records or update <code>\/etc\/hosts<\/code> for you. Repeat Step 3 when local resolution is needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Refresh sessions and dependent services<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The hostname changes immediately for new commands, but an existing shell prompt or service may still display the old value until it is restarted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm that the hostname service is active and that the persistent file contains the new value:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl is-active systemd-hostnamed\ncat \/etc\/hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\napp01.example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Reconnect through SSH to refresh your shell prompt. Restart only applications that read the hostname once at startup, using that application&#8217;s service name; do not restart NetworkManager just to apply this hostname change:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart YOUR_SERVICE<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>YOUR_SERVICE<\/code> with a real service only when that application requires it. A reboot is optional, not part of the normal hostname change.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify the new hostname<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run all four checks after editing the name. They confirm the static value, optional pretty value, fully qualified result, and local resolver mapping:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostnamectl status --static\nhostnamectl status --pretty\nhostname --fqdn\ngetent hosts NEW_HOSTNAME<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The static and FQDN checks should show your new hostname, while the pretty check should show the description only if you set one. <code>getent<\/code> should return the address from your <code>\/etc\/hosts<\/code> line or from DNS. If all four results agree, AlmaLinux 10 is using the new identity correctly.<\/p>\n\n\n\n<aside class=\"vl-element vl-cta-banner\" aria-label=\"Name your Linux server\">\n\t<div class=\"vl-cta-banner__content\">\n\t\t<p class=\"vl-cta-banner__eyebrow\">AlmaLinux VPS<\/p>\n\t\t<h3 class=\"vl-cta-banner__title\">Name your Linux server<\/h3>\n\t\t<p class=\"vl-cta-banner__text\">Deploy an AlmaLinux VPS with root access for clean hostname and network configuration.<\/p>\n\t<\/div>\n\t<a class=\"vl-cta-banner__button\" href=\"\/buy-vps\" aria-label=\"View Linux VPS plans\">View Linux VPS plans<\/a>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">The hostname returns after a reboot<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The image&#8217;s provisioning system, DHCP, or cloud-init may be applying its own name during boot. Check whether cloud-init is installed and whether it reports an active configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rpm -q cloud-init\nsudo cloud-init status --long<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If cloud-init manages this server and you want to keep a manually chosen hostname, create a cloud-init override, set the hostname again, and apply the next reboot during a maintenance window:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo install -d -m 0755 \/etc\/cloud\/cloud.cfg.d\nprintf 'preserve_hostname: true\\n' | sudo tee \/etc\/cloud\/cloud.cfg.d\/99-preserve-hostname.cfg<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the VPS image or provider still overwrites the name, change the hostname in the provisioning settings as well.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>hostnamectl: invalid hostname<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Static hostnames cannot contain spaces, underscores, or other punctuation. Use lowercase letters, numbers, hyphens, and dots; set a description with <code>--pretty<\/code> if you need spaces. Also check that no FQDN label begins or ends with a hyphen.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>hostname --fqdn<\/code> shows <code>localhost<\/code> or fails to resolve<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The static hostname is set, but local resolution is incomplete. Add the server&#8217;s real address, FQDN, and short alias to <code>\/etc\/hosts<\/code> as shown in Step 3, then run <code>getent hosts NEW_HOSTNAME<\/code> again. If the name should work from other machines too, add its A or AAAA record to DNS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>nmtui: command not found<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>nmtui<\/code> is an optional NetworkManager package and is not present on every minimal AlmaLinux image. Install <code>NetworkManager-tui<\/code> with <code>dnf<\/code>, or skip the menu and use <code>hostnamectl<\/code>, which is already part of the standard systemd tools.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next steps<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Create forward DNS records for the FQDN and verify them from another machine with <code>getent hosts NEW_HOSTNAME<\/code> or a DNS lookup tool.<\/li>\n\n\n<li>Set a matching reverse-DNS\/PTR record in the VPS control panel if mail, monitoring, or an external security service checks reverse DNS.<\/li>\n\n\n<li>Reconnect your SSH client and update monitoring, backup, and configuration-management inventory if they identify the server by hostname.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need to reboot AlmaLinux 10 after changing the hostname?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. <code>hostnamectl<\/code> applies the static hostname immediately and writes the persistent hostname file. Reconnect your SSH session and restart only services that cache the name at startup.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should I use a short hostname or an FQDN?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use a short name for a simple private server, or an FQDN when the VPS has a domain and services need a stable DNS identity. An FQDN is useful for TLS, mail, monitoring, and multi-server administration, but it still needs DNS or an <code>\/etc\/hosts<\/code> entry to resolve.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does changing the hostname change DNS or reverse DNS?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. The change affects the local operating system only. Add the forward DNS record separately, and configure the PTR record through the system that manages your VPS IP address.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is the difference between a static and pretty hostname?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The static hostname is the machine&#8217;s operational name and is stored in <code>\/etc\/hostname<\/code>. A pretty hostname is an optional descriptive label for people; it can contain spaces and does not replace the static value used by services.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Do I need to reboot AlmaLinux 10 after changing the hostname?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. `hostnamectl` applies the static hostname immediately and writes the persistent hostname file. Reconnect your SSH session and restart only services that cache the name at startup.\"}}, {\"@type\": \"Question\", \"name\": \"Should I use a short hostname or an FQDN?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Use a short name for a simple private server, or an FQDN when the VPS has a domain and services need a stable DNS identity. An FQDN is useful for TLS, mail, monitoring, and multi-server administration, but it still needs DNS or an `\/etc\/hosts` entry to resolve.\"}}, {\"@type\": \"Question\", \"name\": \"Does changing the hostname change DNS or reverse DNS?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. The change affects the local operating system only. Add the forward DNS record separately, and configure the PTR record through the system that manages your VPS IP address.\"}}, {\"@type\": \"Question\", \"name\": \"What is the difference between a static and pretty hostname?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"The static hostname is the machine's operational name and is stored in `\/etc\/hostname`. A pretty hostname is an optional descriptive label for people; it can contain spaces and does not replace the static value used by services.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"change hostname on almalinux 10 with hostnamectl, update local name resolution, prevent cloud-init resets, and verify the new name without rebooting.","protected":false},"author":1,"featured_media":908,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[5,9],"tags":[91,106,93],"class_list":["post-907","post","type-post","status-publish","format-standard","has-post-thumbnail","category-guides","category-vps-hosting","tag-almalinux-10","tag-hostname","tag-linux-vps","cs-entry"],"_links":{"self":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/comments?post=907"}],"version-history":[{"count":1,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/907\/revisions"}],"predecessor-version":[{"id":3700,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/907\/revisions\/3700"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media\/908"}],"wp:attachment":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media?parent=907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/categories?post=907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/tags?post=907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}