So in case someone else needs to do this, I have managed to do this to some extent.
This is based on Ubuntu 9.04
I Created a vm image by installing ubuntu 9.04 and whatever else was needed (vim, iftop, screen etc...).
Then I installed all the packages needed by ispCP
(I usedispcp 1.0.0 and the package list was not available for 9.04, so I used the one from the trunk releases)
Next I used this image to clone my install onto a second machine.
Then I wrote a small expect script which sshed into the new vm and executed all the necessary commands EXCEPT the package install step.
Here are the guts of the expect script
Code:
set UsrCmd {$ }
set AdmCmd {# }
set vmAddr [lindex $argv 0]
set vmUser [lindex $argv 1]
set vmPass [lindex $argv 2]
set vmName [lindex $argv 3]
set vmDomain [lindex $argv 4]
set vmMysqlPass [lindex $argv 5]
set vmFtpPass [lindex $argv 6]
set vmPmaPass [lindex $argv 7]
expect "$AdmCmd"
send -- "cd /root\r"
expect "$AdmCmd"
send -- "mysqladmin -u root -p password $vmMysqlPass\r"
expect "Enter password: "
send -- "Password-Set-At-Install\r"
expect "$AdmCmd"
send -- "wget .....ispcp-omega-1.0.0.tar.gz\r"
expect "$AdmCmd"
send -- "tar zxf ispcp-omega-vm-1.0.0.tar.gz\r"
expect "$AdmCmd"
send -- "cd ./ispcp-omega-1.0.0\r"
expect "$AdmCmd"
send -- "aptitude update\r"
expect "$AdmCmd"
send -- "make -f Makefile.ubuntu install \r"
expect "$AdmCmd"
send -- "cp -R /tmp/ispcp/* /\r"
expect "$AdmCmd"
send -- "cd /var/www/ispcp/engine/setup\r"
expect "$AdmCmd"
send -- "perl ispcp-setup\r"
expect {
"$vmUser@$vmAddr's password: " {
send -- "$vmPass\r"
expect "$UsrCmd"
send -- "sudo -i\r"
expect {
"$vmUser: " {
send -- "$vmPass\r"
expect "]: "
send -- "\r"
expect "]:"
send -- "\r"
expect "]: "
send -- "\r"
expect "localhost]: "
send -- "\r"
expect "ispcp]: "
send -- "\r"
expect "root]: "
send -- "\r"
expect "none]: "
send -- "$vmMysqlPass\r"
expect "password: "
send -- "$vmMysqlPass\r"
expect "vftp]: "
send -- "\r"
expect "auto generate]: "
send -- "$vmFtpPass\r"
expect "password: "
send -- "$vmFtpPass\r"
expect "pma]: "
send -- "\r"
expect "auto generate]: "
send -- "$vmPmaPass\r"
expect "password: "
send -- "$vmPmaPass\r"
expect "admin]: "
send -- "\r"
expect "password: "
send -- "$vmPass\r"
expect "password: "
send -- "$vmPass\r"
expect "address: "
send -- "myemail@mydomain.com\r"
expect "]: "
send -- "\r"
expect "none]: "
send -- "\r"
expect "fcgid]: "
send -- "\r"
expect "no]: "
send -- "yes\r"
expect "dynamic]: "
send -- "\r"
expect "$AdmCmd"
send -- "/etc/init.d/apache2 restart\r"
expect "$AdmCmd"
send -- "/etc/init.d/postfix restart\r"
expect "$AdmCmd"
send -- "rm -fR /tmp/ispcp /root/ispcp-omega-1.0.0 /root/ispcp-omega-1.0.0.tar.gz \r"
expect "$AdmCmd"
send -- "sync\r"
expect "$AdmCmd"
send -- "shutdown -r now\r"
expect "$AdmCmd"
send -- "exit\r"
expect "$UsrCmd"
send -- "exit\r"
} } }