0155.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Running an Amazon Linux (AL2) VM in Proxmox</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Home Lab,Home Lab Ideas,Hypervisor,Install Guide,Self-Hosted,How To Install Amazon Linux On Proxmox,How To Run Amazon Linux On Proxmox VE,Linux,Proxmox,Proxmox Host,Proxmox Step By Step,Proxmox Tutorial,Proxmox VE,VM,Virtual Machine,Virtualization,Amazon Linux,AL2,Amaonz Linux 2,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Running an Amazon Linux (AL2) VM in Proxmox">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="11/17/2024 09:31:43 AM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Running an Amazon Linux (AL2) VM in Proxmox</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is Amazon Linux?</h2>
  26. <blockquote><em>Amazon Linux 2 is a Linux operating system from Amazon Web Services (AWS). It provides a security-focused, stable, and high-performance execution environment to develop and run cloud applications. -<a href="https://aws.amazon.com/amazon-linux-2" target="_blank">https://aws.amazon.com/amazon-linux-2</a></em></blockquote>
  27. <h2>Creating the VM</h2>
  28. <ol>
  29. <li>Open a web browser and navigate to the ProxMox web UI (ie https://ProxMoxDNSorIP:8006/)</li>
  30. <li>Right click the Proxmox node name &gt; Create VM</li>
  31. <li>Give the VM a unique ID and Name &gt; Next</li>
  32. <li>On the OS tab, Select Do not use any media, leave the Type as Linux and the Version as 5.x - 2.6 Kernel &gt; Next</li>
  33. <li>On the System tab, leave the defaults and check the Qemu Agent box to enable it &gt; Next</li>
  34. <li>On the Hard Disk tab, delete the scsi0 disk &gt; Next</li>
  35. <li>On the CPU tab, set Cores to 1 or more and Type to host &gt; Next</li>
  36. <li>On the Memory tab, set the Memory to 512 or more &gt; Next</li>
  37. <li>Leave the defaults on the Network tab &gt; Next</li>
  38. <li>Verify the summary and click Finish</li>
  39. <li>Click the Proxmox node in the left navigation menu &gt; Shell</li>
  40. <li>Run the following commands in the web shell
  41. <div class="codeBlock CMD"># lookup the latest amazon linux file name<br />
  42. regex=&#39;&lt;td&gt;&lt;a href=&quot;([^/]*\.qcow2)&quot;&gt;[^/]*&lt;\/a&gt;&lt;\/td&gt;&#39; &amp;&amp; response=$(curl -s -L https://cdn.amazonlinux.com/os-images/latest/kvm/) &amp;&amp; [[ $response =~ $regex ]] &amp;&amp; downloadURL=&quot;${BASH_REMATCH[1]}&quot;<br />
  43. # download the amazon linux virtual disk<br />
  44. wget -O /tmp/al2.qcow2 https://cdn.amazonlinux.com/os-images/latest/kvm/$downloadURL<br />
  45. # import the downloaded virtual disk<br />
  46. # update the vmid and destination storage pool to match your environment<br />
  47. # usage<br />
  48. # qm importdisk &lt;%target vmid%&gt; &lt;%path to source disk%&gt; &lt;%destination storage device%&gt; [OPTIONS]<br />
  49. qm importdisk 2000 /tmp/al2.qcow2 SSD_100GB</div>
  50. </li>
  51. <li>Once the import completes, select the newly created Amazon Linux VM from the left navigation panel</li>
  52. <li>Select Hardware from the left sub-navigation menu</li>
  53. <li>Double click the Unused Disk to edit it &gt; Click the Add button</li>
  54. <li>Click the Add dropdown &gt; CloudInit Drive</li>
  55. <li>Set the target storage for the CloudInit drive &gt; Click the Add button</li>
  56. <li>Select Cloud-Init from the left sub-navigation menu</li>
  57. <li>Edit each of the Cloud-Init fields to set a username, password and DNS/network parameters</li>
  58. <li>Select Options from the left sub-navigation menu</li>
  59. <li>Double click Boot Order</li>
  60. <li>Check the Enabled box next to the hard disk and drag it up in the boot order as needed, typically below the CD-ROM device</li>
  61. <li>Click OK</li>
  62. <li>Click the Start button in the top right of the screen</li>
  63. <li>Select Console from the left sub-navigation menu to watch the boot process</li>
  64. </ol>
  65. <h2>Setting Up Amazon Linux 2</h2>
  66. <ol>
  67. <li>Once the boot process completes, login with the username and password set in the Cloud-Init settings earlier</li>
  68. <li>Run the following commands in the terminal
  69. <div class="codeBlock CMD"># elavate to root<br />
  70. sudo su<br />
  71. # enable hostname preservation in cloud-init config<br />
  72. echo -e &quot;\npreserve_hostname: true&quot; &gt;&gt; /etc/cloud/cloud.cfg<br />
  73. # set the hostname<br />
  74. hostnamectl set-hostname amazon-linux<br />
  75. # output hostname details<br />
  76. hostnamectl<br />
  77. # update software repositories<br />
  78. yum check-update<br />
  79. # install available updates<br />
  80. yum update<br />
  81. # install qemu-guest-agent<br />
  82. yum install qemu-guest-agent -y<br />
  83. # shutdown<br />
  84. shutdown now<vmid><storage></storage></vmid></div>
  85. <strong> </strong></li>
  86. <li>Once the VM has shutdown completely, power it back up on clicking the Start button at the top right of the screen</li>
  87. <li>After the boot process completes, login back in</li>
  88. <li>Continue with the following command in the terminal
  89. <div class="codeBlock CMD"># verify hostname details were retained<br />
  90. sudo hostnamectl</div>
  91. <strong> </strong></li>
  92. <li>Welcome to Amazon Linux running in Proxmox</li>
  93. </ol> </div>
  94. </div>
  95. </body>
  96. </html>