Browse Source

0155: Running an Amazon Linux (AL2) VM in Proxmox

i12bretro 7 months ago
parent
commit
d1cd2173ae
1 changed files with 102 additions and 0 deletions
  1. 102 0
      0155.html

+ 102 - 0
0155.html

@@ -0,0 +1,102 @@
+    <!DOCTYPE html>
+    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+      <head>
+        <title>Running an Amazon Linux (AL2) VM in Proxmox</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+        <meta charset="UTF-8">
+        <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">
+        <meta name="author" content="i12bretro">
+        <meta name="description" content="Running an Amazon Linux (AL2) VM in Proxmox">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <meta name="revised" content="11/17/2024 09:31:43 AM" />
+				          <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
+				  <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
+				        <script type="text/javascript" src="includes/js/steps.js"></script>
+        <link href="css/steps.css" rel="stylesheet" type="text/css" />
+      </head>
+      <body>
+        <div id="gridContainer">
+          <div class="topMargin"></div>
+          <div id="listName" class="topMargin">
+            <h1>Running an Amazon Linux (AL2) VM in Proxmox</h1>
+          </div>
+          <div></div>
+          <div id="content">
+          <h2>What is Amazon Linux?</h2>
+
+<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>
+
+<h2>Creating the VM</h2>
+
+<ol>
+	<li>Open a web browser and navigate to the ProxMox web UI (ie https://ProxMoxDNSorIP:8006/)</li>
+	<li>Right click the Proxmox node name &gt; Create VM</li>
+	<li>Give the VM a unique ID and Name &gt; Next</li>
+	<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>
+	<li>On the System tab, leave the defaults and check the Qemu Agent box to enable it &gt; Next</li>
+	<li>On the Hard Disk tab, delete the scsi0 disk &gt; Next</li>
+	<li>On the CPU tab, set Cores to 1 or more and Type to host &gt; Next</li>
+	<li>On the Memory tab, set the Memory to 512 or more &gt; Next</li>
+	<li>Leave the defaults on the Network tab &gt; Next</li>
+	<li>Verify the summary and click Finish</li>
+	<li>Click the Proxmox node in the left navigation menu &gt; Shell</li>
+	<li>Run the following commands in the web shell
+	<div class="codeBlock CMD"># lookup the latest amazon linux file name<br />
+	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 />
+	# download the amazon linux virtual disk<br />
+	wget -O /tmp/al2.qcow2 https://cdn.amazonlinux.com/os-images/latest/kvm/$downloadURL<br />
+	# import the downloaded virtual disk<br />
+	# update the vmid and destination storage pool to match your environment<br />
+	# usage<br />
+	# qm importdisk &lt;%target vmid%&gt; &lt;%path to source disk%&gt; &lt;%destination storage device%&gt; [OPTIONS]<br />
+	qm importdisk 2000 /tmp/al2.qcow2 SSD_100GB</div>
+	</li>
+	<li>Once the import completes, select the newly created Amazon Linux VM from the left navigation panel</li>
+	<li>Select Hardware from the left sub-navigation menu</li>
+	<li>Double click the Unused Disk to edit it &gt; Click the Add button</li>
+	<li>Click the Add dropdown &gt; CloudInit Drive</li>
+	<li>Set the target storage for the CloudInit drive &gt; Click the Add button</li>
+	<li>Select Cloud-Init from the left sub-navigation menu</li>
+	<li>Edit each of the Cloud-Init fields to set a username, password and DNS/network parameters</li>
+	<li>Select Options from the left sub-navigation menu</li>
+	<li>Double click Boot Order</li>
+	<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>
+	<li>Click OK</li>
+	<li>Click the Start button in the top right of the screen</li>
+	<li>Select Console from the left sub-navigation menu to watch the boot process</li>
+</ol>
+
+<h2>Setting Up Amazon Linux 2</h2>
+
+<ol>
+	<li>Once the boot process completes, login with the username and password set in the Cloud-Init settings earlier</li>
+	<li>Run the following commands in the terminal
+	<div class="codeBlock CMD"># elavate to root<br />
+	sudo su<br />
+	# enable hostname preservation in cloud-init config<br />
+	echo -e &quot;\npreserve_hostname: true&quot; &gt;&gt; /etc/cloud/cloud.cfg<br />
+	# set the hostname<br />
+	hostnamectl set-hostname amazon-linux<br />
+	# output hostname details<br />
+	hostnamectl<br />
+	# update software repositories<br />
+	yum check-update<br />
+	# install available updates<br />
+	yum update<br />
+	# install qemu-guest-agent<br />
+	yum install qemu-guest-agent -y<br />
+	# shutdown<br />
+	shutdown now<vmid><storage></storage></vmid></div>
+	<strong> </strong></li>
+	<li>Once the VM has shutdown completely, power it back up on clicking the Start button at the top right of the screen</li>
+	<li>After the boot process completes, login back in</li>
+	<li>Continue with the following command in the terminal
+	<div class="codeBlock CMD"># verify hostname details were retained<br />
+	sudo hostnamectl</div>
+	<strong> </strong></li>
+	<li>Welcome to Amazon Linux running in Proxmox</li>
+</ol>          </div>
+        </div>
+      </body>
+    </html>
+