Skip to content

Commit

Permalink
Updating upload directory which is a set of scripts for commisioning …
Browse files Browse the repository at this point in the history
…the VM
  • Loading branch information
bamcgill committed Dec 4, 2018
1 parent b7c733c commit 742de29
Show file tree
Hide file tree
Showing 31 changed files with 520 additions and 293 deletions.
42 changes: 30 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Oracle Developer Day VM Builder
===============================

Welcome to the packer build for the Oracle Developer Day vm.
This will build a Oracle Linux server and install a 12.2 Oracle database on the machine. Follow the download instructions to download the software to install and follow the build instructions to build the machine. You will need around 30gb of space free to store the downloads and run the build.
This will build a Oracle Linux server and install a 18.3 Oracle database on the machine. Follow the download instructions to download the software to install and follow the build instructions to build the machine. You will need around 30gb of space free to store the downloads and run the build.

There are several directories which are used in the build

Expand All @@ -15,9 +15,7 @@ Mandatory Downloads
**These two downloads are mandatory**. If they are not here, the build will not start.

* OracleLinux-R7-U3-Server-x86_64-dvd.iso (needs to be this exactly md5 checked)
* see : http://edelivery.oracle.com/linux (I cannot give more direct link - as (free) login required + need to be over 18)
* linux\*122*_database.zip (12201 has been verified - silent install may be incompatible with later versions)
* see : http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html# - (free) login required to accept license
* LINUX.X64_180000_db_home.zip (183 has been verified - silent install may be incompatible with later versions)

Optional Downloads
--------------
Expand All @@ -26,8 +24,8 @@ If these files are available in the **put_files_here** directory, the build will
* jdk-8u\*-linux-x64.tar.gz - **Oracle JDK**
* sqldeveloper-\*-no-jre.zip - **Oracle SQL Developer**
* datamodeler-\*-no-jre.zip **Oracle SQLDeveloper Data Modeler**
* sqlcl-\*-no-jre.zip - **Oracle SQLcl**
* apex_5\*.zip - **Oracle Application Express**
* sqlcl-\*.zip - **Oracle SQLcl**
* apex\_\*.zip - **Oracle Application Express**
* ords\*.zip - **Oracle REST Data Services**

Oracle Internal Files
Expand All @@ -51,12 +49,6 @@ update servers. optional export to export the ova.

![packer build](images/packerbuild.png)

Output Directory
----------------

After building you can find the built OVA in the output directory.
If you want the Oracle prebuilt OVA you can find it on Oracle Technology Network (OTN) [here](http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html)

Build Structure
--------------------

Expand All @@ -77,3 +69,29 @@ Timings:

Minimum (Oracle Linux + Oracle Database)
Total time 60 mins (accounted for time + 7 mins rounding error / ignore <2 minute).

boot,8
yum update,14
reboot ,3
run database software install (not database build),3
dbca (database build),7
password and 32kvarchar2,6
shrink (fill disk with 0 for easy compression),3
1 x 3 minute reboot + shutdown + minor <1 minute stuff,10

Maximum (Including all optional extras APEX/ORDS/((internal) demos)
Total time 113.5 mins (Accounted for time + 10.5 mins rounding error / ignore <2 minute).
boot,9
yum update,14
reboot,3
run database software install (not database build),4
dbca (database build),8
password and 32kvarchar <should be same as minimum?>,18
apex install ,16
ords install ,4
set up demos and run demo reset,18
shrink (fill disk with 0 for easy compression),2
1 x 3 minute reboot + shutdown + minor <1 minute stuff - this is too long,9

Removing the shrink.sh if not exporting - fills disk with 0 for easy compression.
Run shrink.sh over ssh if subsequently exporting to ova (brings ova file down 60% in size to under 8Gb)
7 changes: 4 additions & 3 deletions packerConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--memory", "4096" ],
[ "modifyvm", "{{.Name}}", "--cpus", "2" ],
[ "createhd", "--filename", "Oracle DB Developer VMo_2.vdi", "--size", "30000"],
[ "storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "1", "--device", "0" ,"--type", "hdd", "--medium", "Oracle DB Developer VMo_2.vdi"],
[ "createhd", "--filename", "Oracle DB Developer VM__2.vdi", "--size", "30000"],
[ "storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "1", "--device", "0" ,"--type", "hdd", "--medium", "Oracle DB Developer VM__2.vdi"],
[ "modifyvm", "{{.Name}}", "--clipboard", "bidirectional"],
[ "modifyvm", "{{.Name}}", "--draganddrop", "bidirectional"],
[ "modifyvm", "{{.Name}}", "--paravirtprovider", "kvm"],
[ "modifyvm", "{{.Name}}", "--natpf1", "net8,tcp,,1521,,1521"],
[ "modifyvm", "{{.Name}}", "--natpf1", "ssh,tcp,,2222,,22"],
[ "modifyvm", "{{.Name}}", "--natpf1", "apex8080,tcp,,8080,,8080"],
[ "modifyvm", "{{.Name}}", "--natpf1", "apex8081,tcp,,8081,,8081"],
[ "modifyvm", "{{.Name}}", "--natpf1", "ords9090,tcp,,9090,,9090"],
[ "modifyvm", "{{.Name}}", "--audio", "none"],
[ "modifyvm", "{{.Name}}", "--vram", "128"]
],
Expand All @@ -90,7 +91,7 @@
"shutdown_timeout": "10m",
"vm_name": "Oracle DB Developer VM",
"http_directory":"upload",
"export_opts": ["--vsys", "0","--eulafile","license.txt", "--product", "Oracle RDBMS 12.2, Application Express 5.1,REST Data Services 3.0,SQL Developer 4.2", "--producturl", "http://otn.oracle.com", "--vendor", "Oracle", "--vendorurl", "http://www.oracle.com", "--version", "May_2017"]
"export_opts": ["--vsys", "0","--eulafile","license.txt", "--product", "Oracle RDBMS 18.3, Application Express 18.1,REST Data Services 18.2,SQL Developer 18.2", "--producturl", "http://otn.oracle.com", "--vendor", "Oracle", "--vendorurl", "http://www.oracle.com", "--version", "July_2017"]
}
]
}
18 changes: 12 additions & 6 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@ function cleanup {
# are present otherwise, there is no point in continuing
#
function check_required_files {
export varsaccepted=
if test -f put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso
then
export varsaccepted=
if test -f OracleLinux-R7-U3-Server-x86_64-dvd.iso
then
export varsaccepted=" -var iso_downloaded=y "
cp -n put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso .
fi
if test -f put_files_here/linuxx64*122*database.zip
else
if test -f put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso
then
export varsaccepted=" -var iso_downloaded=y "
mv put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso .
touch put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso
fi
fi
if test -f put_files_here/LINUX.X64_*_db_home.zip
then
export varsaccepted=" $varsaccepted -var oracle_database_downloaded=y "
fi
Expand Down
25 changes: 20 additions & 5 deletions upload/1updateLinux_inner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ then
fi
}
function yum_update {

#turn off packagekit - sometimes conflicts with yum - not available yet but mask seems to work
/bin/systemctl stop packagekit.service
/bin/systemctl disable packagekit.service
/bin/systemctl mask packagekit.service
yum -y update
yum -y grouplist
yum -y groups list
Expand All @@ -47,7 +50,7 @@ yum -y install expect
yum -y install gcc
yum -y install kernel-uek-devel
yum -y install kernel-headers
yum -y install oracle-database-server-12cR2-preinstall
yum -y install oracle-database-preinstall-18c
#oracle-rdbms-server-12cR2-preinstall
usermod -a -g oinstall -G dba,wheel oracle
#need to remove the yum proxy
Expand Down Expand Up @@ -86,6 +89,18 @@ systemctl set-default graphical.target
}

function setup_desktop {
cd /tmp
#need to move oracle user before gnome gets started
chmod 755 /home/oracle
#move symbolic link from under me - work or fail fast
mkdir /u01/userhome
chmod 755 /u01/userhome
cp -Rp /home/* /u01/userhome
chmod 755 /u01/userhome/*
#sometimes fails (10% of builds) if process running
ps -ef | grep oracle
rm -rf /home
ln -s /u01/userhome /home
#need a reboot (or finish) after extras install. check by lsmod | grep vbox
su - oracle -c "bash -c 'mkdir ~/.config'"
su - oracle -c "bash -c 'mkdir ~/Desktop; echo images>>~/Desktop/.hidden; echo style.css>>~/Desktop/.hidden'"
Expand All @@ -101,7 +116,7 @@ Name[en_US]=Click here to Start Labs
Exec=/usr/bin/firefox /home/oracle/Desktop/ODDHandsOnLabs.html \n
Name=Start Here
Icon=/home/oracle/runTimeClickHere.png
' > ~oracle/Desktop/'Click here to Start.desktop'"
' > /home/oracle/Desktop/'Click here to Start.desktop'"
else
su - oracle -c "echo '[Desktop Entry]
Version=1.0
Expand All @@ -112,9 +127,9 @@ Name[en_US]=Click here to Start Browser
Exec=/usr/bin/firefox \n
Name=Start Here
Icon=/home/oracle/runTimeClickHere.png
' > ~oracle/Desktop/'Click here to Start.desktop'"
' > /home/oracle/Desktop/'Click here to Start.desktop'"
fi
su - oracle -c "chmod 755 ~oracle/Desktop/'Click here to Start.desktop'"
su - oracle -c "chmod 755 ~/Desktop/'Click here to Start.desktop'"
su - oracle -c "cp /tmp/1/runTimeClickHere.png ~oracle"
}
function setup_resolution {
Expand Down
8 changes: 4 additions & 4 deletions upload/2afterFirstReboot_inner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ if test "m$BUILD_WEB_PROXY" != "m"
then
printf "2d\nw\nq"|ed /etc/yum.conf
fi
#fix for intermittant java/sqldeveloper cursor copy issue
cat /etc/default/grub| sed 's/^\(GRUB_CMDLINE_LINUX="[^"]*\)/\1 nomodeset/g' > /tmp/xx
cp /tmp/xx /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
#fix for intermittant java/sqldeveloper cursor copy issue supposedly fixed in latest (openjdk?) java152
#cat /etc/default/grub| sed 's/^\(GRUB_CMDLINE_LINUX="[^"]*\)/\1 nomodeset/g' > /tmp/xx
#cp /tmp/xx /etc/default/grub
#grub2-mkconfig -o /boot/grub2/grub.cfg
. ~oracle/buildTimeEnd.sh
exit 0
29 changes: 21 additions & 8 deletions upload/3_1installDbtoolClientTools_inner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


. ~oracle/runTimeStartScript.sh
dbus-launch gsettings set org.gnome.nautilus.icon-view default-zoom-level small
mkdir -p /home/oracle/java
mkdir -p /home/oracle/Desktop/images
if test -f /tmp/1/jdk8x64.tar.gz
Expand Down Expand Up @@ -126,7 +127,7 @@ fi
#actually made further up this script
if test /tmp/1/sqldev.zip
then
cp /tmp/1/"SQL Developer.desktop" /home/oracle/Desktop
cp /tmp/1/"SQL Developer.desktop" /home/oracle/Desktop/
fi
#cp /tmp/1/readme.txt /home/oracle/Desktop
#probably want to skip next 5 commands in testing - and have them prebuilt into the base. what if they ask for a reboot? - force a reboot at end?
Expand Down Expand Up @@ -154,7 +155,7 @@ Exec=/home/oracle/bin/datamodeler
Terminal=false
Type=Application
X-Desktop-File-Install-Version=0.21
Categories=X-Red-Hat-Extra;Application;Development;" > /home/oracle/Desktop/Oracle-datamodeler.desktop
" > /home/oracle/Desktop/Oracle-datamodeler.desktop
chmod 755 /home/oracle/Desktop/Oracle-datamodeler.desktop
echo '#!/bin/bash
#should do image or desktop
Expand All @@ -173,16 +174,16 @@ echo '#!/bin/bash
#LD_LIBRARY_PATH
#normal .bashrc does not set LD_LIBRARY_PATH even the first time
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2/db_1
export ORACLE_HOME=$ORACLE_BASE/product/version/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
if test "m$DBENV" = "m"
then
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_UNQNAME=orcl12c
export ORACLE_UNQNAME=orclcdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2/db_1
export ORACLE_SID=orcl12c
export ORACLE_HOME=$ORACLE_BASE/product/version/db_1
export ORACLE_SID=orclcdb
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
Expand All @@ -200,12 +201,24 @@ export TMZ="GMT"
export JAVA_HOME=`ls -d /home/oracle/java/jdk* 2>/dev/null`
if test "m$JAVA_HOME" = "m"
then
export JAVA_HOME=/u01/app/oracle/product/12.2/db_1/jdk
export JAVA_HOME=/u01/app/oracle/product/version/db_1/jdk
fi
export PATH=$JAVA_HOME/bin:/home/oracle/bin:/home/oracle/sqlcl/bin:/home/oracle/sqldeveloper:/home/oracle/datamodeler:$PATH:/home/oracle/sqlcl/bin:/home/oracle/sqldeveloper:/home/oracle/bin
export JAVAENV=true
fi'>>/home/oracle/.bashrc

ed -s /home/oracle/Desktop/'Click here to Start.desktop' <<< $',s/Click here to Start/Click here to Start Labs/g\nw'
echo '
bash /tmp/1/buildTimeSetupRestClient.sh
export LD_LIBRARY_PATH=
cd ~/Desktop
echo only rest client worked do this again at the end icon size seems almost similar whether trusted or not
dbus-launch gio set "Rest Client.desktop" "metadata::trusted" yes
dbus-launch gio set "SQL Developer.desktop" "metadata::trusted" yes
dbus-launch gio set "Oracle-datamodeler.desktop" "metadata::trusted" yes
dbus-launch gio set "Click here to Start.desktop" "metadata::trusted" yes
dbus-launch gio set "sql.desktop" "metadata::trusted" yes
' > /tmp/icons.sh
bash /tmp/icons.sh
cp /tmp/1/runTimeSQLDeveloperIcon.png /home/oracle/Desktop/images
cp /tmp/1/runTimeSQLDeveloperIcon.png /home/oracle/Desktop/images
cp /tmp/1/runTimeLabStylesheet.css /home/oracle/Desktop/style.css
Expand Down
17 changes: 8 additions & 9 deletions upload/3_2installDatabase_inner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@


. ~oracle/runTimeStartScript.sh
mkdir /u01/stagevb
mv /tmp/1/linuxx64_122_database.zip /u01/stagevb
cd /u01/stagevb
unzip linuxx64_122_database.zip
mkdir -p /u01/app/oracle/product/version/db_1
mv /tmp/1/LINUX.X64_180000_db_home.zip /u01/app/oracle/product/version/db_1
cd /u01/app/oracle/product/version/db_1
unzip LINUX.X64_180000_db_home.zip
rm LINUX.X64_180000_db_home.zip
echo assumption this results in a directory database
rm linuxx64_122_database.zip
cd /u01/stagevb/database

./runInstaller -silent -ignorePrereq -waitForCompletion -responseFile /tmp/1/buildTimeSoftwareInstall.rsp

Expand All @@ -46,10 +45,10 @@ if test "m$DBENV" = "m" -a "m$GNOME_CHECK" = "m0"
then
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_UNQNAME=orcl12c
export ORACLE_UNQNAME=orclcdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2/db_1
export ORACLE_SID=orcl12c
export ORACLE_HOME=$ORACLE_BASE/product/version/db_1
export ORACLE_SID=orclcdb
#LD_LIBRARY_PATH
export PATH=/home/oracle/bin:/home/oracle/LDLIB:$ORACLE_HOME/bin:/usr/sbin:$PATH
#during install set LD_LIBRARY_PATH otherwise rely on LDLIB wrappers and ~/bin/sql sqlplus and modeller
Expand Down
Loading

0 comments on commit 742de29

Please sign in to comment.