首先在oracle官方上下载一个oracle 11g(特别说明一下在安装CentOS 5.2时尽量是把开发包装全一些,这样您在安装包检测的时候就会少装一些包。还有一点:安装大概需要5G多的空间,空间不够就老是出错。)

1、用unzip解压 Oracle 11g文件

unzip linux_x86_11gR1_database.zip

(这个您也可以在Windows下面解压,不过您要加载过来,如果你的分区是NTFS,那您就要安装kernel-module-ntfs、fuse、ntfs-3g,当然具体的怎么操作就不必多说了。如果您还是搞不定的话,请给QQ:42271520留言。)

2、安装包检测及安装

在终端中执行: rpm -q gcc make binutils setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel unixODBC unixODBC-devel libaio-devel sysstat
显示结果如下:

vel sysstat

gcc-4.1.2-42.el5

make-3.81-3.el5

binutils-2.17.50.0.6-6.el5

setarch-2.0-1.1

package compat-db is not installed

package compat-gcc is not installed

package compat-gcc-c++ is not installed

package compat-libstdc++ is not installed

package compat-libstdc++-devel is not installed

unixODBC-2.2.11-7.1

package unixODBC-devel is not installed

package libaio-devel is not installed

package sysstat is not installed

分析:

上面package 软件包 is not installed 部分说明此软件包没有安装,您可以再光盘里面找,再用rpm -ivh 安装就行,这些包在centos安装盘中都用;或者直接用yum install 软件包 来安装,具体操作如下:

yum install compat-db

安装成功Installed: compat-db.i386 0:4.2.52-5.1 Complete!

yum install compat* (这个包比较多,要稍等一会,不急先抽根烟吧。)

安装成功 Installed: compat*......... Complete!

yum install unixODBC-devel

安装成功 Installed: unixODBC-devel.i386 0:2.2.11-7.1 Complete!

yum install  libaio-devel

安装成功 Installed: libaio-devel.i386 0:0.3.106-3.2 Complete!

yum install  sysstat

安装成功 Installed: sysstat.i386 0:7.0.2-1.el5 Complete!

说明:您可以再执行一次rpm -q 软件包组合 具体如下:

gcc-4.1.2-42.el5

make-3.81-3.el5

binutils-2.17.50.0.6-6.el5

setarch-2.0-1.1

compat-db-4.2.52-5.1

package compat-gcc is not installed

package compat-gcc-c++ is not installed

package compat-libstdc++ is not installed

package compat-libstdc++-devel is not installed

unixODBC-2.2.11-7.1

unixODBC-devel-2.2.11-7.1

libaio-devel-0.3.106-3.2

sysstat-7.0.2-1.el5

如上所述:还是有4个软件包没有安装,这个不用理会,其实我们刚才安装的compat包已经包含了;可以继续下一步了。

3、系统参数和用户及目录设置
//系统参数设置
vi /etc/sysctl.conf

以下为此文件更改后的内容:

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
#kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
#kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
#kernel.shmmax = 4294967295

# Controls the maximum number of shared memory segments, in pages
#kernel.shmall = 268435456

#Below for oracle11g
kernel.core_uses_pid = 1
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000

//添加用户组及用户

执行如下命令:
#groupadd dba
#groupadd oinstall
#useradd oracle -g oinstall -G dba
#passwd oracle
//新建目录权限

执行如下命令:
#mkdir -p /u01
#chown -R oracle:dba /u01
#chmod -R 755 /u01
//用户环境变量

先切换用户到oracle:
su – oracle

修改.bash_profile文件:
vi .bash_profile

以下是此文件的内容:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
      . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:HOME/bin
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0.6
export ORACLE_SID=sales
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:ORACLE_HOME/lib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORA_NLS10=$ORACLE_HOME/nls/data
unset USERNAME
umask 022

4、安装oracle
注销root ;

用oracle帐号进入,进入Oracle所在的目录我的是/disk/Oracle11g-linux_x86
[oracle@root-bs Oracle11g-linux_x86]$  ls
doc install response runInstaller stage welcome.html
执行./runInsaller进行安装:

Oracle,11g

[oracle@root-bs Oracle11g-linux_x86]$ ./runInstaller
 

Oracle,11g

Oracle,11g

Oracle,11g

Oracle,11g
Oracle,11g

 

Oracle,11g

 

Oracle,11g

 

Oracle,11g

 

Oracle,11g

 

Oracle,11g

 

Oracle,11g

 

Oracle,11g

Oracle,11g

 

Oracle,11g

当进度条走到头时弹出“密码管理窗口”不想更改,点“确定”
Oracle,11g

 

Oracle,11g

 

//最后再做几下修改就大功告成了:

vi /u01/app/oracle/producte/11.1.0.6/bin/dbshut

把ORACLE_HOME_LISTNER=$1改成ORACLE_HOME_LISTNER=$ORACLE_HOME

vi /u01/app/oracle/producte/11.1.0.6/bin/dbstart

把ORACLE_HOME_LISTNER=$1改成ORACLE_HOME_LISTNER=$ORACLE_HOME

vi /etc/oratab

把sales:/u01/app/oracle/product/11.1.0.6:N 改成ales:/u01/app/oracle/product/11.1.0.6:Y

好了,到此Oracle 11g安装完成了,安装的是否成功测试一下就知道了(等不急了......)。

5、测试oracle
[oracle@root-bs Oracle11g-linux_x86]$ dbstart

Processing Database instance "sales": logfile /u01/app/oracle/product/11.1.0.6/

startup.log
[oracle@root-bs Oracle11g-linux_x86]$ sqlplus /nolog

SQL*Plus: Release 11.1.0.6.0 - Production on Wed Sep 24 13:57:51 2008

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> startup

ORA-01081: cannot start already-running ORACLE - shut it down first

此提示说明服务已经运行不必再重新启动了。如果出现如下错误:
ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/u01/app/oracle/product/11.1.0.6/dbs/initsales.ora'
说明没有找到Oracle实例,请重新创建实例:

[oracle@root-bs Oracle11g-linux_x86]$ netca

Oracle,11g
创建监听:

 

具体步骤不再多说
[oracle@root-bs Oracle11g-linux_x86]$ dbca

创建数据库:

Oracle,11g
具体步骤不再多说

总述:到此安装步骤已经写晚了,第一次写这么详细的步骤,写的比较匆忙,不足之处请大伙谅解,写这个步骤主要是不想让初学者们不要走这么多的弯路,尽可能的把我所知道的全部贡献给大家,希望能带给大伙一点点的帮助。

Oracle,11g

 

Oracle,11g

 

Oracle,11g