VM with Cloud Init Installer Script
OpsLinuxSec CLOUD INIT INSTALLER is an installer script that allows you to easily configure and install various OS on Proxmox Virtual Environment (PVE) using CLOUD INIT. If the desired ISO is not available in the /var/lib/vz/images/
directory, this script will automatically download it for you.
Prerequisites
Make sure your system has the following dependencies:
- wget: to download the ISO
- Proxmox VE: to run the VM
- Root: this tool requires root access
Checking and Installing Dependencies
This script will check if the required dependencies are installed. If not, it will automatically install them.
Usage Steps
-
Download and Prepare the Script
Download the script and make sure the file is executable:
wget https://github.com/ryanachmad12/cloud-init-prox-script/raw/refs/heads/main/installer.sh
chmod +x installer.sh -
Run the Installer Script
Run the script with the following command:
bash installer.sh
Installation Process
When running the script, here are the steps that will be followed:
-
Checking Dependencies
The script will check if the required dependencies are installed.
Checking dependencies...
Dependencies are already installed. -
Select Available OS
After checking the dependencies, you will see the main menu:
=============================
OpsLinuxSec
=============================
Please select for installation
=============================
OpsLinuxSec
=============================
1. Select Available OS
2. Custom OS (Your own image via link)
3. Exit
Your choice:- Choose 1 to select an available OS.
- Choose 2 to use your own download link.
- Choose 3 to exit the installer.
-
Select OS Distro
After selecting "Select Available OS", you will be prompted to choose a distro:
=============================
OpsLinuxSec
=============================
Choose Distro:
1. Ubuntu
2. Debian
3. Exit
Your choice:- Choose the distro you want, for example, Ubuntu.
-
Select Ubuntu Version
After choosing Ubuntu, select the desired version:
===========================
SELECT VERSION
UBUNTU
===========================
1. 20.04
2. 22.04
3. 24.04
4. Exit
Your choice:Choose the version that fits, for example, 1 for Ubuntu 20.04.
-
Check Image Availability
If the ISO file is not found or has a different name in the
/var/lib/vz/images/
directory, the script will show this message and ask if you want to download it:File not found in /var/lib/vz/images/focal-server-cloudimg-amd64.img.
Please download the ISO for Ubuntu 20.04 and rename the file to focal-server-cloudimg-amd64.img.
Would you like to download it? (yes/no):- Choose yes to download the ISO or no to rename it manually.
-
Resize Disk and VM Settings
After the ISO is available, you will be prompted to specify the disk size and VM ID. Here are the steps:
Enter the desired disk size (GB): 6
Image resized.
Disk size successfully changed to 6G.If the VM already exists, you will be asked to enter a different VM ID.
Enter VM ID: 123
VM with ID 123 already exists. Please enter a different VM ID.If the VM ID doesn't exist, you'll be prompted to enter further details such as the VM name, memory size, and number of cores:
Enter VM ID: 222
Enter VM Name: example
Enter memory size (MB): 512
Enter number of cores (default 1):
Enable agent (default 1):
VM 222 successfully created with name example. -
Select Target Disk
After creating the VM, you'll choose the target disk:
Target Disk
┌────────────────┬───────────┬─────────┬────────┬───────────┬─────────┬────────┬───────────┬───────────┬───────────────┐
│ content │ storage │ type │ active │ avail │ enabled │ shared │ total │ used │ used_fraction │
╞════════════════╪═══════════╪═════════╪════════╪═══════════╪═════════╪════════╪═══════════╪═══════════╪═══════════════╡
│ rootdir,images │ local-lvm │ lvmthin │ 1 │ 10.10 GiB │ 1 │ 0 │ 11.80 GiB │ 1.70 GiB │ 14.42% │
└────────────────┴───────────┴─────────┴────────┴───────────┴─────────┴────────┴───────────┴───────────┴───────────────┘
Enter target storage (e.g., local-lvm): local-lvm -
Completion Process
After the configuration is finished, the VM creation and configuration will proceed automatically.
VM with ID 222 has been created and configured.
Please configure the network settings in the VM settings as needed.
Creating a Template
Once the VM is created, you can turn it into a template for future cloning.
Notes
- Ensure you have enough disk space to store the ISO and VM files.
- Ensure the VM network configuration is correct after creation.
OpsLinuxSec simplifies the process of installing and configuring operating systems on Proxmox. With automatic downloads and VM settings, you can save time in virtualization management.
Explanation:
- General Instructions: Describes how to use the script and the steps to run it.
- Installation and Configuration Process: Details the steps the script will take, including OS selection, ISO downloading, disk resizing, and VM creation.
- Dependencies: The script will ensure the required dependencies are installed before continuing.
- Choose Distro and Version: Offers the option to choose a distro (Ubuntu/Debian) and the version of the OS to be used.
- ISO Download: Automatically downloads the ISO if the file is missing on the system.
- VM Creation and Configuration: Specifies VM settings, including disk, VM ID, memory, and cores.