Current time: 11-22-2024, 04:41 PM Hello There, Guest! (LoginRegister)


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

Posts: 12
Joined: Apr 2007
Reputation: 0
Post: #1
ispcp Template for vmware
Hi,

I am making a template system from ubuntu 9.04 for my vmware server so I can copy this template to easily create more then one machine. I have successfully installed the ispcp on a test template.

The problem I am having is to change the ipaddress/hostname/mysql passwd/admin passwd/ ans all the configurations related to the different service.

Is their a way to configure the new virtual machines to rerun part of the install process so then when I create a new virtual machine, I can just execute the partial install to update the server to the new configuration?

Or maybe a central config file that I can modify so that the changes in the main config file take effect across the new virtual machine?

Thanks,
08-15-2009 02:53 AM
Find all posts by this user Quote this message in a reply
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
sfera Offline
Junior Member
*

Posts: 129
Joined: Oct 2008
Reputation: 0
Post: #3
RE: ispcp Template for vmware
thx for the script.

Really replace all ? But the script in waht language are wroten? c? shell-script? i need compile it?

Thx in advanced
11-06-2009 12:31 PM
Find all posts by this user Quote this message in a reply
wuhaa Offline
Junior Member
*

Posts: 12
Joined: Apr 2007
Reputation: 0
Post: #4
RE: ispcp Template for vmware
It's an expect script. In ubuntu, you can install it with "aptitude install expect".


(11-06-2009 12:31 PM)sfera Wrote:  thx for the script.

Really replace all ? But the script in waht language are wroten? c? shell-script? i need compile it?

Thx in advanced
02-05-2010 08:11 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


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