While playing around with the new VMware vCloud Director, I found myself rebuilding the vCD system twice. This meant I needed to automate the deployment so I did not have to do it for the third time if needed. The following script is used to deploy VMware vCloud Director and Oracle Express database on a single CentOS 5.5 64bit system. This setup is very similar to the one documented by Duncan Epping - Creating a vCD Lab on your Mac/Laptop, though our setup is running in our ghettoDatacenter.
This script will assume that you have installed CentOS 5.5 64bit OS on a system and it has direct or proxy access to the internet. You will also need to make sure you have provisioned two virtual NICs for the system, which the second one will automatically be configured for you.
UPDATE: The scripts below have been updated to support the latest release of vCloud Director 5.1.
For our setup, I used CentOS-5.5-x86_64-netinstall.iso to do a network installation using ftp://ftp.cs.ucsb.edu/mirrors/centos/5.5/os/x86_64/images and using all the defaults for "Server" type deployment. Since I can not re-distribute the installers for VMware vCloudr Director and Oracle Express, you will need to download the installers and transfer it to your CentOS system. The last step before you being is to transfer the vcd_setup.sh script and vcd.rsp response file to your CentOS system.
Download: vcd_setup.sh
Download: vcd.rsp
You will need make a few tiny edits the vcd.resp file to fit your environment which will be used to deploy vCD and Oracle Express, including the configurations.
Here is the sample vcd.resp that is included:
If you have read Duncan's vCD article or the vCD installation guide, you will be familiar with all these configurations. The only required changes you will need to make will be the secondary IP Address and the passwords for Oracle Database. Once you have made all the necessary edits, we can start the installation.
You should have the following 4 files located in the same directory on your vCD system:
- vcd_setup.sh
- vcd.resp
- oracle-xe-10.2.0.1-1.0.i386.rpm
- vmware-cloud-director-1.0.0-285979.bin
Note: Make sure you set the executable permission on the vcd_setup.sh, else you will get a permission denied error.
1. Start the installation and type y to begin:
The script will exit if it can not locate both vCD and Oracle Express installers, make sure those are available in the same working directory.
2. The YUM repository will be configured from a generic mirrorlist from CentOS and package dependency for vCD will begin:
3. The next section is disabling the firewall and selinux which is not a best practices, but for a lab, this is fine. NTP is also configured and enabled upon bootup:
4. Oracle Express will now be installed and configured based on the initial configuration file passed to the script (vcd.rsp). An oracle response file is created in /tmp which allows for a silent and unattended installation:
5. Per VMware's best practices, two separate tables spaces (CLOUD_DATA and CLOUD_INDX) are created along with a separate user account with the required privileges per the documentation using sqlplus and configuration file generated on the fly:
6. We now configure the secondary IP Address and generate the keystore for both HTTP and CONSOLE PROXY and stores it in /opt/keystore/certificates.ks:
Note: Make sure that both IP Addresses used for HTTP and CONSOLE PROXY have both their forward and reverse DNS properly configured. The "host" utility will be used to query their hostnames which is used in creating the keystore certificates.
7. vCloud Director will not be installed which actually extracts an embedded RPM for the actual installation:
8. We now configure vCloud Director from our response file and a configuration file is generated again for a silent and unattended installation:
Note: The script does not cover syslog server and syslog port configuration. If you need this, you can easily edit the script to support this.
9. Once the vCloud Director installation and schema creation is completed, vCloud Director is finished installing:
10. Now we can start vCloud Director and wait for the initialization to be completed which the script watches /opt/vmware/cloud-director/logs/vcloud-container-info.log for completion:
11. You can now open up your browser point it to your vCD system and if everything went accordingly, you should see vCloud Director landing page:
I hope this script will be helpful for those that want to kick the tires on vCloud Director but prefer not to go through all the manual steps of configuring an Oracle database and vCD. In total, the script took ~8minutes to complete from start to finish.
Anonymous says
I have tried your script - it seems to work flawless - I go through the wizard afterwords and create an adminitrator account. But trying to login with that admnistrator account I get: "Could not connect to server". Any ideas?
Anthony says
Hi, I have the 2 IPv4 error :/ CentOS 5.5 x64 on ESX 4.0 i tried flexible,E1000 and vmxnet 3.
“VMware Cloud Director requires at least two IPv4 addresses in order to operate.”
I tried with 1 nic and virtual interface, 2 nic, 3 nic and 4 nic.
Every time it failed 🙁
Have you an idea ?
Anthony says
Here is the solution that i found 😉
I just reinstall CentOS from the begining with 2 nic card (E1000) and now it works !! changing the nic card type after the installation did not work (in my case).
Tkx again for your clear tutorial !! 🙂
157550640 says
Hi,
even when configuring two NICs infront of setup i get the Message: “VMware Cloud Director requires at least two IPv4 addresses in order to operate.”
Any idea?
William says
@157550640
Take a look at the post by Anthony on Oct 1, vCD is probably not detecting the secondary interface. Either reboot the host or try adding two vNICs before installing your OS
157550640 says
Hi, reboot doesnt work!
This error message was created because of the language I'm using for the bash environment.
The following function relies on a system-output which can be different in other languages:
function check_ip_addresses () {
ipv4=$(/sbin/ifconfig -a | grep 'inet addr' | grep -c 'Bcast')
if [ $ipv4 -lt $REQUIRED_IP_COUNT ]; then
fmt -w$WIDTH <
Steven says
HI William, What spec machine are you building this on? THe script ran fine for me but took around 80 minutes rather than 8. Although I must admit I am running on a VM with quite low resource.
Thanks
Steve
surya says
Hi ,
I am trying to run the script,but iam getting oracle not found error.please help on this.below thw error.
[root@vcloud ~]# ls
anaconda-ks.cfg install.log oracle-xe-10.2.0.1-1.0.i386.rpm vcd.resp vmware-cloud-director-1.0.0-285979.bin
Desktop install.log.syslog oracle-xe-10.2.0.1-1.0.i386.rpm.old vcd_setup.sh
[root@vcloud ~]# ls
anaconda-ks.cfg install.log oracle-xe-10.2.0.1-1.0.i386.rpm vcd.resp vmware-cloud-director-1.0.0-285979.bin
Desktop install.log.syslog oracle-xe-10.2.0.1-1.0.i386.rpm.old vcd_setup.sh
[root@vcloud ~]# ./vcd_setup.sh vcd.resp
: command not found
: command not found
: command not found
: command not found
: command not found
!nable to find oracle-xe-10.2.0.1-1.0.i386.rpm
regards
Surya
William says
@surya,
What OS are you running? Can you re-run the script but use the following:
sh -x vcd_setup.sh vcd.resp
This should give you more details on exactly what command it's having issues with and that's probably the issue
surya says
Hi William,
Thanks for you response.Iam useing centos.
i have run the below commad ,below the output.
sh -x vcd_setup.sh vcd.resp
[root@vcloud ~]# sh -x vcd_setup.sh vcd.resp
+ cyan='\E[36;40m'
+ green='\E[32;40m'
+ red='\E[31;40m'
+ yellow='\E[33;40m'
+ '[' 1 -ne 1 ']'
+ source vcd.resp
++ ORACLE_EXPRESS_RPM=$'oracle-xe-10.2.0.1-1.0.i386.rpm\r'
++ VMWARE_VCD_BIN=$'vmware-cloud-director-1.0.0-285979.bin\r'
++ $'\r'
: command not found
++ IP_ADDRESS_2=$'192.168.15.62\r'
++ IP_ADDRESS_2_NETMASK=$'255.255.255.0\r'
++ $'\r'
: command not found
++ KEYSTORE_PASSWORD=$'vcloud\r'
++ KEYSTORE_ORG_UNIT_NAME=$'Engineering\r'
++ KEYSTORE_ORG=$'virtual\r'
++ KEYSTORE_CITY=$'Hyderabad\r'
++ KEYSTORE_STATE=$'AP\r'
++ KEYSTORE_COUNTRY=$'India\r'
++ $'\r'
: command not found
++ ORACLE_XE_GUI_PORT=$'8080\r'
++ ORACLE_XE_LISTENER_PORT=$'1521\r'
++ ORACLE_SYS_PASSWORD=$'vcloud\r'
++ ORACLE_VCLOUD_USERNAME=$'vcloud\r'
++ ORACLE_VCLOUD_PASSWORD=$'vcloud\r'
++ $'\r'
: command not found
++ TABLESPACE_CLOUD_DATA_SIZE=$'1000M\r'
++ TABLESPACE_CLOUD_INDEX_SIZE=$'10M\r'
++ $'\r'
: command not found
+ verify
+ '[' 0 -ne 0 ']'
+ '[' '!' -f $'oracle-xe-10.2.0.1-1.0.i386.rpm\r' ']'
!' '\E[31;40m'e to find oracle-xe-10.2.0.1-1.0.i386.rpm
+ local 'default_msg=No message passed.'
!'message='Unable to find oracle-xe-10.2.0.1-1.0.i386.rpm
+ color='\E[31;40m'
+ echo -e '\E[31;40m'
!'echo 'Unable to find oracle-xe-10.2.0.1-1.0.i386.rpm
!nable to find oracle-xe-10.2.0.1-1.0.i386.rpm
+ tput sgr0
+ return
+ exit 1
regards
Surya
William says
@surya,
Looks like in your shell session, it does not have access to the "source" command. This is only available in bash, can you check to see if that is the shell you're using? You can do so by running "echo $SHELL" on the commandline
surya says
hi william,
[root@vcloud ~]# echo $SHELL
/bin/bash
regards
surya
William says
@surya,
Can you also run uname -a for me? I can see where the issue lies and from what I can tell it has to do with reading in the config file. Can you try editing the script and changing the the line that says:
source ${1}
to
. ${1}
and see if that makes a difference? Its towards the very bottom. The other thing that you can do is just copy paste the entire config file and just append it at the top of the vcd_setup.sh script right after #!/bin/bash. This would at least tell me if the issue is with sourcing the file or with the color output...
surya says
hi william,
[root@vcloud ~]# uname -a
Linux vcloud 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
now iam getting another error.see below
[root@vcloud ~]# ./vcd_setup.sh vcd.resp
./vcd_setup.sh: line 326: vcd.resp: command not found
IP_ADDRESS_2 is not defined!
regards,
Surya
Mike says
I can't seem to download vcd_setup.sh anymore. Did the file get removed?
William says
@Mike,
It looks like there's some issues with sourceforge's SVN web-browser. I've heard their site was recently attacked, so I don't know if it's related or not. The actual SVN repo is in fact available if you use the CLI but you won't be able to download from the web until the issue is resolved.
Mike says
Could someone email me these scripts? I can't seem to download them anymore *protected email*
William says
@Mike,
It looks their webviews are still down, can you try this URL, you should see all the scripts: https://vghetto.svn.sourceforge.net/svnroot/vghetto/scripts/
If this continues and does not get resolved soon, I may move the repo out of Sourceforge to another provider.
Thanks and sorry for the delay
Barry Coombs says
Hi,
I am getting an error when it tries to connect to the database during the vcloud director configuration stage. The logfile says
ORA-01882: timezone region not found
Any ideas?
Cheers
Barry
William says
@Barry
I'm not sure, but it sounds more like a timezone/Oracle issue. You could look up the ORA-* code and see if there is a solution online.
Jonas Jansson says
I had the same issue as surya, with the "command not found" and "IP_ADDRESS_2 is not defined!" errors. All I did was to redownload the vcd.resp file using wget from the vCD server itself instead of downloading it using a web browser. It was probably just a white space error or similar, and now it's working flawlessly. Thanks a lot for these scripts, they got me up and running in no time!
ken... says
I have VCD installed, now I'm trying to setup Chargeback. Based on .resp file, it looks like the username and password for the database should be vcloud/vcloud.
When I try to authenticate to the database "XE" with those credentials, I get "invalid username/password: logon denied"
Any suggestions?
sivakumar says
hi mike
I am unable to excute the script
please have look and give me some solution
root@vcloud2 script installtion]# ./vcd_setup.sh vcd.resp
bash: ./vcd_setup.sh: /bin/bash^M: bad interpreter: No such file or directory
[root@vcloud2 script installtion]# sh -x vcd_setup.sh vcd.resp
+ $'\r'
: command not found2:
+ $'\r'
: command not found6:
' cyan='\E[36;40m
' green='\E[32;40m
' red='\E[31;40m
' yellow='\E[33;40m
+ $'\r'
: command not found11:
'cd_setup.sh: line 12: syntax error near unexpected token `{
'cd_setup.sh: line 12: `cecho() {
[root@vcloud2 script installtion]#