Linux安装Ora10g(一).装备工作
一、安装RH4
操作系统使用在VMware上安装的RadHat_AS4
系统内核为:
# uname -r
2.6.9-5.EL
检查CPU版本:
# cat /proc/cpuinfo
...
检查Linux版本:
# cat /etc/issue
Red Hat Enterprise Linux AS release 4 (Nahant)
在需要使用SSH连接虚拟机里的Linux时,可以ping通,但是连不上,google了一下发现是因为开启了IPv6导致SSH无法绑定在0.0.0.0的22端口上导致的
# iptables -I INPUT -p tcp --dport 22 -j ACCEPT
添加规则后连接成功
注:iptables命令具体操作见“IPTABLES手册”
二、检查系统参数
安装完Linux之后,首先检查系统参数:
# grep MemTotal /proc/meminfo
MemTotal: 1035864 kB (1G内存)
# grep SwapTotal /proc/meminfo
SwapTotal: 2031608 kB (2G交换空间)
注:grep函数的用法参见“Grep命令学习”
检查空闲的可用硬盘空间(3G左右),以及临时文件夹空间(400M)
# df -k /tmp
# df -k
安装Oracle10g需要以下Package:
binutils-2.15.92.0.2-13.EL4
compat-db-4.1.25-9
compat-libstdc++-296-2.96-132.7.2
control-center-2.8.0-12
gcc-3.4.3-22.1.EL4
gcc-c++-3.4.3-22.1.EL44
glibc-2.3.4-2.9
glibc-common-2.3.4-2.9
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-22.1
libstdc++-devel-3.4.3-22.1
make-3.80-5
pdksh-5.2.14-30
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.2
setarch-1.6-1
compat-db-4.1.25-9
compat-libstdc++-296-2.96-132.7.2
control-center-2.8.0-12
gcc-3.4.3-22.1.EL4
gcc-c++-3.4.3-22.1.EL44
glibc-2.3.4-2.9
glibc-common-2.3.4-2.9
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-22.1
libstdc++-devel-3.4.3-22.1
make-3.80-5
pdksh-5.2.14-30
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.2
setarch-1.6-1
检查Package是否已安装:
# rpm -q \binutils compat-db compat-libstdc++-296 control-center gcc gcc-c++ glibc glibc-common gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver setarch
binutils-2.15.92.0.2-10.EL4
compat-db-4.1.25-9
package compat-libstdc++-296 is not installed
control-center-2.8.0-12
package gcc is not installed
package gcc-c++ is not installed
glibc-2.3.4-2
glibc-common-2.3.4-2
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-9.EL4
package libstdc++-devel is not installed
make-3.80-5
pdksh-5.2.14-30
package sysstat is not installed
xscreensaver-4.18-5.rhel4.2
setarch-1.6-1
binutils-2.15.92.0.2-10.EL4
compat-db-4.1.25-9
package compat-libstdc++-296 is not installed
control-center-2.8.0-12
package gcc is not installed
package gcc-c++ is not installed
glibc-2.3.4-2
glibc-common-2.3.4-2
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-9.EL4
package libstdc++-devel is not installed
make-3.80-5
pdksh-5.2.14-30
package sysstat is not installed
xscreensaver-4.18-5.rhel4.2
setarch-1.6-1
在光盘中找到安装文件,安装缺少的Package,包括:
disk3/RedHat/RPMS/compat-libstdc++-296-2.96-132.7.2.i386.rpm
disk3/RedHat/RPMS/gcc-3.4.3-9.EL4.i386.rpm
disk3/RedHat/RPMS/gcc-c++-3.4.3-9.EL4.i386.rpm
disk3/RedHat/RPMS/libstdc++-devel-3.4.3-9.EL4.i386.rpm
disk4/RedHat/RPMS/sysstat-5.0.5-1.i386.rpm
如果安装盘中没有需要的Package,也可以到网上下载,例如:
http://rpm.pbone.net/index.php3/stat/4/idpl/2060541/com/binutils-2.15.92.0.2-13.i386.rpm.html
下载完成后执行下列命令安装:
#rpm -Uvh --force binutils-2.15.92.0.2-13.i386.rpm
#rpm -Uvh --force binutils-2.15.92.0.2-13.i386.rpm
网上资料推荐安装binutils-2.15.92.0.2-13.0.0.0.2.x86_64.rpm 和 compat-oracle-rhel4-1.0-5.i386.rpm ,但是经测试不装也可以安装Oracle
三、配置核心参数
1、# vi /etc/sysctl.conf
加入下列内容:
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
注:只需修改kernel.shmmax为物理内存的一半(字节)
编辑完之后存盘退出,然后运行下列命令重新加载并验证参数是否正确:
#sysctl -p
2、# vi /etc/security/limits.conf
加入下列内容:
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
3、# vi /etc/pam.d/login
加入下列内容:
session required /lib/security/pam_limits.so
session required pam_limits.so
4、# vi /etc/selinux/config
session required pam_limits.so
4、# vi /etc/selinux/config
修改以下内容:
SELINUX=disabled
注:关于vi编辑器的用法,参见“vi编辑器的基本操作”
四、创建用户
创建oracle用户,以及dba、oinstall组,并将oracle加入:
# groupadd dba
# groupadd oinstall
# useradd -g oinstall -G dba -m oracle
# passwd oracle
# groupadd oinstall
# useradd -g oinstall -G dba -m oracle
# passwd oracle
注:关于用户及组的操作,见“linux用户组操作文档”
创建oracle目录,注意磁盘的空闲空间。这里我们创建到opt目录下:
# mkdir /opt/ora10g
# mkdir /opt/ora10g/product
# mkdir /opt/ora10g/oradata
# mkdir /opt/ora10g/product
# mkdir /opt/ora10g/oradata
分配oracle在目录中的权限:
# chown -R oracle.oinstall /opt/ora10g
五、配置Oracle用户的环境变量
先将用户切换到oracle
# su - oracle
编辑.bash_profile修改环境变量
$ vi .bash_profile
将以下内容加入文件:
##--------------------------------------
## Set for Oracle10g Install |
##--------------------------------------
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=dodo
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/usr/X11R6/lib64/
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LD_ASSUME_KERNEL=2.6.9
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
umask 022
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
##------------------- Set Over
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
##------------------- Set Over
注:在ORACLE_SID中改为自己需要的默认SID名;ORACLE_BASE改为安装目录。
-The End-