Install Oracle database 11g. X Window system is needed for it.
Taken from http://server-world.info/
[1]Install some packages first for dependencies.
[root@www ~]#
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common
glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC
unixODBC-devel
[2] Edit kernel parameter.
[root@www ~]#
vi /etc/sysctl.conf
# add at the bottom
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[root@www ~]#
sysctl -p
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
net.ipv4.icmp_echo_ignore_broadcasts = 0
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 32768 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[3]Create users and groups and set environment for Oracle.
[root@www ~]#
groupadd -g 200 oinstall
[root@www ~]#
groupadd -g 201 dba
[root@www ~]#
useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle
[root@www ~]#
passwd oracle
Changing password for user oracle.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@www ~]#
chmod 755 /usr/oracle
[root@www ~]#
mkdir /usr/oracle/app
[root@www ~]#
chown -R oracle:oinstall /usr/oracle/app
[root@www ~]#
chmod -R 775 /usr/oracle/app
[root@www ~]#
mkdir /usr/oracle/oradata
[root@www ~]#
chown -R oracle:oinstall /usr/oracle/oradata
[root@www ~]#
chmod -R 775 /usr/oracle/oradata
[root@www ~]#
vi /etc/pam.d/login
# add at the bottom
session required /lib/security/pam_limits.so
session required pam_limits.so
[root@www ~]#
vi /etc/security/limits.conf
# add at the bottom
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@www ~]#
vi /etc/profile
# add at the bottom
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@www ~]#
vi /usr/oracle/.bash_profile
# add at the bottom
umask 022
export ORACLE_BASE=/usr/oracle/app
[4]Downlodad and install Oracle 11g. Do them with a user "Oracle" taht is created on section [3].
[oracle@www ~]$
mkdir tmp
# create temporary dir
Download Oracle 11g for Linux from the site below. First, you have to register and login on the site.
http://www.oracle.com/technology/software/products/database/index.html
After downloading, unzip it and run installer like following example.
[oracle@www ~]$
cd tmp
[oracle@www tmp]$
unzip linux_x86_11gR1_database.zip
[oracle@www tmp]$ runInstaller
(1) Installer starts like below. uncheck "Create Starter Database" and Click "Next".
(2) It's OK, Go next.
(3) It's OK, Go next.
(4) Click "Install" button and start installation.
(5) Installation proceeds.
(6)
It's necessary to run config scripts that shows on the screen below with root user. After running,
come back to this screen and Click "OK" button.
[root@ns ~]#
/usr/oracle/oraInventory/orainstRoot.sh
Changing permissions of /usr/oracle/oraInventory to 770.
Changing groupname of /usr/oracle/oraInventory to oinstall.
The execution of the script is complete
[root@ns ~]#
/usr/oracle/app/product/11.1.0/db_2/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /usr/oracle/app/product/11.1.0/db_2
Enter the full pathname of the local bin directory: [/usr/local/bin]:
# Enter
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.
(7) Installation completes. Click "Exit" button.
[5]Set environment for Oracle user and remove temporary directory.
[oracle@www ~]$
vi .bash_profile
# add at the bottom
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_2
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@www ~]$
. .bash_profile
[oracle@www ~]$
rm -rf tmp
Configure for remote connection to Oracle database.
[1]
Login X terminal with Oracle user and input
command "netca", Go next.
[2] Go next.
[3] Go next. If you'd like to change settings, change and go next.
[4] Go next. If you'd like to change settings, change and go next.
[5] Go next. If you'd like to change settings, change and go next.
[6] Go next. If you'd like to add more listener, do it and go next.
[7] Go next.
[8] Click "Finish".
Try to create a test database.
[1]
Login X terminal with Oracle user and input command "dbca", then . Go
next.
[2] Select "Create Database" and go next.
[3] Select "Custom Database" and go next.
[4]
Input global database name and SID.
ex: (any name you like).(domain name)
[5] Go next.
[6] Set password.
[7] Go next.
[8] Go next.
[9] Go next.
[10] Go next.
[11] Go next.
[12] Go next.
[13] Go next.
[14] Go next.
[15] Go next.
[16] Click "OK".
[17] Createing database starts.
[18] After creating DB, Click "Exit".
[19]
Access to the URL that is written in the section [18]. Then, following screen is shown and input
user name and password set in the section [6].
[20] Logined.
[1] Change settings like below.
[oracle@ns ~]$
vi /etc/oratab
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:
:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
## testdb:/usr/oracle/app/product/11.1.0/db_1:
Y
# change
testdb2:/usr/oracle/app/product/11.1.0/db_1:N
[2] Set ORACLE_SID
[oracle@ns ~]$
vi .bash_profile
# add at the bottom
export ORACLE_SID=testdb
[3] Create start-script.
[root@ns ~]$
vi /etc/rc.d/init.d/dbora
# This is an example.
#! /bin/bash
#
# oracle: Starting Oracle database 11g
#
# chkconfig: 345 95 94
# description: Oracle Database Server
# processname: ora_
. /etc/rc.d/init.d/functions
lockfile=/var/lock/subsys/dbora
ORACLE_HOME=/usr/oracle/app/product/11.1.0/db_1
ORACLE=oracle
case "$1" in
'start')
if [ -f $lockfile ]; then
echo $0 already started.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $lockfile
;;
'stop')
if [ ! -f $lockfile ]; then
echo $0 already stopped.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $lockfile
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $lockfile ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
[root@ns ~]#
chmod 755 /etc/rc.d/init.d/dbora
[root@ns ~]#
/etc/rc.d/init.d/dbora start
Starting Oracle Database:
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 03-NOV-2008 16:55:48
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /usr/oracle/app/product/11.1.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /usr/oracle/app/product/11.1.0/db_1/network/admin/listener.ora
Log messages written to /usr/oracle/app/diag/tnslsnr/ns/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ns.server-linux.info)
(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ns.server-linux.info)
(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 03-NOV-2008 16:55:49
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /usr/oracle/app/product/11.1.0/db_1/network/admin/listener.ora
Listener Log File /usr/oracle/app/diag/tnslsnr/ns/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ns.server-linux.info)(PORT=1521)))
The listener supports no services
The command completed successfully
Processing Database instance "testdb": log file /usr/oracle/app/product/11.1.0/db_1/startup.log
Processing Database instance "testdb2": log file /usr/oracle/app/product/11.1.0/db_1/startup.log
Oracle Enterprise Manager 11g Database Control Release 11.1.0.6.0
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
https://ns.server-linux.info:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control ......... started.
------------------------------------------------------------------
Logs are generated in directory /usr/oracle/app/product/11.1.0/db_1/ns.serverlinux.
info_testdb/sysman/log
[root@ns ~]#
chkconfig --add dbora
[root@ns ~]#
chkconfig dbora on