Sep 24, 2007

Setting up Oracle on Ubuntu Running on Parallels

I recently created a Parallels image for some classmates running Ubuntu with Oracle 10gR2. I included instructions on how I created the image and I thought it would be helpful to anyone else out there to see how I did it (not necessarily how it should be done). To make this post more searchable from Internet search engines, I've included all the steps here rather than posting a link to a pdf. Enjoy!

SUMMARY:
Ubuntu Server
User: duser, pw: duser
User: oracle, pw: oracle
Hostname: vm-ubu-oracle
Static IP: 10.211.55.10
Webmin:
User: root, pw: duser
Link: http://vm-ubu-oracle:10000
Oracle:
SYS pw: oracle
Admin: http://vm-ubu-oracle:1158/em
TNS Entry:
ORCL10 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = vm-ubu-oracle)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCL10)
)
)


Setup Parallels Networking
Note: All networking is using the Parallels default for shared networking. Some of this has to be tweaked a little to allow for static IPs and to ensure a consistent network between your Ubuntu Server and your Mac.
Go into your OS X System Preferences, Network
Click on Parallels NAT, Configure
Click on TCP/IP
Change Configure IPv4 to "Manually"
Set the IP Address to 10.211.55.6
The last number in the IP address can be anything between 2 and 9. Whatever you choose will be the IP that the Ubuntu server will see your Mac as. I will be using 6 throughout this documentation. (Also set: Subnet Mask: 255.255.255.0, Router: 10.211.55.1)
Click Apply Now and close System Preferences
Open Parallels, Preferences
Under the Network Tab, ensure that "Enable DHCP scope for shared networking" is enabled.
The 3 IPs should be as follows:
Start: 10.211.55.10
End: 10.211.55.254
Mask: 255.255.255.0

Download the Server Edition (492 MB) of Ubuntu from here:
http://mirrors.xmission.com/ubuntu-cd/feisty/ubuntu-7.04-server-i386.iso
Create a Parallels Image
Custom Image
OS Type: Linux
OS Version: Ubuntu Linux
RAM 512Windows XP CD Key
Create a New Hard Disk
15000 MB, Split Disk, Expanding
Shared Networking
Default Adapter (networking), Connect on Startup
Name of Virtual Machine: Ubuntu Oracle
Optimize for better performance: Virtual Machine
Remove Floppy Drive and Sound Card.
Decrease video memory to 4MB.
Start Virtual Machine attached to installation ISO

Ubuntu Installation
Language: English, Country: United States, Keyboard US English
Hostname: vm-ubu-oracle
Partitioning: Manual - 1GB swap (required by Oracle). The rest for Primary Bootable.
Timezone: Mountain, Clock NOT set to UTC
Username: duser, Password: duser
Software to Install (leave blank)
NOTE (courtesy of http://paul.annesley.cc/articles/2007/05/01/ubuntu-704-feisty-server-parallels-cdromkernel-workaround):
On the “Installation Complete” dialogue, choose “Go Back”, and then select “Execute a shell” from the menu. Run the following commands (ignore any errors and accept defaults if prompted):

umount /dev/scd0
chroot /target /bin/bash
mount /dev/scd0 /media/cdrom
aptitude install linux-generic
aptitude remove linux-server linux-image-server linux-image-2.6.20-15-server
exit
shutdown -h now
Setup access and aptitude
login as duser
sudo visudo
add the following line if you wish to not be bugged when running sudo
WARNING! This isn't considered safe practice. I just do it because of the volume of sudo commands that will be entered during the setup. If you wish, you can remove these edits once the setup is completed to be safe:
duser ALL=(ALL) NOPASSWD: ALL
change the members line to read:
%admin ALL=(ALL) NOPASSWD: ALL
edit the apt sources list to pull from the online repository
sudo vi /etc/apt/sources.list
comment (#) out the line that starts: deb cdrom:[Ubuntu-Server 7.04...
update the local repository by running:
sudo aptitude update
install ssh and samba (accept defaults on dependencies)
sudo aptitude install ssh samba

Setup some Environment Variables (this is a personal preference and can be omitted)
Add the following lines to the ~/.bashrc file
if [ -f ~/.bash_env ]; then
. ~/.bash_env
fi
create a file in ~ called .bash_env
add the following lines to .bash_env
PS1=“\h: \W$ “
TERM=linux

Setup Webmin
Note: you should be able to login to the server using Terminal or iTerm. Check the ip address using ifconfig. The ip that my server got was 10.211.55.7. Yours will be similar. I would suggest using a terminal from here on out because of ease of copy and pasting commands and screen scrolling.
Download Webmin
wget http://downloads.sourceforge.net/webadmin/webmin_1.360_all.deb
Install prerequisites:
sudo aptitude install libauthen-pam-perl libio-pty-perl libmd5-perl openssl
Install webmin
sudo dpkg -i webmin_1.360_all.deb
Update your admin password
sudo /usr/share/webmin/changepass.pl /etc/webmin root
I used "duser" as the password
Navigate your web browser to https://:10000
You should be able to login as root with the password entered earlier

Setup Static IP
Login to webmin
Navigate to Networking, Network Configuration
Under "Interfaces Activated at Boot Time" click on eth0
Change the IP to static and apply the following:
IP: 10.211.55.10
You can use any range from 5 to 254. I will be using 10 from here on out
Broadcast: 10.211.55.255
Netmask: 255.255.255.0
Click Save.
Click the checkbox next to eth0 that you just modified and then click the apply button.
This will send your browser into a constant state of refresh. Just click stop and enter the new ip address in the address
Setup routes under Network Configuration
Default Router: Gateway: 10.211.55.1
Active Route 1:
Destination: 10.211.55.0
Gateway: None
Netmask: 255.255.255.0
Interface: eth0
Active Route 2:
Destination: Default Route
Gateway: 10.211.55.1
Netmask: (nothing)
Interface: eth0
Save changes and apply.
Setup a hostname on your Mac by adding the following to the bottom of the /etc/hosts file on your machine:
10.211.55.10 vm-ubu-oracle

Setup Samba
Samba can be setup manually from the command line, but webmin makes it simple
Navigate in webmin to Servers, Samba Windows File Sharing
Click on Windows Networking
Change Workgroup from MSHOME to WORKGROUP
this is for better integration with Windows if you ever need it
Set Server name to vm-ubu-oracle
Save
Click Edit Config
Scroll to the Share Definitions section and change the homes section to look like this (removing the semicolons):
[homes]
comment = Home Directories
browseable = yes
writeable = yes
Add your user to Samba by executing the following command:
sudo smbpasswd -a duser
(you should now be able to mount the home directory on your Mac from Finder using: smb://)

Setup Oracle Prerequisites
These instructions come courtesy of: http://www.dizwell.com/prod/node/52
For more detailed explanation of what we are doing here, please visit that site.
Install packages:
sudo aptitude install gcc libaio1 lesstif2 lesstif2-dev make rpm libc6 libstdc++5
sudo aptitude install unzip libxp6 libxt6 libxtst6
Setup the Oracle Users
sudo groupadd oinstall
sudo groupadd dba
sudo groupadd nobody
sudo useradd -m oracle -g oinstall -G dba -s /bin/bash
sudo passwd oracle
I set the passwd to "oracle"

Setup Kernel Parameters
sudo vi /etc/sysctl.conf
Add the following lines to the bottom of the file:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
(leave 1 or 2 blank lines at the end)
Reload the sysctl file by issuing the command:
sudo /sbin/sysctl -p
Update security limits
sudo vi /etc/security/limits.conf
Add the following lines (leaving blank lines at the bottom)
soft nproc 2047
hard nproc 16384
soft nofile 1024
hard nofile 65536
Setup the Oracle Environment
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
sudo ln -s /usr/bin/basename /bin/basename
sudo mkdir /oracle
sudo mkdir /oracle/10g
sudo chown -R oracle:oinstall /oracle
sudo chmod -R 775 /oracle
Setup the Environment Variables
sudo vi /etc/profile
Add the following lines:
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/10g
export ORACLE_SID=orcl10
export PATH=$PATH:$ORACLE_HOME/bin

Install Oracle
Download the oracle installation file: 10201_database_linux32.zip
I used samba to copy it to the /home/duser/software directory
Change the ownership and move file to the oracle directory
sudo chown oracle:oinstall /home/duser/software/10201_database_linux32.zip
sudo chmod 775 /home/duser/software/10201_database_linux32.zip
sudo mv /home/duser/software/10201_database_linux32.zip /home/oracle
sudo aptitude install unzip
su - oracle
rm 10201_database_linux32.zip
Launch Installer from X11 terminal
Do not close the X11 terminal until the installation has finished.
Launch an X11 terminal or xterm compliant terminal (iTerm will not work)
ifconfig (take note of your ip address)
xhost +
ssh -X oracle@10.211.55.10
export DISPLAY=10.211.55.6:0.0
database/runInstaller -ignoreSysPrereqs

Oracle Installation
Most of the options will automatically set the values in the installer. I will only note items to be changed from the defaults below.
Screen 1 (welcome): Next
Screen 2 (Inventory): Next
Screen 3 (Installation Type): Enterprise Edition
Screen 4 (Home Details): Next
Screen 5 (Configuration Option): Create a database
Database Configuration: General Purpose
Database Config Options: Database Name=> orcl10, SID=> orcl10
Database Mgmt Option: Next
Storage Option: File System
Backup and Recovery: Next
Database Schema Passwords: Use the same for all accounts: oracle
Summary: Install

The installer will now install Oracle and Launch a new window to create the database.
When it is finished click Ok, the installation will proceed.
The Database Control URL is http://vm-ubu-oracle:1158/em
Execute the root scripts (accept defaults)
When it is finished, a dialog box will appear with the following information:
The following J2EE Applications have been deployed and are accessible at the URLs listed below.

iSQL*Plus URL:
http://vm-ubu-oracle:5560/isqlplus

iSQL*Plus DBA URL:
http://vm-ubu-oracle:5560/isqlplus/dba

Enterprise Manager 10g Database Control URL:
http://vm-ubu-oracle:1158/em

Setup Oracle to load during boot
Update the oratab
sudo vi/etc/oratab
Change the line that says:
orcl10:/oracle/10g:N
to: orcl10:/oracle/10g:Y
Edit dbstart
sudo vi $ORACLE_HOME/bin/dbstart
change the line that says:
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
to: ORACLE_HOME_LISTNER=/oracle/10g
Create the dbora file
sudo vi /etc/init.d/dbora
add the following lines:
#!/bin/bash
#
# /etc/init.d/dbora
#
# Startup script for Oracle databases

export ORACLE_HOME=/oracle/10g
export ORACLE_SID=orcl10
export PATH=$PATH:$ORACLE_HOME/bin

case "$1" in
start)
echo -n "Starting Oracle: "
su oracle -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle

su oracle -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
echo -n "Shutdown Oracle: "
su oracle -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
echo "OK"
;;
*)
echo "Usage: 'basename $0' start|stop"
exit 1
esac
exit 0

Save the file, then update the boot config:
sudo chmod 775 /etc/init.d/dbora
sudo update-rc.d dbora defaults 99

Sep 19, 2007

Binary marble adding machine

I ran across this site this morning and loved the video at the bottom. That is one cool piece of work.

Binary marble adding machine