Post-Installation script

vongolashu

New Member
Feb 9, 2017
2
0
1
28
Is there any way to run a post-installation script (bash) when a new VM is created using a fresh linux image or a template ?

I want to create and setup Nginx/FTP (well LEMP) automatically when a new VM is created.
I thought about creating a template with both of them installed but that will leave the problem of passwords being pre-generated or not known.

PS: Above use-case is to deploy the VM through WHMCS module
 
Is there any way to run a post-installation script (bash) when a new VM is created using a fresh linux image or a template ?

I want to create and setup Nginx/FTP (well LEMP) automatically when a new VM is created.
I thought about creating a template with both of them installed but that will leave the problem of passwords being pre-generated or not known.

PS: Above use-case is to deploy the VM through WHMCS module

A VM can be created via CLI as follows:

Code:
qm create <vmid> [OPTIONS]

This command string you can put into a script and add additional commands as you like.

See also
Code:
man qm
 
A VM can be created via CLI as follows:

Code:
qm create <vmid> [OPTIONS]

This command string you can put into a script and add additional commands as you like.

See also
Code:
man qm

Sorry I didn't quite get it, can you please provide a example command to create a VM and then run a command line/bash in hat VM ?
For example, if I want to run command "apt-get install nginx" after VM creation automatically
 
Sorry I didn't quite get it, can you please provide a example command to create a VM and then run a command line/bash in hat VM ?
For example, if I want to run command "apt-get install nginx" after VM creation automatically

you need to do this yourself - there's a myriad of solutions out there, ranging from "roll your own shell scripts" to stuff like chef/puppet/ansible/..
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!