Thứ Sáu, 22 tháng 7, 2011

Setup Oracle 11gR2 on a centOS 5.4 VMware Virtual Machine

Well it was time for me to install a test and development virtual machine for Oracle 11gR2 and as it turned out to be a bit of a painful experience to get this installed on centOS 5.4, I’ve written the details down into a blog article.

This way you can all enjoy the ultimate pleasures of installing Oracle on a RHEL/CentOS virtual machine.

Disclaimer

This setup guide is not meant as a guideline for setting up a production server, most settings are absolute minimums and do not qualify for a proper production server.
These steps should only be used as a quick guide for setting up a test oracle server for development and or testing.
At any time we do strongly suggest to first read the Quick Install Guide that can be found in your unzipped database install folder after opening the welcome.html file in there with a browser.

Basic OS Setup

First setup centOS 5.4 32 bits as usual, yes you are reading that correctly 32 bits, at this stage that was enough for me as I can run it anywhere. You might want to check the quick install notes for 64 bits, although I expect most of it to be the same.
Extra steps which I am not detailing down here are:
  • Disable SELinux (it is actually supported for Oracle 11gR2, so leave it on if you are in for an adventure )
  • Install vmware tools if virtual (use the tar.gz install over rpm as it tends to give better results)
  • Setup sudo (see How To: configure sudo on ESX | PlanetVM I’m using the -user can run anything as root via the wheel group- method here)
As Oracle requires at least 1024 Mb of memory, set the memory of your VM to 1048 Mb.. yes that’s correct, Oracle cannot count. Setting it to 1024Mb will make it fail the test.
The absolute minimum virtual disk size is 15GB for a single disk install. I’ve had to grow my disk 2 times when i was too conservative, so save yourself the trouble and don’t make the disk any smaller as that. Set your swap size at least to 1.5 GB umm make that 1.6 GB ;)

Software prerequisites

Make sure following packages are installed:
rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel \
elfutils-libelf-devel-static  gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers \
kernel-headers-2.6.18 ksh libaio libaio-devel libgcc libgomp libstdc++ \
libstdc++-devel make sysstat unixODBC unixODBC-devel
I had to run:
sudo yum install compat-db gcc gcc-c++ libstdc++ pdksh sysstat compat-libstdc++-33 \
elfutils-libelf-devel elfutils-libelf-devel-static unixODBC unixODBC-devel libaio-devel
to install the missing packages.
Rerun the rpm -q line from above to check afterwards that everything installed OK.

Setup users and groups

create users/groups as described
sudo /usr/sbin/groupadd oinstall
sudo /usr/sbin/groupadd dba
sudo /usr/sbin/useradd -m -g oinstall -G dba oracle
sudo id oracle
Expected output:
uid=501(Oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
now setup a new password for the user oracle:
sudo passwd oracle

Set Kernel parameters

Now you need to tweak the kernel parameters to keep the installer happy.
Save the following to a script called oracle-kernel-parameters.sh and run it as root (or download):
cat >> /etc/sysctl.conf <<EOF
# Added kernel parameters for Oracle setup
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr=1048576
EOF
/sbin/sysctl -p
First make executable:
sudo chmod +x oracle-kernel-parameters.sh
and then run:
sudo ./oracle-kernel-parameters.sh
The output of that should be:
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
It just lists your current settings.

Basic folder structure

Now we will create the basic folder structure for oracle to install under:
Again save to a script called setup-oracle-folders.sh (or download) and run as root:
mkdir -p /u01
mkdir -p /opt/oracle
mkdir -p /opt/oracle/product
mkdir -p /opt/oraInventory
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /opt/oracle
chown -R oracle:oinstall /opt/oraInventory
chmod -R 775 /u01
chmod -R 775 /opt/oracle
chmod -R 775 /opt/oracle/product
make executable:
chmod +x setup-oracle-folders.sh
now run as root:
sudo ./setup-oracle-folders.sh

Setup shell-limits

see script download
same as before now run ./shell-limits.sh as root.

Network

Make sure to use a fixed IP and setup your hostname in /etc/hosts
Use network manager for this:
network-setup
Disable the firewall temporary for the install, but before you do that, add tcp ports: 1521, 1158
Port 1521 is for the connection to the database (the so called listener) and 1158 is for the port on which you web management interface runs.
Do not forget to enable the firewall after you installed oracle!

Installing oracle

Move the downloaded zip files to /opt/oracle
sudo mv linux_11gR2_database_* /opt/oracle
change the rights to your oracle user
cd /opt/oracle
sudo chown oracle:oinstall linux_11gR2_database_*
Now reboot the machine and log in as user: oracle
cd /opt/oracle
and unzip both of them:
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
This is where you might want to take a snapshot of your virtual machine!
now delete both of the zip files to create some more space (you’ll need it!)
rm linux_11gR2_database_*.zip
and a df -h now shows on my machine:
df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
13G  5.0G  7.4G  41% /
/dev/sda1              99M   18M   76M  20% /boot
tmpfs                 373M     0  373M   0% /dev/shm
Yes, you’ll need that 7.4G just for the install.. no less please!
Now change into the database subfolder and run
./runInstaller
You should not get an error before your first screen, if you get a complaint about your /etc/hosts configuration then don’t bother installing and fix that first (is your firewall still on?)
2.installation-option
3.System-class
4.Typical-install
Set oracle base to:
/opt/oracle
then change the OSDBA group to oinstall
If your database name is bigger as 8 characters then make it shorter, for ex. orcl (we are using planetvm here)
enter password and click Next
5.Create-inventory
for inventory choose:
/opt/oraInventory
and click Next again and the setup will start verifying things for you:
6.Prereq-checks-progress
If you are unlucky, then you’ll get a screen like this one:
6.Prereq-checks-failand else the screen just doesn’t appear and you’ll end up on the summary and can click Next to install the product.
7.Product-Summary
Click on Finish for the actual setup to run:
8.Install-ProductAfter a while you should see:
8.Install-Product-progressand then after getting really hungry you’ll end up with:
8.config-assistent-success
Almost done now, here’s the final step:
9.Final-install-steps
Do exactly what it says: Open a new terminal window while the install program is still open and run su – to gain root (we have not setup sudo for the oracle user):
$ su -
Password:
[root@ora ~]# /opt/oraInventory/orainstRoot.sh
Changing permissions of /opt/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /opt/oraInventory to oinstall.
The execution of the script is complete.
[root@ora ~]# /opt/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
 ORACLE_OWNER= oracle
 ORACLE_HOME=  /opt/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
 Copying dbhome to /usr/local/bin ...
 Copying oraenv to /usr/local/bin ...
 Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
Click OK
10.success
Congratulations if you made it this far, you have succeeded into installing Oracle!
That was easy wasn’t it? :D

Không có nhận xét nào:

Đăng nhận xét