CentOS5.6下安装Oracle10G
********************************************************************************
*目标:在Centos系统下,安装Oracle10g软件
*步骤:
* 1、安装包
* 2、域名解析设置及网络配置
* 3、创建用户、组
* 4、配置内核參数、改动环境变量
* 5、设置shell限制
* 6、创建相关文件夹、赋权
* 7、远程图形化安装Oracle软件
*******************************************************************************
1、安装包
--挂载光盘
[root@localhost CentOS]#mount /dev/hdb /media
--通过df -h查看到相关文件夹,依实际情况挂载
--配置yum
[root@localhost CentOS]# cd /etc/yum.repos.d/
--进入到该文件夹下生成一个配置文件
[root@localhost CentOS]# ls
[root@localhost CentOS]# cp CentOS-Debuginfo.repo yum.repo --做一个拷贝
[root@localhost CentOS]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak
[root@localhost CentOS]#cp * /hylbak --将yum.repos.d下文件做一个备份
[root@localhost CentOS]#rm -rf Centos* --将无关文件删除
[root@localhost CentOS]#vi yum.repo
[debug]
name=CentOS-6 - Debuginfo
baseurl=file:///media
--此处光盘挂载到了media文件夹下
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
~
~
[root@localhost CentOS]#yum install -y binutils-2.17.50.0.6
--举例:使用yum安装格式
[root@localhost CentOS]#rpm -q binutils-2.17.50.0.6
--举例:使用rpm查看软件包安装情况
--改动:不要按以下參考文档提示安装,第一次按其安装出错
--安装时须要使用下文改动的“黄色”标记安装方案
--保留第一次缺失安装包參考,引以为戒
--安装包缺失时參考例如以下文档所致
--下表为第一次安装,安装兴许发现出现包不全状况,对其包进行更正和补充,若实际安装採用之后的安装包方案,此处不做删除以示反例
安装包參考(提醒:不要按此安装,实际安装见后文) |
|
參考文档提示安装包 |
实际通过光盘安装包 |
binutils-2.17.50.0.6 |
binutils-2.17.50.0.6 |
compat-libstdc++-33-3.2.3 |
compat-libstdc++-33-3.2.3-61 |
elfutils-libelf-0.125 |
elfutils-libelf-0.137 |
elfutils-libelf-devel-0.125 |
elfutils-libelf-devel-0.137 |
elfutils-libelf-devel-static-0.125 |
elfutils-libelf-devel-static-0.137 |
gcc-4.1.2 |
gcc-4.1.2 |
gcc-c++-4.1.2 |
gcc-c++-4.1.2 |
glibc-common-2.5 |
glibc-common-2.5 |
glibc-devel-2.5 |
glibc-devel-2.5 |
glibc-headers-2.5 |
glibc-headers-2.5 |
kernel-headers-2.6.18 |
kernel-headers-2.6.18 |
ksh-20060214 |
ksh-20100202-1.el5_5.1 |
libaio-0.3.106 |
libaio-0.3.106 |
libaio-devel-0.3.106 |
libaio-devel-0.3.106 |
libgcc-4.1.2 |
libgcc-4.1.2 |
libgomp-4.1.2 |
libgomp-4.4.4-13.el5.x86_64 |
libstdc++-4.1.2 |
libstdc++-4.1.2 |
libstdc++-devel-4.1.2 |
libstdc++-devel-4.1.2 |
make-3.81 |
make-3.81 |
sysstat-7.0.2 |
sysstat-7.0.2 |
unixODBC-2.2.11(32 bit) |
unixODBC-2.2.11-7.1 |
unixODBC-devel |
unixODBC-devel-2.2.11-7.1.x86_64 |
pdksh-5.2.14 |
pdksh-5.2.14-36.el5 |
numactl-0.9.8 |
numactl-0.9.8 |
libXp-1.0.0 |
libXp-1.0.0 |
libXp-devel-1.0.0 |
libXp-devel-1.0.0-8.1.el5.x86_64、libXp-devel-1.0.0-8.1.el5.i386.rpm |
libXau-devel-1.0.1 |
libXau-devel-1.0.1 |
--按错误參考安装包指令
yuminstall -y binutils-2.17.50.0.6 compat-libstdc++-33-3.2.3-61elfutils-libelf-0.137 elfutils-libelf-devel-0.137elfutils-libelf-devel-static-0.137 gcc-4.1.2 gcc-c++-4.1.2 glibc-common-2.5glibc-devel-2.5 glibc-headers-2.5 kernel-headers-2.6.18
ksh-20100202-1.el5_5.1libaio-0.3.106 libaio-devel-0.3.106 libgcc-4.1.2 libgomp-4.4.4-13.el5.x86_64libstdc++-4.1.2 libstdc++-devel-4.1.2 make-3.81 sysstat-7.0.2unixODBC-2.2.11-7.1 unixODBC-devel-2.2.11-7.1.x86_64 pdksh-5.2.14-36.el5numactl-0.9.8 libXp-1.0.0
libXp-devel-1.0.0-8.1.el5.x86_64libXp-devel-1.0.0-8.1.el5.i386.rpm libXau-devel-1.0.1
正确安装包方案(使用下面安装包流程,经过二次验证成功)
--使用下面安装包方案
--依据多次试验,运行例如以下指令,安装包
--安装经常使用软件
[root@hyl ~]# yum -y install autoconf automake binutils-devel bisoncpp dos2unix ftp gcc gcc-c++ lrzsz python-devel
--安装 Oracle必需软件:
[root@hyl ~]# yum -y install compat-db compat-db42 compat-db43 compat-gcc-34 compat-gcc-34-c++ compatlibstdc++-33 glibc-* glibc-*.i686libXpm-*.i686 libXp.so.6 libXt.so.6 libXtst.so.6 libgcc_s.so.1 ksh libXp libaio-develnumactl numactl-devel
unixODBC unixODBC-devel
[root@hyl ~]# yum -y install glibc-devel.i386 glibc-devel.x86_64compat-db.i386 compat-db.x86_64 compat-libstdc++-296.i386compat-libstdc++-33.i386 compat-libstdc++-33.x86_64
[root@hyl ~]# yum -y install compat-gcc-34.x86_64compat-gcc-34-c++.x86_64 gcc.x86_64 gcc-c++.x86_64 pdksh.x86_64 openmotif.i386openmotif.x86_64 sysstat.x86_64
--验证安装包情况
[root@hyl yum.repos.d]# rpm -q glibc-devel.i386 glibc-devel.x86_64 compat-db.i386 compat-db.x86_64 compat-libstdc++-296.i386compat-libstdc++-33.i386 compat-libstdc++-33.x86_64
glibc-devel-2.5-58
glibc-devel-2.5-58
compat-db-4.2.52-5.1
compat-db-4.2.52-5.1
compat-libstdc++-296-2.96-138
compat-libstdc++-33-3.2.3-61
compat-libstdc++-33-3.2.3-61
[root@hyl yum.repos.d]# rpm -q compat-gcc-34.x86_64compat-gcc-34-c++.x86_64 gcc.x86_64 gcc-c++.x86_64 pdksh.x86_64 openmotif.i386openmotif.x86_64 sysstat.x86_64
compat-gcc-34-3.4.6-4.1
compat-gcc-34-c++-3.4.6-4.1
gcc-4.1.2-50.el5
gcc-c++-4.1.2-50.el5
pdksh-5.2.14-36.el5
openmotif-2.3.1-5.el5_5.1
openmotif-2.3.1-5.el5_5.1
sysstat-7.0.2-3.el5_5.1
2、域名解析设置及网络配置
[root@localhost CentOS]# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6localhost6
192.168.56.103 hyl
[root@localhost CentOS]# vi/etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82540EM Gigabit Ethernet Controller
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.56.103
NETMASK=255.255.255.0
HWADDR=08:00:27:29:DB:B2
ONBOOT=yes
~
~
[root@localhost CentOS]# service network restart
正在关闭接口 eth0: [确定]
关闭环回接口: [确定]
禁用 IPv4 包转送:net.ipv4.ip_forward = 0
[确定]
弹出环回接口: [确定]
弹出界面 eth0: [确定]
[root@localhost CentOS]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
#HOSTNAME=localhost.localdomain
HOSTNAME=hyl
~
~
[root@localhost CentOS]# su -
3、创建用户、组
[root@hyl ~]# groupadd oinstall
[root@hyl ~]# groupadd dba
[root@hyl ~]# useradd -g oinstall -G dba oracle
[root@hyl ~]# passwd oracle
Changingpassword for user oracle.
New UNIXpassword: oracle
BADPASSWORD: it is based on a dictionary word
Retypenew UNIX password: oracle
passwd:all authentication tokens updated successfully.
[root@hyl ~]# id oracle
uid=501(oracle)gid=501(oinstall) groups=501(oinstall),502(dba)
4、配置内核參数、改动环境变量
[root@hyl ~]# vi /etc/sysctl.conf
加入:
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65500
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 262144
~
"/etc/sysctl.conf" 43L, 1228C written
[root@hyl ~]# 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= 68719476736
kernel.shmall= 4294967296
kernel.shmmni= 4096
kernel.sem= 250 32000 100 128
fs.file-max= 65536
net.ipv4.ip_local_port_range= 1024 65500
net.core.rmem_default= 4194304
net.core.wmem_default= 262144
net.core.rmem_max= 4194304
net.core.wmem_max= 262144
--改动oracle用户的环境配置文件
--运行:su - oracle切换到oracle用户环境,然后编辑
.bash_profile文件,更改PATH的配置,同一时候在环境变量中添加NLS_LANG的配置
[root@hyl yum.repos.d]# su - oracle
[oracle@hyl ~]$ vi .bash_profile
ORACLE_BASE=/home/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=xcky
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH
5、设置 shell 限制
--加入下面參数
[root@hyl ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@hyl ~]# vi /etc/pam.d/login
--加入下面參数
session required /lib/security/pam_limits.so
session required pam_limits.so
[root@hyl ~]# vi /etc/profile
--加入下面參数
if [ $USER = "oracle" ]; then
if [ $SHELL ="/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384-n 65536
fi
fi
--在/etc/profile文件里改动下面内容
ulimit –s –c 0 >/dev/null 2> &1 改动为
ulimit –s –c unlimited >/dev/null 2> &1
6、创建相关文件夹、赋权
[root@hyl ~]# mkdir -p /home/u01/app/oracle
[root@hyl ~]# mkdir -p /home/u01/app/oracle/oraInventory
[root@hyl ~]# chown -R oracle:oinstall /home/u01/app/oracle
[root@hyl ~]# chmod -R 775 /home/u01/app/oracle
[oracle@hyl home]# mkdir -p /home/oracle/downloads
[root@hyl ~]# chown -R oracle:oinstall /home/oracle/downloads
--上传安装包
[root@hyl downloads]# zcat 10201_database_linux_x86_64.cpio.gz |cpio -idmv > /dev/null 2>&1 --上传安装包后,解压安装包
[root@hyl install]# vi/home/oracle/downloads/database/install/oraparam.ini
--加入redhat-5例如以下所看到的
[Certified Versions]
Linux=redhat-5,redhat-3,SuSE-9,redhat-4,UnitedLinux-1.0,asianux-1,asianux-2
7、远程图形化安装 Oracle 软件
--使用X-manager软件调用图形化界面,操作參考例如以下
$./runInstaller -X-manager下运行,出现乱码问题
--下面解决乱码问题
[root@hyl ~]# vi /etc/sysconfig/i18n
LANG="en_US.UTF-8"
#LANG="zh_CN.UTF-8"
~
~
--按參看下图,输入export指令
--安装过程报错:Errorinvoking target ‘install’ of makefile
--改动:下面报错皆为第一次缺失包情况,若按上文改动后文档安装包,将不会出现例如以下报错
--保留报错截图,引以为戒
--rpm安装缺失的包
[root@hyl CentOS]# find -name "compat-libstdc*"
./compat-libstdc++-296-2.96-138.i386.rpm
./compat-libstdc++-33-3.2.3-61.x86_64.rpm
./compat-libstdc++-33-3.2.3-61.i386.rpm
[root@hyl CentOS]# rpm -ivh compat-libstdc++-296-2.96-138.i386.rpm
warning:compat-libstdc++-296-2.96-138.i386.rpm: Header V3 DSA signature: NOKEY, key IDe8562897
error:failed to stat /media/CentOS_5.6_Final: 没有那个文件或文件夹
Preparing... ########################################### [100%]
1:compat-libstdc++-296 ###########################################[100%]
[root@hyl CentOS]# rpm -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm
warning:compat-libstdc++-33-3.2.3-61.x86_64.rpm: Header V3 DSA signature: NOKEY, key IDe8562897
error:failed to stat /media/CentOS_5.6_Final: 没有那个文件或文件夹
Preparing... ###########################################[100%]
packagecompat-libstdc++-33-3.2.3-61.x86_64 is already installed
[root@hyl CentOS]# rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm
warning:compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key IDe8562897
error:failed to stat /media/CentOS_5.6_Final: 没有那个文件或文件夹
Preparing... ########################################### [100%]
packagecompat-libstdc++-33-3.2.3-61.i386 is already installed
--尝试点击Retry继续
--再次报错:Error invokingtarget‘agent nmo nmb’of makefile
--使用yum安装例如以下包
glib-devel-1.2.10-20.el5 (i386)
glib-devel-1.2.10-20.el5 (x86_64)
glibc-devel-2.5-81.el5_8.2 (x86_64)
glibc-devel-2.5-81.el5_8.2 (i386)
--尝试点击Retry继续
--再次报错,尝试点击“Continue”继续
[root@hyl ~]# /home/u01/app/oracle/oraInventory/orainstRoot.sh
Changingpermissions of /home/u01/app/oracle/oraInventory to 770.
Changinggroupname of /home/u01/app/oracle/oraInventory to oinstall.
Theexecution of the script is complete
[root@hyl ~]# /home/u01/app/oracle/product/10.2.0/db_1/root.sh
RunningOracle10 root.sh script...
Thefollowing environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /home/u01/app/oracle/product/10.2.0/db_1
Enterthe 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...
Entrieswill be added to the /etc/oratab file as needed by
DatabaseConfiguration Assistant when a database is created
Finishedrunning generic part of root.sh script.
Nowproduct-specific root actions will be performed.
--软件安装结束,因为过程中报错,软件安装可能不成功,尝试启动dbca
$dbca --X-manager下无法启动dbca
--删除/home/oracle下oracle安装文件,又一次安装软件
--因为之前安装过程中,出现缺失包情况,又一次查阅官方文档,又一次安装和检查须要的包
位的安装包
[root@hyl ~]# yum -y install glibc-devel.i386 glibc-devel.x86_64compat-db.i386 compat-db.x86_64 compat-libstdc++-296.i386compat-libstdc++-33.i386 compat-libstdc++-33.x86_64
[root@hyl ~]# yum -y install compat-gcc-34.x86_64compat-gcc-34-c++.x86_64 gcc.x86_64 gcc-c++.x86_64 pdksh.x86_64 openmotif.i386openmotif.x86_64 sysstat.x86_64
--依照上文图形化安装oracle步骤,又一次安装oracle软件,直到运行脚本界面弹出,此时仅仅需跑一个脚本,例如以下图
[root@hyl /]# /home/u01/app/oracle/product/10.2.0/db_1/root.sh
RunningOracle10 root.sh script...
Thefollowing environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /home/u01/app/oracle/product/10.2.0/db_1
Enter thefull pathname of the local bin directory: [/usr/local/bin]:
The file"dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying dbhome to /usr/local/bin ...
The file"oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying oraenv to /usr/local/bin ...
The file"coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]: y
Copying coraenv to /usr/local/bin ...
Entrieswill be added to the /etc/oratab file as needed by
DatabaseConfiguration Assistant when a database is created
Finishedrunning generic part of root.sh script.
Nowproduct-specific root actions will be performed.
--按提示,点击完毕结束oracle软件的安装
--经验证,此次安装oracle软件成功,已经能够dbca建库
说明:有关dbca建库,请关注兴许文章。
***********************************************声明************************************************
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。
表述有错误之处,请您留言,不胜感激。
提醒:点击文件夹,更有助于您的查看。
*****************************************************************************************************