在Linux上部署Java开发环境笔记(四)
Linux中安装Oracle10g
2010/06/15
一、下载Oracle XE
此次使用的Linux是红旗桌面6.0版本,oracle官方称oracle10g标准版(10201_database_linux32.zip)只支持
redhat-3,SuSE-9,redhat-4,UnitedLinux-1.0,asianux-1,asianux-2,redhat-5等Linux服务器版本
本人亲测,也确实不行,安装到62%的时候出现卡死的情况
重新在网上找了一个轻量级的oracle版本Oracle XE
下载地址:
http://download-llnw.oracle.com/otn/linux/oracle10g/xe/10201/oracle-xe-univ-10.2.0.1-1.0.i386.rpm
下载文件为“oracle-xe-univ-10.2.0.1-1.0.i386.rpm”
二、检查系统要求
查看可用RAM和交换空间大小
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM
数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。
要检查系统上的可用磁盘空间,运行以下命令:
df -h
三、检查下所需软件包
在shell下输入:
rpm -q
会输出下面软件安装的信息:
binutils.i386
package compat-db is not installed
compat-gcc-32-c++.i386
compat-gcc-32.i386
compat-libstdc++-33.i386
cpp.i386
gcc.i386
glibc-devel.i386
glibc-headers.i386
glibc.i686
ksh.i386
package libaio-devel is not installed
package libaio is not installed
make.i386
package compat-libstdc++-devel is not installed
package glibc-kernheaders is not installed
package setarch is not installed
package sysstat is not installed
没装的软件包,去网上搜索,下载后放在/usr/share/目录下
执行shell安装,如下:
[root@localhost opt]# cd /usr/share
[root@localhost share]# ll *rpm
-rw-r--r-- 1 root root 1756069 06-13 11:53
compat-db-4.2.52-5.1.i386.rpm
-rw-r--r-- 1 root root
-rw-r--r-- 1 root root
-rw-r--r-- 1 root
root
-rw-r--r-- 1 root root
[root@localhost share]# rpm -ivh libaio-0.3.103-3.i386.rpm
warning: libaio-0.3.103-3.i386.rpm: Header V3 DSA signature: NOKEY,
key ID 73307de6
Preparing...
[root@localhost share]# rpm -ivh
libaio-devel-0.3.103-3.i386.rpm
warning: libaio-devel-0.3.103-3.i386.rpm: Header V3 DSA signature:
NOKEY, key ID db42a60e
Preparing...
[root@localhost share]# rpm -ivh setarch-1.3-1.i386.rpm
warning: setarch-1.3-1.i386.rpm: Header V3 DSA signature: NOKEY,
key ID 025e513b
Preparing...
[root@localhost share]# rpm -ivh sysstat-5.0.5-1.i386.rpm
warning: sysstat-5.0.5-1.i386.rpm: Header V3 DSA signature: NOKEY,
key ID 4f2a6fd2
Preparing...
[root@localhost share]# rpm -ivh
compat-db-4.2.52-5.1.i386.rpm
warning: compat-db-4.2.52-5.1.i386.rpm: Header V3 DSA signature:
NOKEY, key ID e8562897
Preparing...
注:compat-libstdc++-devel 和 glibc-kernheaders 可能是因为其他软件版本高,导致这2个可以不用装(在网上搜索,有人说这2个包已废弃)
四、安装Oracle XE
1.将下载后的“oracle-xe-univ-10.2.0.1-1.0.i386.rpm”上传至/opt目录下
2.使用root用户登录
[root@localhost ~]# cd /opt/
[root@localhost opt]# rpm -ivh
oracle-xe-univ-10.2.0.1-1.0.i386.rpm
Preparing...
Executing Post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user
to
configure the database.
3.shell下输入'/etc/init.d/oracle-xe configure'执行安装
安装过程中会需要输入http监听端口(默认8080),和oracle监听端口(默认1521)
为防止和tomcat的http监听端口相冲突,此处将oracle的http监听端口设置为8081
[root@localhost opt]# /etc/init.d/oracle-xe configure
Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g
Express
Edition.
be starting upon system boot, the ports it will use, and the
passwords that
will be used for database accounts.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application
Express [8080]:8081
Specify a port that will be used for the database listener
[1521]:1521
Specify a password to be used for database
accounts.
password will be used for SYS and SYSTEM.
different passwords for each database account.
initial configuration:
Confirm the password:
Passwords do not match.
Confirm the password:
Do you want Oracle Database 10g Express Edition to be started on
boot (y/n) [y]:y
Starting Oracle Net Listener...Done
Configuring
Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8081/apex"
4.安装时防火墙一定要关闭
chkconfig –level 2345 iptables off
5. 安装时要关闭SELinux
(如果没有关闭,在安装应用程序的时候会出现问题)
setup Firewall configuration SELinux(Disabled)
五、查看监听是否启动
[root@localhost opt]# lsof -i:1521
COMMAND
tnslsnr 2149 oracle
tnslsnr 2149 oracle
oracle
[root@localhost opt]# lsof -i:8081
COMMAND
tnslsnr 2149 oracle
六、配置sqlplus
1.修改/root/.bash_profile内容
在/root/.bash_profile文件末增加下面内容
if [ -e
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
];
then
elif [ -e
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin/oracle_env.sh
];
then
fi
2.使配置文件/root/.bash_profile生效
然后shell下输入“source /root/.bash_profile”,使修改的配置文件生效:
[root@localhost opt]# source /root/.bash_profile
3.检验sqlplus是否可用
在shell下输入“sqlplus -?”:
[root@localhost opt]# sqlplus -?
SQL*Plus: Release 10.2.0.1.0 - Production
Copyright (c) 1982, 2005, Oracle.
用法 1: sqlplus -H | -V
用法 2: sqlplus [ [