日期:2014-05-16  浏览次数:20536 次

Fedora下安装Oracle以及自动化脚本附完全删除方法(原创)

在Fedora14下文字界面安装oracle10gR2软件
?一.查看安装环境
1.内存和SWAP
# grep MemTotal /proc/meminfo
MemTotal:??????? 3096372 kB
# grep SwapTotal /proc/meminfo
SwapTotal:?????? 5119996 kB

2.系统架构
# uname -m
i686

3.CPU信息

# grep "model name" /proc/cpuinfo
model name??? : Intel(R) Core(TM)2 Duo CPU???? T5870? @ 2.00GHz
model name??? : Intel(R) Core(TM)2 Duo CPU???? T5870? @ 2.00GHz

4.磁盘空间需求
/tmp空间至少有1G的可用空间,安装空间至少需要3.95G

# df -Th ? ? /tmp
Filesystem??? Type????? Size?? Used?? Avail?? Use%?? Mounted on
/dev/sda1?????? ext4? ? ? 15G??? 4.9G??? 9.4G??? 35% ? ?? /tmp

5.系统运行级别
# who -r
run-level 5? 2011-06-02 10:00

3或者5均可

6.查看并修改操作系统release-id(这里的步骤在个人PC下是可以不改的)
# yum -y install redhat-lsb

# lsb_release -id
Distributor ID:??? Fedora
Description:??? Fedora release 15 (Lovelock)

# vim /etc/redhat-release
Fedora release 15 (Lovelock)
改成
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
安装完成以后改回即可
7.内核

# uname? -r
2.6.38.6-27.fc15.i686.PAE

需要2.6.9以上内核版本,不是的话可通过yum 来升级

# yum -y install kernel

二.安装依赖软件包

新建install.txt 输入下列安装包信息

binutils
compat-db
control-center
gcc
gcc-c++
glibc
glibc-common
gnome-libs
libstdc++
libstdc++-devel
make
pdksh?? //Fedora14 已经淘汰pdksh所以我们可以装ksh)
sysstat
xscreensaver

执行

#yum install -y `cat install.txt`

三.自动话脚本的编写

创建用户、配置所需环境变量:新建1preuser.sh键入如下代码

echo "Now create two groups named 'oinstall' and 'dba', plus a user named 'oracle'.Also setting the Environment"
groupadd oinstall?
groupadd -g 502dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 oinstall

useradd -g oinstall -G dba,oper,asmadmin,oinstall -c "Oracle software owner" -d /home/oracle oracle?
echo "oracle" | passwd --stdin oracle
echo "export ORACLE_BASE=/u01/app/oracle" >> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1' >> /home/oracle/.bash_profile
echo "export ORACLE_SID=czmmiao" >> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib' >> /home/oracle/.bash_profile
echo '