虽然 windows 平台下的 oracle 已经装过几回了
,但是 linux 下没有试过
。看网上的文档 , 好像比 windows 下装要复杂不少
,更改系统参数
,创建 user&group, 检查必要的软件包
,设置环境变量等一大堆工作要做
。于是趁周末在VMWare中装了一回
,记下具体步骤以供以后参考
。
OS 版本 : Red Hat Enterprise Linux AS release3 Update2 Kernel 2.4.21-15.EL (安装好内核开发工具)
Oracle 版本 : Oracle 10.1.0.2 for linux x86
Oracle10g 的的下载地址 : http://otn.oracle.com/software/products/database/oracle10g/htdocs/linuxsoft.html
准备安装
检查磁盘空间
Oracle Universal Installer 约需要 400M 左右的 /tmp 空间
# df -k /tmp
如果当前 /tmp 空间不够 , 你可以在其他空间足够的 filesystem 上创建新的临时目录
# mkdir //tmp
# chown root.root //tmp
# chmod 1777 //tmp
# export TEMP=/
# export TMPDIR=/
装好 oracle 后再恢复到原来的状态
# rmdir //tmp
# unset TEMP
# unset TMPDIR
oracle 大约需要 3G 左右的空间(默认安装且包括初始库) ,事先请规划好
检查内存和交换区
查看物理内存大小
# grep MemTotal /proc/meminfo
查看交换区大小
# grep SwapTotal /proc/meminfo
安装 oracle 需要足够大的内存和交换区 , 所以最好还是找台好点的机器 。 oracle 推荐最好内存 512M 以上 , swap 1G 以上 。如果只是安装一个玩玩 ,实际上没那么多也没关系啦 ,我的虚拟机就只分了 384M 的内存和 768M 的 swap 。
检查软件包
使用指令
# rpm –qa | grep packname \ 其中 packname 是需要检查的软件包的名字
保证以下的包(或者更高版本)已经安装好 。没装的话到 redhat 的安装盘里都可以找到
gcc-3.2.3-34
make-3.79.1-17
binutils-2.14.90.0.4-35
openmotif-2.2.2-16
setarch-1.3-1
compat-db-4.0.14.5
compat-gcc-7.3-2.96.128
compat-gcc-c++-7.3-2.96.128
compat-libstdc++-7.3-2.96.128
compat-libstdc++-devel-7.3-2.96.128
安装RPM包
# rpm -Uvh packname
添加 group 和 user
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
建立 oracle 用户 ,其默认组为 oinstall ,同时也是 dba 组的成员
# /usr/sbin/useradd -g oinstall -G dba oracle
修改 oracle 用户的 password
# passwd oracle
建好后可以检查一下
# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
修改系统核心参数
编辑 sysctl.conf
# vi /etc/sysctl.conf
添加以下内容
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
保存退出后 ,执行以下命令使其生效 ( 当然重启也是可以的 ^-^)
# sysctl –p
检查一下上面的操作是否正确 :
# /sbin/sysctl -a | grep sem
# /sbin/sysctl -a | grep shm
# /sbin/sysctl -a | grep file-max
# /sbin/sysctl -a | grep ip_local_port_range
这些参数也可以直接更改 /proc/sys/kernel 下相应文件来实现 ,详细请参考
http://download-west.oracle.com/docs/html/A96167_01/pre.htm#CHDHDABJ
如果是生产库 ,出于性能上的考虑 , 还需要进行如下的设定 ,以便改进 Oracle 用户的有关 nofile( 可打开的文件描述符的最大数 ) 和 nproc( 单个用户可用的最大进程数量 ) 。如果仅仅是测试安装的话 ,也可以不用修改 。
# vi /etc/security/limits.conf
添加如下的行
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
# vi /etc/pam.d/login
添加如下的行
session required /lib/security/pam_limits.so
# 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
之后 ,验证一下
# su oracle
$ ulimit -a
设置环境变量
# su oracle
$ cd ~
$ vi .bach_profile
添加以下内容
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/
export ORACLE_SID=db01
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LC_CTYPE=en_US.UTF-8
其中 /opt/oracle 请事先建好并给予相应的权限 ,简单一点可以将其 owner 设为 oracle ( chown –R oracle.oinstall /opt/oracle ) ,作为 oracle 的安装目录 ( 可以自己另外规划 )
确认并是修改生效
$ source .bash_profile
开始安装
由于我是用虚拟机装的 , 我把从网上下的 oracle10g(ship.db.cpio.gz)copy 到了硬盘上 ,目录为 /tmp, 先作一下 CRC 验证 ,以免下载的 oracle 有问题 。
# cksum ship.db.cpio.gz
解压缩
# gzip –d ship.db.cpio.gz
解包 ship.db.cpio
# cpio -idmv < ship.db.cpio
得到安装目录 /tmp/Disk1 ,如果你有刻录机的话就可以把该目录刻到光盘上了 。这里我从硬盘安装 。
# su oracle
$ cd /tmp/Disk1
$ ./runInstaller
如果出现如下错误
xlib:connection to "localhost:0.0" refused by server
xlib:client is not authorized to connect to server
Exception in thread "main" java.lang.InternalError:can't connect to x11 window server using "localhost:0.0"
at .......
解决方法:
• # xhost +
access control disabled,clients can connect from any host.
\xhost + 是使所有用户从任何一个终端都能访问 Xserver(设置后可能有安全隐患);
• # xhost + yourip
yourip being added to acces control list
\xhost + yourip 使 ip 上的用户能够访问 Xserver
顺利的话 ,应该会出现 welcome 画面 ,点“ Next ”继续 。
指定 Inventory 目录和安装时使用的 group ,使用默认值即可 ,点“ Next ”
这时会弹出一个窗口 ,让你开启另外一个 terminal ,以 root 身份执行以下命令:
# /home/oracle/oraInventory/orainstRoot.sh
执行完后点“ Continue ”继续
接下来修改安装文件路径 , 按你的实际需要修改好后“ Next ”
选择安装内型 ,这里我选“ Enterprise Edition ”安装企业版 ,“ Next ”继续下一步 。
这时会自动检查你的系统是否满足安装的需求(可以按“stop”跳过) ,结果如下:
hecking operating system certification
Expected result: One of redhat-2.1,redhat-3,UnitedLinux-1.0
Actual Result: redhat-3
Check complete. The overall result of this check is: Passed
=======================================================================
Checking kernel parameters
Checking for VERSION=2.4.9.25; found VERSION=2.4.21. Passed
Checking for shmall=2097152; found shmall=2097152. Passed
Checking for shmseg=10; found shmseg=4096. Passed
Checking for semmsl=250; found semmsl=250. Passed
Checking for semmni=128; found semmni=128. Passed
Checking for filemax=65536; found filemax=39321. Passed
Checking for shmmni=4096; found shmmni=4096. Passed
Checking for semmns=32000; found semmns=32000. Passed
Checking for semopm=100; found semopm=32. passed
Checking for shmmin=1; found shmmin=1. Passed
Checking for shmmax=2147483648; found shmmax=33554432. passed
Check complete. The overall result of this check is: passed
=======================================================================
Checking recommended operating system packages
Checking for make-3.79; found make-3.79.1-17. Passed
Checking for binutils-2.11.90.0.8-12; found binutils-2.14.90.0.4-35. Passed
Checking for gcc-2.96; found gcc-3.2.3-34. Passed
Checking for openmotif-2.1.30-11; found openmotif-2.2.2-16. Passed
Check complete. The overall result of this check is: Passed
=======================================================================
Checking recommended glibc version
Expected result: 2.2.4.31.7
Actual Result: 2.3.2.95.20
Check complete. The overall result of this check is: Passed
=======================================================================
Validating ORACLE_BASE location (if set)
Check complete. The overall result of this check is: Passed
=======================================================================
如果全部 passed ,继续下一步 。否则 ,请参照 准备安装 部分重新作相应修改 ,然后“ Retry ”重新检测 ,直到 passed 到下一步 。
接下来选择建库的类型 ,这里我先不建库 ,待安装好后在利用 dbca 来建库或者手工建库(如何用 dbca 建库请到 http://www.google.com 搜索相应文章) 。所以选择“ Do not create a starter database ”后“ Next ” 。
出现“ Summary ”画面 ,确认后按“ Install ” 。
最后还会弹出一个对话框 ,要求以root身份执行$ORACLE_HOME/root.sh
# $ORACLE_HOME/root.sh
友情提示
安装过程中如果出现错误 ,请利用 google 搜索相应的解决方法 。
OS 版本 : Red Hat Enterprise Linux AS release3 Update2 Kernel 2.4.21-15.EL (安装好内核开发工具)
Oracle 版本 : Oracle 10.1.0.2 for linux x86
Oracle10g 的的下载地址 : http://otn.oracle.com/software/products/database/oracle10g/htdocs/linuxsoft.html
准备安装
检查磁盘空间
Oracle Universal Installer 约需要 400M 左右的 /tmp 空间
# df -k /tmp
如果当前 /tmp 空间不够 , 你可以在其他空间足够的 filesystem 上创建新的临时目录
# mkdir //tmp
# chown root.root //tmp
# chmod 1777 //tmp
# export TEMP=/
# export TMPDIR=/
装好 oracle 后再恢复到原来的状态
# rmdir //tmp
# unset TEMP
# unset TMPDIR
oracle 大约需要 3G 左右的空间(默认安装且包括初始库) ,事先请规划好
检查内存和交换区
查看物理内存大小
# grep MemTotal /proc/meminfo
查看交换区大小
# grep SwapTotal /proc/meminfo
安装 oracle 需要足够大的内存和交换区 , 所以最好还是找台好点的机器 。 oracle 推荐最好内存 512M 以上 , swap 1G 以上 。如果只是安装一个玩玩 ,实际上没那么多也没关系啦 ,我的虚拟机就只分了 384M 的内存和 768M 的 swap 。
检查软件包
使用指令
# rpm –qa | grep packname \ 其中 packname 是需要检查的软件包的名字
保证以下的包(或者更高版本)已经安装好 。没装的话到 redhat 的安装盘里都可以找到
gcc-3.2.3-34
make-3.79.1-17
binutils-2.14.90.0.4-35
openmotif-2.2.2-16
setarch-1.3-1
compat-db-4.0.14.5
compat-gcc-7.3-2.96.128
compat-gcc-c++-7.3-2.96.128
compat-libstdc++-7.3-2.96.128
compat-libstdc++-devel-7.3-2.96.128
安装RPM包
# rpm -Uvh packname
添加 group 和 user
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
建立 oracle 用户 ,其默认组为 oinstall ,同时也是 dba 组的成员
# /usr/sbin/useradd -g oinstall -G dba oracle
修改 oracle 用户的 password
# passwd oracle
建好后可以检查一下
# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
修改系统核心参数
编辑 sysctl.conf
# vi /etc/sysctl.conf
添加以下内容
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
保存退出后 ,执行以下命令使其生效 ( 当然重启也是可以的 ^-^)
# sysctl –p
检查一下上面的操作是否正确 :
# /sbin/sysctl -a | grep sem
# /sbin/sysctl -a | grep shm
# /sbin/sysctl -a | grep file-max
# /sbin/sysctl -a | grep ip_local_port_range
这些参数也可以直接更改 /proc/sys/kernel 下相应文件来实现 ,详细请参考
http://download-west.oracle.com/docs/html/A96167_01/pre.htm#CHDHDABJ
如果是生产库 ,出于性能上的考虑 , 还需要进行如下的设定 ,以便改进 Oracle 用户的有关 nofile( 可打开的文件描述符的最大数 ) 和 nproc( 单个用户可用的最大进程数量 ) 。如果仅仅是测试安装的话 ,也可以不用修改 。
# vi /etc/security/limits.conf
添加如下的行
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
# vi /etc/pam.d/login
添加如下的行
session required /lib/security/pam_limits.so
# 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
之后 ,验证一下
# su oracle
$ ulimit -a
设置环境变量
# su oracle
$ cd ~
$ vi .bach_profile
添加以下内容
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/
export ORACLE_SID=db01
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LC_CTYPE=en_US.UTF-8
其中 /opt/oracle 请事先建好并给予相应的权限 ,简单一点可以将其 owner 设为 oracle ( chown –R oracle.oinstall /opt/oracle ) ,作为 oracle 的安装目录 ( 可以自己另外规划 )
确认并是修改生效
$ source .bash_profile
开始安装
由于我是用虚拟机装的 , 我把从网上下的 oracle10g(ship.db.cpio.gz)copy 到了硬盘上 ,目录为 /tmp, 先作一下 CRC 验证 ,以免下载的 oracle 有问题 。
# cksum ship.db.cpio.gz
解压缩
# gzip –d ship.db.cpio.gz
解包 ship.db.cpio
# cpio -idmv < ship.db.cpio
得到安装目录 /tmp/Disk1 ,如果你有刻录机的话就可以把该目录刻到光盘上了 。这里我从硬盘安装 。
# su oracle
$ cd /tmp/Disk1
$ ./runInstaller
如果出现如下错误
xlib:connection to "localhost:0.0" refused by server
xlib:client is not authorized to connect to server
Exception in thread "main" java.lang.InternalError:can't connect to x11 window server using "localhost:0.0"
at .......
解决方法:
• # xhost +
access control disabled,clients can connect from any host.
\xhost + 是使所有用户从任何一个终端都能访问 Xserver(设置后可能有安全隐患);
• # xhost + yourip
yourip being added to acces control list
\xhost + yourip 使 ip 上的用户能够访问 Xserver
顺利的话 ,应该会出现 welcome 画面 ,点“ Next ”继续 。
指定 Inventory 目录和安装时使用的 group ,使用默认值即可 ,点“ Next ”
这时会弹出一个窗口 ,让你开启另外一个 terminal ,以 root 身份执行以下命令:
# /home/oracle/oraInventory/orainstRoot.sh
执行完后点“ Continue ”继续
接下来修改安装文件路径 , 按你的实际需要修改好后“ Next ”
选择安装内型 ,这里我选“ Enterprise Edition ”安装企业版 ,“ Next ”继续下一步 。
这时会自动检查你的系统是否满足安装的需求(可以按“stop”跳过) ,结果如下:
hecking operating system certification
Expected result: One of redhat-2.1,redhat-3,UnitedLinux-1.0
Actual Result: redhat-3
Check complete. The overall result of this check is: Passed
=======================================================================
Checking kernel parameters
Checking for VERSION=2.4.9.25; found VERSION=2.4.21. Passed
Checking for shmall=2097152; found shmall=2097152. Passed
Checking for shmseg=10; found shmseg=4096. Passed
Checking for semmsl=250; found semmsl=250. Passed
Checking for semmni=128; found semmni=128. Passed
Checking for filemax=65536; found filemax=39321. Passed
Checking for shmmni=4096; found shmmni=4096. Passed
Checking for semmns=32000; found semmns=32000. Passed
Checking for semopm=100; found semopm=32. passed
Checking for shmmin=1; found shmmin=1. Passed
Checking for shmmax=2147483648; found shmmax=33554432. passed
Check complete. The overall result of this check is: passed
=======================================================================
Checking recommended operating system packages
Checking for make-3.79; found make-3.79.1-17. Passed
Checking for binutils-2.11.90.0.8-12; found binutils-2.14.90.0.4-35. Passed
Checking for gcc-2.96; found gcc-3.2.3-34. Passed
Checking for openmotif-2.1.30-11; found openmotif-2.2.2-16. Passed
Check complete. The overall result of this check is: Passed
=======================================================================
Checking recommended glibc version
Expected result: 2.2.4.31.7
Actual Result: 2.3.2.95.20
Check complete. The overall result of this check is: Passed
=======================================================================
Validating ORACLE_BASE location (if set)
Check complete. The overall result of this check is: Passed
=======================================================================
如果全部 passed ,继续下一步 。否则 ,请参照 准备安装 部分重新作相应修改 ,然后“ Retry ”重新检测 ,直到 passed 到下一步 。
接下来选择建库的类型 ,这里我先不建库 ,待安装好后在利用 dbca 来建库或者手工建库(如何用 dbca 建库请到 http://www.google.com 搜索相应文章) 。所以选择“ Do not create a starter database ”后“ Next ” 。
出现“ Summary ”画面 ,确认后按“ Install ” 。
最后还会弹出一个对话框 ,要求以root身份执行$ORACLE_HOME/root.sh
# $ORACLE_HOME/root.sh
友情提示
安装过程中如果出现错误 ,请利用 google 搜索相应的解决方法 。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10294527/viewspace-122268/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10294527/viewspace-122268/
本文详细记录了Oracle10g在Linux RedHat Enterprise Linux AS release 3 Update 2系统下的安装过程,包括系统参数配置、软件包检查、用户与组创建、环境变量设置及具体安装步骤。
1266

被折叠的 条评论
为什么被折叠?



