Running an Amazon Linux (AL2) VM in Proxmox
#AmazonLinux #Proxmox #AL2VM
Full steps can be found at https://i12bretro.github.io/tutorials/0155.html
--------------------------------------------------------------------
What is Amazon Linux?
--------------------------------------------------------------------
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. - https://aws.amazon.com/amazon-linux-2
--------------------------------------------------------------------
Creating the VM
--------------------------------------------------------------------
01. Open a web browser and navigate to the ProxMox web UI (ie https://ProxMoxDNSorIP:8006/)
02. Right click the Proxmox node name ≫ Create VM
03. Give the VM a unique ID and Name ≫ Next
04. On the OS tab, Select Do not use any media, leave the Type as Linux and the Version as 5.x - 2.6 Kernel ≫ Next
05. On the System tab, leave the defaults and check the Qemu Agent box to enable it ≫ Next
06. On the Hard Disk tab, delete the scsi0 disk ≫ Next
07. On the CPU tab, set Cores to 1 or more and Type to host ≫ Next
08. On the Memory tab, set the Memory to 512 or more ≫ Next
09. Leave the defaults on the Network tab ≫ Next
10. Verify the summary and click Finish
11. Click the Proxmox node in the left navigation menu ≫ Shell
12. Run the following commands in the web shell
lookup the latest amazon linux file name
regex='≪td≫≪a href="([^/]*\.qcow2)"≫[^/]*≪\/a≫≪\/td≫' && response=$(curl -s -L https://cdn.amazonlinux.com/os-images/latest/kvm/) && [[ $response =~ $regex ]] && downloadURL="${BASH_REMATCH[1]}"
download the amazon linux virtual disk
wget -O /tmp/al2.qcow2 https://cdn.amazonlinux.com/os-images/latest/kvm/$downloadURL
import the downloaded virtual disk
update the vmid and destination storage pool to match your environment
usage
qm importdisk ≪%target vmid%≫ ≪%path to source disk%≫ ≪%destination storage device%≫ [OPTIONS]
qm importdisk 2000 /tmp/al2.qcow2 SSD_100GB
13. Once the import completes, select the newly created Amazon Linux VM from the left navigation panel
14. Select Hardware from the left sub-navigation menu
15. Double click the Unused Disk to edit it ≫ Click the Add button
16. Click the Add dropdown ≫ CloudInit Drive
17. Set the target storage for the CloudInit drive ≫ Click the Add button
18. Select Cloud-Init from the left sub-navigation menu
19. Edit each of the Cloud-Init fields to set a username, password and DNS/network parameters
20. Select Options from the left sub-navigation menu
21. Double click Boot Order
22. 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
23. Click OK
24. Click the Start button in the top right of the screen
25. Select Console from the left sub-navigation menu to watch the boot process
--------------------------------------------------------------------
Setting Up Amazon Linux 2
--------------------------------------------------------------------
01. Once the boot process completes, login with the username and password set in the Cloud-Init settings earlier
02. Run the following commands in the terminal
elavate to root
sudo su
enable hostname preservation in cloud-init config
echo -e "\npreserve_hostname: true" ≫≫ /etc/cloud/cloud.cfg
set the hostname
hostnamectl set-hostname amazon-linux
output hostname details
hostnamectl
update software repositories
yum check-update
install available updates
yum update
install qemu-guest-agent
yum install qemu-guest-agent -y
shutdown
shutdown now
03. Once the VM has shutdown completely, power it back up on clicking the Start button at the top right of the screen
04. After the boot process completes, login back in
05. Continue with the following command in the terminal
verify hostname details were retained
sudo hostnamectl
06. Welcome to Amazon Linux running in Proxmox
Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro