Configuring The Amazon Linux 2023 Image For VMware
Guide: Configuring the Amazon Linux 2023 Image
1. Requirements
Before you begin, make sure you have the following tools:
- OVA file for VMware: Download the latest version.
- A Linux machine (Ubuntu or any other distribution).
- VS Code for creating files without a
.txt
extension.
2. Importing the OVA into vSphere
- Go to the desired OU in vSphere.
- Right-click and select “Deploy OVF Template”.
- Upload the OVA file downloaded in step 1.
- Follow the installation wizard and adjust the settings as needed. Important: Do not start the VM after completing the setup!
3. Creating Configuration Files
- Open VS Code and create two files:
user-data
meta-data
- Paste the following content into
user-data
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#cloud-config
# This file configures a user and sets up SSH settings.
users:
- name: myusername # Change 'myusername' to your desired username (e.g., 'root' or 'admin')
sudo: ALL=(ALL) NOPASSWD:ALL # Grants the user sudo privileges without a password
groups: sudo
shell: /bin/bash
lock_passwd: false # Ensures the password is not locked
# Optional: Add an SSH key for key-based login (instead of a password)
# Uncomment and replace the example SSH key with your own if you want to use it.
# ssh_authorized_keys:
# - ssh-rsa AAAAB3...jouw-ssh-key...rest-van-key
# Replace 'myusername' and 'mypassword' with your desired login credentials
chpasswd:
list: |
myusername:mypassword
expire: false # Password does not expire automatically
# Enable password authentication and root login
ssh_pwauth: true # Allow logging in with a password
disable_root: false # Ensure root can log in
# Configure SSH settings to allow password login and root access
write_files:
- path: /etc/ssh/sshd_config
content: |
Port 22 # Change this if you want to use a different SSH port
PermitRootLogin yes # Allow logging in as root
PasswordAuthentication yes # Enable password login
ChallengeResponseAuthentication no
UsePAM yes
append: true # Ensures the settings are added instead of overwritten
# Execute commands after the server is set up
runcmd:
- systemctl restart sshd # Restart SSH so the changes take effect immediately
- Replace
YOUR_SSH_PUBLIC_KEY_HERE
with the OpenSSH key copied earlier. - Replace
myusername
andmypassword
with your desired credentials. - Paste the following into
meta-data
:
1
local-hostname: desired-hostname
4. Creating the ISO File
- Open your Linux machine.
- Navigate to the directory where
user-data
andmeta-data
are stored:1
cd /path/to/your/files
- Install
cloud-image-utils
(if not installed):1
sudo apt install cloud-image-utils
- Create the ISO file:
1
cloud-localds seed.iso user-data meta-data
- Verify that
seed.iso
was created successfully.
5. Uploading the ISO to the VM
- Edit the VM settings.
- Add a CD/ROM drive.
- Select the previously created
seed.iso
. - Start the VM – the configuration is now applied!
6. Troubleshooting
- Validate cloud-init configuration:
1 2
cloud-init schema --config-file user-data cloud-init schema --config-file meta-data
- For further assistance, refer to the Amazon Linux 2023 official documentation.
This post is licensed under CC BY 4.0 by the author.