Let's Go!

Oracle 10g在Redhat Linux 4上安装笔记

上一篇 / 下一篇  2010-08-25 16:25:05 / 个人分类:数据库


Oracle 10g在Redhat Linux 4上安装笔记


废言:一直想在linux下学习 oracle,但是一切的开始就是安装,所以,我们踏上征程。。。。。。

安装前的软件准备:
1. 10201_database_linux32.zip
2. RHEL4.8-i386-AS-DVD.iso
3. VMware Workstation
4. Xmanager
5. xshell/SecureCRT/putty

参考文档:
1. 视频:牛牛公作品:Oracle 10gR2在Redhat Linux 4上的安装,可惜没有PPT文档
  http://www.boobooke.com/v/bbk4352.zip
  http://www.boobooke.com/v/bbk4353.zip
2.http://www.oracle.com/technology/global/cn/pub/articles/smiley_10gdb_install.html
3. Oracle 10g联机文档


总体步骤:
第 1 部分: 安装linux操作系统,并安装好必要的依赖包
1.安装system
2. install vmware tools:
3. 修改hosname
4.修改参数:设置时间同步
5.修改启动参数,字符界面启动,启动3个用户:
6.安装依赖的包
7.安装另外两个需要额外下载的包:
8.安装sqlplus辅助工具

第 2 部分:针对 Oracle 配置 Linux
1.创建 Oracle 组和用户帐户
2.创建目录
3.配置 Linux 内核参数
4.为 oracle 用户设置 Shell 限制
5.配置oracle的环境变量:
6. 准备oracle安装文件
7. 准备Xmanager
8. 开始安装oracle
9. 创建数据库
10. 创建一个 Listener
11. 创建一个 service
12. 验证是否安装成功,sqlplus 连接

 

第 1 部分: 安装linux操作系统,并安装好必要的依赖包

1.安装system

  网络设置:
   安装的时候设置了固定IP
   但是和公司的网段IP不符。
   故应设置在相同网段(推荐)
   或者设置成自动获取

1.1 选择语言language:  U.S. English
1.2 磁盘分区: Manually partition with Disk Druid
Yes
创建磁盘分区:

一般来说建立LINUX 需要三个分区    
一个挂载点是/BOOT 引导分区格式为EXT2 或者EXT3 大小在150-200MB 为合适太大了只是浪费    
一个是 格式 SWAP类似WINDOWS 下的虚拟内存建议是 比实际内存大1/4为合适,SWAP 格式的没有挂载点     
最后一个是挂载点 /      是LINUX 主分区 格式EXT3    这个装东西的话主要就在这个区了   
 顺序是先建立     /BOOT     然后     SWAP     最后 /
 
具体操作:
new ---> /boot,ext2,100 MB(Fixed size), 勾选 Force to be a primary partition  ---> OK
new ---> swap, 1024 MB(Fixed size), 勾选 Force to be a primary partition      ---> OK
new ---> / ,ext3, 51200 MB(Fixed size), 勾选 Force to be a primary partition  ---> OK
new ---> /u01,ext3, fill to maximum allowable size, 勾选 Force to be a primary partition      ---> OK

1.3 Network Devices:
---> Edit, 取消 Configure using DHCP
     勾选 Activate on boot
     IP Address: 192.168.1.253
     Netmask:    255.255.255.0
   
    Set the hostname :  manually --- > Redhat
    Gateway : 192.168.1.1
    ---> Next --> Continue

1.4 firewall:
No firewall
SElinux --> Disable   
  
  1.5 Location
Asia/Shanghai

1.6 set Root Password: jonathan

1.7 software --- Customize software packages to be installed

勾选:Editors
      Development --- Development Tools,legacy software Development
      System --- System Tools---> sysstat

取消: Servers--- Server Configuration To0ls, Web Server, Windows File Server
       System --- Printing Support
       可以不取消

安装完毕 ---> Reboot
1.8 重启后继续配置,创建新用户jonathan/jonathan

 

2. install vmware tools:
1)  VM ---> remove devices ---> cd rom ---> redhat
    vm--->install vmware tools
    桌面出现 VMware Tools ---->执行 VMwareTools.rpm
2)  open new terminal ---> 执行 $vmware-config-tools.pl
3) 设置时间同步:
   $vmware-toolbox
   勾选上即可
4) 安装vmware tools后,需要重启网卡
   service network restart


  
3. 修改hosname
修改/etc/hosts里面的名字
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
yourip yourname //在这修改hostname
192.168.1.253 redhat

 

4.修改参数:设置时间同步
vim /boot/grub/grub.conf
------------------
 
default=0
timeout=0
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-8.el5)
 root (hd0,0)
 kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quietclock=pit nosmp noapic nolapic
 initrd /initrd-2.6.18-8.el5.img

 

5.修改启动参数,字符界面启动,启动3个用户:--- 可以不改
vi /etc/inittab

id:3:initdefault:

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6


6.安装依赖的包

#查询依赖包:
rpm -q xorg-x11-deprecated-libs xorg-x11-libs xorg-x11-xfs alsa-lib-devel fontconfig-devel freetype-devel libjpeg-devel libtiff-devel libungif-devel xorg-x11 xorg-x11-deprecated-libs-devel xorg-x11-devel audiofile-devel esound-devel libaio libaio-devel openmotif21 openmotif glib-devel gnome-libs-devel gtk+-devel imlib-devel ORBit-devel compat-libcwait compat-oracle-rhel4 binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver gdk-pixbuf setarch

rpm -q  xorg-x11-deprecated-libs xorg-x11-libs xorg-x11-xfs alsa-lib-devel \
fontconfig-devel freetype-devel libjpeg-devel libtiff-devel libungif-devel \
xorg-x11 xorg-x11-deprecated-libs-devel xorg-x11-devel audiofile-devel \
esound-devel libaio libaio-devel openmotif21 openmotif glib-devel \
gnome-libs-devel gtk+-devel imlib-devel ORBit-devel compat-libcwait \
compat-oracle-rhel4 binutils compat-db control-center gcc gcc-c++ glibc glibc-common \
gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver gdk-pixbuf setarch

#进入到RHEL的安装光盘的目录下 /media/cdrom/RedHat/RPMS 进行安装

rpm -ivh alsa-lib-devel-1.0.6-5.RHEL4.i386.rpm fontconfig-devel-2.2.3-13.el4.i386.rpm freetype-devel-2.1.9-8.el4.6.i386.rpm libjpeg-devel-6b-33.i386.rpm libtiff-devel-3.6.1-12.el4_7.2.i386.rpm libungif-devel-4.1.3-1.el4.2.i386.rpm xorg-x11-deprecated-libs-devel-6.8.2-1.EL.63.i386.rpm xorg-x11-devel-6.8.2-1.EL.63.i386.rpm audiofile-devel-0.2.6-1.el4.1.i386.rpm esound-devel-0.2.35-2.i386.rpm libaio-devel-0.3.105-2.i386.rpm glib-devel-1.2.10-15.i386.rpm gnome-libs-devel-1.4.1.2.90-44.1.i386.rpm gtk+-devel-1.2.10-36.i386.rpm imlib-devel-1.9.13-23.i386.rpm ORBit-devel-0.5.17-14.i386.rpm sysstat-5.0.5-25.el4.i386.rpm

7.安装另外两个需要额外下载的包:
下载地址: http://oss.oracle.com/projects/compat-oracle/files/RedHat/
compat-libcwait-2.1-1.i386.rpm
compat-oracle-rhel4-1.0-5.i386.rpm

xftp上传到Linux上:
chmod +x *
[root@oracle10g software]# rpm -ivh compat-*
[root@oracle10g software]# rpm -q compat-libcwait compat-oracle-rhel4


8.安装sqlplus辅助工具:(解决sqlplus上翻出现乱码的问题)
http://utopia.knoware.nl/~hlub/uck/rlwrap/

$chmod -R 777 rlwrap-0.37
$./configure
$make
$make check
$make install

 

第 2 部分:针对 Oracle 配置 Linux

 

1.创建 Oracle 组和用户帐户

以 root 用户身份执行以下命令:

$ groupadd oinstall
$ groupadd dba

$ mkdir -p /u01/app/oracle/product/10.2.0/db_1

$ useradd -g oinstall -G dba -d /u01/app/oracle oracle

##说明:
#man useradd
       -g initial_group
              The group name or number of the user?. initial login group.  The group  name
              must  exist.   A  group number must refer to an already existing group.  The
              default group number is 1 or whatever is specified in  /etc/default/useradd.

       -G group,[...]
              A  list  of  supplementary  groups which the user is also a member of.  Each
              group is separated from the next by a comma, with no intervening whitespace.
              The  groups are subject to the same restrictions as the group given with the
              -g option.  The default is for the user to belong only to the initial group.
             
$ id oracle  #查看oracle 用户信息:uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
$ passwd oracle ##设置 oracle 帐户的口令:

$ chown -R oracle:oinstall /u01
   #oracle:oinstall --- oracle--改变目录的所有者为oracle用户,oinstall---改变目录的所属组为oinstall
$ chmod -R 775 /u01
查看:
[root@oracle10g ~]# ls -l /u01
drwxr-xr-x  3 oracle oinstall 4096 Aug 25 13:27


###########################

2.创建目录  --- 命令已经在上一步执行。

###########################


3.配置 Linux 内核参数 ([root@oracle10g ~]# find /etc -name 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
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144


使内核参数生效:
# /sbin/sysctl -p

以 root 用户身份运行以下命令来验证您的设置:

/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range


######################################################
 
 
 4.为 oracle 用户设置 Shell 限制
 
 $vi /etc/security/limits.conf
 #添加如下内容:
oracle               soft    nproc   2047
oracle               hard    nproc   16384
oracle               soft    nofile  1024
oracle               hard    nofile  65536

$vi /etc/pam.d/login
session    required     /lib/security/pam_limits.so
session    required     pam_limits.s

 

5.配置oracle的环境变量:

$su oracle
$cd
$ls -al
$vi /u01/oracle/.bash_profile

export PATH
unset USERNAME

export EDITOR=vi
export ORACLE_SID=ora10g
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH

alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"

#export ORACLE_BASE ORACLE_HOME ORACLE_SID  PATH

if [ \$USER = "oracle" ]; then 
 if [ \$SHELL = "/bin/ksh" ]; then
  ulimit -p 16384
  ulimit -n 65536
 else
  ulimit -u 16384 -n 65536
 fi
  umask 022
fi


$source .bash_profile    #立即生效
$env                     #查看环境变量


6. 准备oracle安装文件
$su root
上传oracle安装文件,解压缩
$unzip  o.zip -d ./
$chown -R oracle:oinstall database
$mv database /u01/app/oracle/
#移动安装文件到 oracle目录下

7. 准备Xmanager
安装Open Xmanage
打开 Xstart
输入
Session name: myOracle
Host: yourip
protocol: SSH
User Name: oracle
Password : ***
Execution Command: 选择:xterm (Linux)

然后点击save、 run,连接并登陆。

8. 开始安装oracle
连接成功后,进入oracle家目录
$ls
$cd database
$./runinstaller
然后出现熟悉的Oracle 图形安装界面,按照提示进行安装。
#安装过程中不创建数据库,在后面用dbca命令进行创建。


需要root用户执行的两个脚本:
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/10.2.0/db_1/root.sh

 

## 视频教程中的做法,可以不用。
#使用oracle用户进行安装:
#su oracle
#$export DISPLAY=local_host_ip:0.0 ;
#进入database安装目录下:
#$./runinstaller
#使用XManager进行图形界面安装

#####
The following J2EE Applications have been deployed and are accessible at the URLs listed below.

iSQL*Plus URL:
http://oracle10g:5560/isqlplus

iSQL*Plus DBA URL:
http://oracle10g:5560/isqlplus/dba
#####


9. #创建数据库
$dbca


10. # 创建一个 Listener
$netca

11. # 创建一个 service
$netmgr


12. #验证是否安装成功,sqlplus 连接:
$sqlplus
:/as sysdba
SQL> select * from dual ;
SQL> select sysdate from dual ;

 

 

 


 


TAG:

 

评分:0

我来说两句

Open Toolbar