0633.html 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Renaming a Proxmox VE Node</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="How To Rename A Proxmox VE Host,How To Rename A Proxmox VE Node,Rename Proxmox Host,Rename Proxmox Node,Change Proxmox Host Name,Change Proxmox Node Name,Debian,Host,Hypervisor,Linux,Node,Proxmox,Proxmox Tutorial,Proxmox VE,Rename,VM,Home Lab,Virtual Machine,Proxmox Node,Proxmox Host,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Renaming a Proxmox VE Node">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  12. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  13. <script type="text/javascript" src="includes/js/steps.js"></script>
  14. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  15. </head>
  16. <body>
  17. <div id="gridContainer">
  18. <div class="topMargin"></div>
  19. <div id="listName" class="topMargin">
  20. <h1>Renaming a Proxmox VE Node</h1>
  21. </div>
  22. <div></div>
  23. <div id="content">
  24. <p>I recently upgraded my homelab Proxmox host server and wanted to repurpose my existing server to use as a testing environment. Below are the steps I used to rename the old Proxmox instance. These steps worked for me. Please let me know in the comments if you try these steps and any issues arise that I didn&#39;t have in my environment.</p>
  25. <p><em>NOTE: Renaming a node that is part of a cluster is not recommended. These steps are intended for standalone nodes. Always make backups of important VMs before attempting to modify the Proxmox host. </em></p>
  26. <ol>
  27. <li>Log into ProxMox VE, either at the console, via SSH or the web UI and launch the web shell</li>
  28. <li>Run the following commands, alternatively you can manually edit each file mentioned with nano or vi and replace the old hostname with the new one
  29. <div class="codeBlock"># set the old hostname and write to ini<br />
  30. echo &quot;OLD_HOSTNAME=$(hostname)&quot; &gt; ~/pmrename.ini<br />
  31. # set the new hostname in ini, update as needed<br />
  32. echo &quot;NEW_HOSTNAME=vm-dev&quot; &gt;&gt; ~/pmrename.ini<br />
  33. # read variables from ini<br />
  34. source &lt;(grep = ~/pmrename.ini)<br />
  35. # edit hostname file<br />
  36. sed -i.bak &quot;s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi&quot; /etc/hostname<br />
  37. # edit hosts file<br />
  38. sed -i.bak &quot;s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi&quot; /etc/hosts<br />
  39. # edit mailname if it exists<br />
  40. [ -e &quot;/etc/mailname&quot; ] &amp;&amp; sed -i.bak &quot;s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi&quot; /etc/mailname<br />
  41. # edit main.cf if it exists<br />
  42. [ -e &quot;/etc/postfix/main.cf&quot; ] &amp;&amp; sed -i.bak &quot;s/$OLD_HOSTNAME/$NEW_HOSTNAME/gi&quot; /etc/postfix/main.cf<br />
  43. # copy config files to new node name<br />
  44. cp &quot;/var/lib/rrdcached/db/pve2-node/$OLD_HOSTNAME&quot; &quot;/var/lib/rrdcached/db/pve2-node/$NEW_HOSTNAME&quot; -r<br />
  45. cp &quot;/var/lib/rrdcached/db/pve2-storage/$OLD_HOSTNAME&quot; &quot;/var/lib/rrdcached/db/pve2-storage/$NEW_HOSTNAME&quot; -r<br />
  46. cp &quot;/var/lib/rrdcached/db/pve2-$OLD_HOSTNAME&quot; &quot;/var/lib/rrdcached/db/pve2-$NEW_HOSTNAME&quot; -r<br />
  47. # reboot<br />
  48. reboot now</div>
  49. </li>
  50. <li>Wait for the Proxmox host to come back up</li>
  51. <li>Log back in and continue with the following commands
  52. <div class="codeBlock"># read variables from ini<br />
  53. source &lt;(grep = ~/pmrename.ini)<br />
  54. # update storage config<br />
  55. sed -i.bak &quot;s/nodes $OLD_HOSTNAME/nodes $NEW_HOSTNAME/gi&quot; /etc/pve/storage.cfg<br />
  56. # mv vm configs<br />
  57. mv /etc/pve/nodes/$OLD_HOSTNAME/qemu-server/*.conf /etc/pve/nodes/$NEW_HOSTNAME/qemu-server/<br />
  58. # mv ct configs<br />
  59. mv /etc/pve/nodes/$OLD_HOSTNAME/lxc/*.conf /etc/pve/nodes/$NEW_HOSTNAME/lxc/</div>
  60. </li>
  61. <li>Test that Proxmox web UI and all VMs are working as intended</li>
  62. </ol>
  63. <h2>Cleaning Up</h2>
  64. <ol>
  65. <li>After fully testing everything is working, run the following commands to clean up backup files
  66. <div class="codeBlock"># read variables from ini<br />
  67. source &lt;(grep = ~/pmrename.ini)<br />
  68. rm /etc/hostname.bak &amp;&amp; rm /etc/hosts.bak<br />
  69. [ -e &quot;/etc/mailname.bak&quot; ] &amp;&amp; rm /etc/mailname.bak<br />
  70. [ -e &quot;/etc/postfix/main.cf.bak&quot; ] &amp;&amp; rm /etc/postfix/main.cf.bak<br />
  71. rm /var/lib/rrdcached/db/pve2-node/$OLD_HOSTNAME -r<br />
  72. rm /var/lib/rrdcached/db/pve2-storage/$OLD_HOSTNAME -r<br />
  73. rm /var/lib/rrdcached/db/pve2-$OLD_HOSTNAME -r<br />
  74. rm /etc/pve/nodes/$OLD_HOSTNAME -r<br />
  75. rm /etc/pve/storage.cfg.bak<br />
  76. rm ~/pmrename.ini</div>
  77. </li>
  78. </ol>
  79. <p>Source: <a href="https://pve.proxmox.com/wiki/Renaming_a_PVE_node" target="_blank">https://pve.proxmox.com/wiki/Renaming_a_PVE_node</a></p>
  80. </div>
  81. </div>
  82. </body>
  83. </html>