Current time: 11-30-2024, 01:30 AM Hello There, Guest! (LoginRegister)


Post Reply 
ispcp Template for vmware
Author Message
wuhaa Offline
Junior Member
*

Posts: 12
Joined: Apr 2007
Reputation: 0
Post: #2
RE: ispcp Template for vmware
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"

} } }
08-21-2009 03:56 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
ispcp Template for vmware - wuhaa - 08-15-2009, 02:53 AM
RE: ispcp Template for vmware - wuhaa - 08-21-2009 03:56 AM
RE: ispcp Template for vmware - sfera - 11-06-2009, 12:31 PM
RE: ispcp Template for vmware - wuhaa - 02-05-2010, 08:11 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)