以下操作可能会经常涉及到文件的权限问题,最好先切换到root用户再进行操作。
1.修改用户的SHELL的限制,修改/etc/security/limits.conf文件,输入命令:vi /etc/security/limits.conf,按i键进入编辑模式,将下列内容加入该文件:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
2.修改/etc/pam.d/login 文件,输入命令:vi /etc/pam.d/login,按i键进入编辑模式,将下列内容加入该文件:
session required /lib/security/pam_limits.so
session required pam_limits.so
3.修改linux内核,修改/etc/sysctl.conf文件,输入命令: vi /etc/sysctl.conf ,按i键进入编辑模式,将下列内容加入该文件:
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
4.要使 /etc/sysctl.conf 更改立即生效,执行以下命令。 输入: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
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
5.编辑 /etc/profile ,输入命令:vi /etc/profile,按i键进入编辑模式,将下列内容加入该文件:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
6.创建相关用户和组,作为软件安装和支持组的拥有者。创建用户,输入命令:
groupadd oinstall
groupadd dba
创建Oracle用户和密码,输入命令:
useradd -g oinstall -g dba -m oracle
passwd oracle
然后会让你输入密码,密码任意输入2次,但必须保持一致,回车确认
7.创建数据库软件目录和数据文件存放目录,目录的位置,根据自己的情况来定,注意磁盘空间即可,这里放到oracle用户下,例如:
输入命令:
mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
mkdir /home/oracle/app/oradata
mkdir /home/oracle/app/oracle/product
8.更改目录属主为Oracle用户所有,输入命令:
chown -R oracle:oinstall /home/oracle/app
9.配置oracle用户的环境变量,首先,切换到新创建的oracle用户下,
输入:su oracle ,然后直接在输入 : vi .bash_profile ,按i编辑 .bash_profile,进入编辑模式,增加以下内容:
umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
10.安装包检测及安装
在终端中执行:
rpm -q gcc make binutils setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel unixODBC unixODBC-devel libaio-devel sysstat
结果为:
gcc-4.4.7-4.el6.i686
make-3.81-20.el6.i686
binutils-2.20.51.0.2-5.36.el6.i686
package setarch is not installed
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
package unixODBC is not installed
package unixODBC-devel is not installed
package libaio-devel is not installed
sysstat-9.0.4-22.el6.i686
我们看到有很多
11.当上述系统要求操作全部完成后,注销系统,在图形界面以Oracle用户登陆。首先将下载的Oracle安装包复制到linux中.打开一个终端,
运行unzip命令解压oracle安装文件,输入命令:
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
解压完成后 cd 进入其解压后的目录database,输入命令:
cd database
使用ls命令可以查看解压后database所包含的文件,如下:
doc install response rpm runInstaller sshsetup stage welcome.html
12.执行安装,输入命令:./runInstaller
提示需要安装一下软件:
compat-libstdc++-33-3.2.3-69.el6.i686.rpm
elfutils-libelf-devel-0.152-1.el6.i686.rpm
gcc-c++-4.4.7-4.el6.i686.rpm
libaio-devel-0.3.107-10.el6.i686.rpm
libstdc++-devel-4.4.7-4.el6.i686.rpm
pdksh-5.2.14-37.el5_8.1.i386.rpm
unixODBC-2.2.14-12.el6_3.i686.rpm
unixODBC-devel-2.2.14-12.el6_3.i686.rpm
由于网络问题需要手动下载安装,到http://pkgs.org/centos-6/centos-i386 ,下载然后安装
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.i686.rpm elfutils-libelf-devel-0.152-1.el6.i686.rpm gcc-c++-4.4.7-4.el6.i686.rpm libaio-devel-0.3.107-10.el6.i686.rpm libstdc++devel-4.4.7-4.el6.i686.rpm pdksh-5.2.14-37.el5_8.1.i386.rpm unixODBC-2.2.14-12.el6_3.i686.rpm unixODBC-devel-2.2.14-12.el6_3.i686.rpm
再次执行./runInstaller,安装的时间会比较长;
然后在root下执行两个脚本文件,具体如下:
cd /home/oracle/oraInventory
./orainstRoot.sh
cd /home/oracle/app/oracle/product/11.2.0/dbhome_1
./root.sh
然后在oracle用户下执行sqlplus /nolog,结果如下:
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 25 02:11:18 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
安装成功。