Redhat linux 5装oracl全过程
- 提问者网友:姑娘长的好罪过
- 2021-04-23 22:04
- 五星知识达人网友:千夜
- 2021-04-23 23:08
注意:本文中所描述的Linux系统命令,“#”代表root权限,“$”代表oracle权限。有特殊说明的除外。
1. 检查内核版本
# cat /proc/version
Linux 5.0 版本 2.6.18
2.检查需要的软件包
如果省略这步,在安装过程中会出现很多莫名其妙的错误,甚至不能安装。一般情况下会需要手动安装如下的软件包:
make-3.79.1
gcc-3.2.3-34
glibc-2.3.2-95.20
glibc-devel-2.3.2-95.20
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
openmotif21-2.1.30-8
setarch-1.3-1
libaio-0.3.96-3
libaio-devel-0.3.96-3
怎样检查是否安装了呢?
比如检查 make-3.79.1
# rpm –qa | grep make
Make-3.81-1.1
说明 make-3.79.1 已经安装,已经安装的包的版本可以高于所缺少的包,其它的依次检查。
没有安装的包,可以去安装文件的server目录下找到上传到Linux中,然后安装
# rpm –ivh *.rpm
3.修改Linux发行版本信息
由于Oracle 10g发行的时候,RedHat Enterprise Linux 5 没有发行,所以Oracle 10g并不支持RedHat Enterprise Linux 5 ,我们可以手动修改Linux 的发行标记 ,让Oracle 10g支持RedHat Enterprise Linux 5。
# vi /etc/redhat-release
将其中的内容Red Hat Enterprise Linux Server release 5 (Tikanga) 修改为Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
4.创建Oracle用户、组、安装目录
(1) 创建Oracle用户组
# groupadd oinstall
# groupadd dba
(2) 创建Oracle安装目录以及数据存放目录
# mkdir –p /u01/oracle
(3) 创建Oracle用户
# useradd -g oinstall -G dba –d /u01/oracle oracle
(4) 设置Oracle用户口令
# passwd oracle
(5) 修改目录权限
# chown -R oracle:oinstall /u01
5.修改系统内核参数
“
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
”
把引号中的内容添加到 /etc/sysctl.conf 中
# vi /etc/sysctl.conf
修改好内核参数后,执行如下命令使新的设置生效
# /sbin/sysctl -p
6.添加以下内容到 /etc/security/limits.conf
“
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
”
把引号中的内容添加到 /etc/security/limits.conf 中
# vi /etc/security/limits.conf
7.添加以下内容到 /etc/pam.d/login
“
session required /lib/security/pam_limits.so
session required pam_limits.so
”
把引号中的内容添加到 /etc/pam.d/login 中
# vi /etc/pam.d/login
8.添加以下内容到 /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
”
# vi /etc/profile
9.配置Linux主机
检查/etc/hosts文件中是否有localhost的记录(指向127.0.0.1即可),若没有的话,在后面配置Oracle监听的时候会出现一些问题,导致无法启动监听,在此手工添加此记录即可。
#vi /etc/hosts
10.配置oracle用户环境变量
# su – oracle
$ vi .bash_profile
增加如下内容:
“
ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/oracle
ORACLE_SID=snow
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
”
保存后使用如下命令,使设置生效:
$ source ~/.bash_profile
也可以退出当前的用户,再次登录生效。
$ exit
# su – oracle
11.解压缩安装文件
直接使用命令unzip 文件名即可
#unzip ****
解压缩完成后,设置oracle帐户可以操作安装文件所在的目录
# mv database/ /u01
# cd /u01
# chown –R oracle:oinstall database/
12. 用oracle帐户进入图形界面,打开终端,再进入安装文件所在目录,执行如下命令即可看到安装界面:
$ pwd
$ cd ..
$ cd database/
$ ./runInstaller
如果无法看到安装界面,请使用root帐户执行如下命令后再运行安装程序:
# export DISPLAY=:0.0
# xhost +
$ ./runInstaller
出现安装界面后,根据界面提示进行相关的设置,建议在安装过程中不要创建数据库,只安装数据库软件,监听和创建数据库等在软件安装完成后再进行相关的操作。
如果出现的界面,是显示的字符不全,并不是乱码,我们可以执行以下命令,就可以
$ export LANG=C
$ ./runInstaller
安装过程结束时,需要使用root权限执行两个脚本。新打开一终端,进入 root 执行脚本。
13. 安装完成后,将/etc/redhat-release文件中的内容修改回Red Hat Enterprise Linux Server release 5 (Tikanga)
14.创建监听以及创建数据库
(1) 创建监听程序
使用Oracle提供的NET CONFIGURATION ASSISTANT创建监听
$ netca
基本上就是一直Next就可以了,当然你也可以在这期间修改TNS的监听端口号
TNS监听创建完成后可以使用如下命令进行检查:
# netstat -atln 检查监听端口是否打开
$ lsnrctl status 检查TNS监听状态
(2) 创建数据库
确认监听已经成功启动后,即可执行Database Configure Assistant进行数据库的创建,执行命令如下:
$ dbca
在创建数据库的过程中,建议将数据库的字符集设置为Unicode UTF-8,防止出现乱码。一般情况下采用默认即可。
到此,oracle的安装已基本结束,下面的就是自动启动等等的配置了。以后有时间再加以整理。
- 1楼网友:时间的尘埃
- 2021-04-24 02:10
写的不错。也很详细。
- 2楼网友:忘川信使
- 2021-04-24 00:37
RHEL4 安装oracle 10g http://user.qzone.qq.com/115041811/infocenter?ptlang=2052
Solaris10 安装oracle 10g http://user.qzone.qq.com/115041811/infocenter?ptlang=2052
+------------------------------------------------------------+ + + + Red Hat Enterprise Linux AS 4.0 ---- Oracle 10g R2 Install + + + +------------------------------------------------------------+
MIN SWAP ==> 1GB MIN RAM ==> 512MB Oracle 10g ==> 2.5GB Oracledata ==> 1.2GB /tmp ==> 400MB
Total = 2.5 + 1.2 + 0.4 = 4.1GB
[root@localhost ~]# grep MemTotal /proc/meminfo MemTotal: 515504 kB [root@localhost ~]# grep SwapTotal /proc/meminfo SwapTotal: 1052248 kB [root@localhost ~]# df -h Filesystem 容量 已用 可用 已用% 挂载点 /dev/sda3 39G 5.9G 31G 17% / /dev/sda1 190M 8.8M 172M 5% /boot none 252M 0 252M 0% /dev/shm [root@localhost ~]# free total used free shared buffers cached Mem: 515504 205652 309852 0 12812 133384 -/+ buffers/cache: 59456 456048 Swap: 1052248 0 1052248
************************************************************************************ * [root@localhost ~]# mkdir -v /usr/local/tmpswap * mkdir: 已创建目录 ‘/usr/local/tmpswap’ * [root@localhost ~]# dd if=/dev/zero of=/usr/local/tmpswap/tmpswap bs=1024k count=100 * 读入了 100+0 个块 * 输出了 100+0 个块 * [root@localhost ~]# mkswap /usr/local/tmpswap/tmpswap * Setting up swapspace version 1, size = 104853 kB * [root@localhost ~]# swapon /usr/local/tmpswap/tmpswap * [root@localhost ~]# free * total used free shared buffers cached * Mem: 515504 310164 205340 0 13180 235832 * -/+ buffers/cache: 61152 454352 * Swap: 1154640 0 1154640 * [root@localhost ~]# swapoff /usr/local/tmpswap/tmpswap * [root@localhost ~]# free * total used free shared buffers cached * Mem: 515504 310100 205404 0 13200 235832 * -/+ buffers/cache: 61068 454436 * Swap: 1052248 0 1052248 ************************************************************************************
#groupadd oinstall #groupadd dba #useradd -m -g oinstall -G dba oracle #passwd oracle #mkdir -pv /usr/local/oracle #mkdir -pv /var/lib/oracledata #chown -R oracle:oinstall /usr/local/oracle /var/lib/oracledata #chmod -R 755 /usr/local/oracle /var/lib/oracledata
#cat >> /etc/sysctl.conf <<EOF > 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 > EOF #sysctl -p net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 kernel.sysrq = 0 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 -a | grep shm kernel.shmmni = 4096 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shm-use-bigpages = 0 #sysctl -a | grep sem kernel.sem = 250 32000 100 128 #sysctl -a | grep file-max fs.file-max = 65536 #sysctl -a | grep ip_local_port_range net.ipv4.ip_local_port_range = 1024 65000 #su - oracle $cat << EOF >> ~/.bash_profile > export ORACLE_BASE=/usr/local/oracle > export ORACLE_SID=orcl $cd Oracle10gR2 $./runInstaller $cat << EOF >> ~/.bash_profile > export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1 > export PATH=$PATH:$ORACLE_HOME/bin $ lsnrctl start $ dbstart $ emctl start dbconsole $ isqlplusctl start
测试: iSQL*Plus URL: http://172.16.1.126:5560/isqlplus iSQL*Plus DBA URL: http://172.16.1.126:5560/isqlplus/dba Enterprise Manager 10g Database Control URL: http://172.16.1.126:1158/em
参考资料: Oracle & PHP Installfest guide - Oracle 10gR2 on RHEL4 - OTN Night 2005 ----------------------------------------------------------------------- Installing Oracle 10g (10.2.0.1) on RHEL4
*** This guide is for test purposes only - not production ***
Boot from RHEL4 disc1 press enter for graphical install ** Need at least 512MB RAM / 2.5GB Space ** + Automaticaly or Manually partition your hard drive with Disk Druid /tmp = 512MB ext3 fixed size /boot = 128MB ext3 fixed size swap = 1024MB fixed size / = fill to maximum allowable size
+ Accept defaults for GRUB boot loader, and configure networking.
+ Most Linux distros and RHEL4 ship with default security preferences locked down. For testing purposes I typically turn off the firewall and disable SE Linux.
+ Set language preferences and root password
+ Select 'Customize software to be installed' - make sure the packages essential for installing Oracle are selected. Desktop : X Window System; Gnome or KDE Editors : at least one editor - vi etc. Graphical Internet : a web browser - firefox Development : Development Tools, and Compat Legacy Languages
For post-install configuration login as root -------------------------------------------- + create groups /usr/sbin/groupadd oinstall /usr/sbin/groupadd dba /usr/sbin/groupadd oper
+ create OS user oracle with group permissions and home /opt/oracle /usr/sbin/useradd -g oinstall -G dba,oper -d /opt/oracle oracle
+ set user oracle's password /usr/bin/passwd oracle
+ Append user oracle's bash profile with PATH and ORACLE:BASE,HOME and SID information vi /opt/oracle/.bash_profile
umask 022 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
ORACLE_BASE=/opt/oracle ORACLE_HOME=$ORACLE_BASE/product/10gR2 ORACLE_SID=orcl PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH ORACLE_BASE ORACLE_HOME ORACLE_SID
+ Create the directory for the software installation and assign ownership to oracle:oinstall chown -R oracle:oinstall /opt chmod -R 775 /opt
+ Make sure the correct kernel parmeters are appended to sysctl.conf vi /etc/sysctl.conf (these can be easily copied from the Quick Installation Guide for Linux x86 doc on the Oracle10g CD) kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.core.rmem_default = 262144 net.core.rmem_max = 262144 net.core.wmem_default = 262144 net.core.wmem_max = 262144 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000
+ set the kernel parameters or reboot /sbin/sysctl -p
Login in to xwindows session as user oracle ------------------------------------------- + Mount the Oracle10g CD and run the installer mount /media/cdrom (cd $HOME && /media/cdrom/runInstaller) - follow the installer instructions - use password mgmt to unlock DBuser scott & set password 'tiger' + open http://localhost.localdomain:1158/em in a browser or As root # vi /etc/oratab change :N to :Y # cp /etc/oratab /var/opt/oracle/oratab + This enables the oracle user to dbshut, dbstart and lsnrctl start