目录
环境
- 系统
- RHEL6
- 软件
- Oracle 10g
- VMWare 12
- JDK 1.8
RHEL6 Configuration
Step1:Setup hostname & Close the selinux
[root@jmilkfan Desktop]# hostname
jmilk.fan.com
vim /etc/sysconfig/selinux
SELINUX=permissive
立即生效关闭防火墙
[root@jmilk ~]# setenforce 0
Step2:Setup Static IP
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:F2:C6:8D"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="f129f448-7aa6-43bd-bf68-699774b0a553"
IPADDR=192.168.1.222
NETMASK=255.255.255.0
Re-start network service
Step3:Edit /etc/hosts
vim /etc/hosts
192.168.1.222 jmilk.fan.com
Step4:创建用户和用户组
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
useradd -g oinstall -G dba oracle
(echo fanguiju;echo fanguiju) | passwd --stdin oracle
Step5:创建安装路径目录
[root@jmilk Desktop]# mkdir -p /u01/app/oracle
[root@jmilk Desktop]# chown -R oracle:oinstall /u01/app/oracle
[root@jmilk Desktop]# chmod -R 775 /u01/app/oracle
[root@jmilk Desktop]# ll -d /u01/app/oracle/
drwxrwxr-x. 2 oracle oinstall 4096 May 24 22:22 /u01/app/oracle/
Step6:配置内核参数
vim /etc/sysctl.conf
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 2147483648
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
刷新配置
sysctl -p
Step7:修改limits.conf配置文件
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Step8:修改login配置文件
vim /etc/pam.d/login
#Use for Oracle
session required pam_limits.so
Step9:配置Oracle用户环境变量
[root@jmilk Desktop]# su - oracle
vim .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_SID=gsp
export ORACLE_BASE=/u01/app/oracle #ORACLE_BASE是最重要的,代表Oracle的安装路径
export ORACLE_HOME=$ORACLE_BASE/product/dbhome_1
export ORACLE_OWNER=oracle
export PATH=$ORACLE_HOME/bin:$PATH
umask 022
刷新用户环境变量
source .bash_profile
DISPLAY=local_host:0.0 ; export DISPLAY
Step10:修改/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
Update JDK
卸载OpenJDK并更新JDK,下载JDK1.8 点这里
Step1:rpm安装JDK1.8
[root@jmilk Desktop]# rpm -qa |grep java
tzdata-java-2012j-1.el6.noarch
java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64
java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64
[root@jmilk Desktop]# rpm -e --nodeps tzdata-java-2012j-1.el6.noarch
[root@jmilk Desktop]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64
[root@jmilk Desktop]# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64
[root@jmilk Desktop]# cd /opt/jdk1.8/
[root@jmilk jdk1.8]# ls
jdk-8u91-linux-x64.rpm
[root@jmilk jdk1.8]# rpm -ivh jdk-8u91-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk1.8.0_91 ########################################### [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
jfxrt.jar...
[root@jmilk jdk1.8]# java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
配置JDK环境变量
vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_91
JRE_HOME=/usr/java/jdk1.8.0_91/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
加载配置
source /etc/profile
alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_91/bin/java 1
alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_91/bin/javac 1
alternatives --config java
alternatives --config javac
配置Oracle安装环境
硬件检测
官方安装文档对硬件额要求:
#At least 512 MB of physical RAM
内存要大于512M
#The following table describes the relationship between installed RAM and the configured swap space requirement.
内存和Swap分区的大小要求
RAM | Swap Space |
---|---|
Up to 512 MB | 2 times the size of RAM |
Between 1024 MB and 2048 MB | 1.5 times the size of RAM |
Between 2049 MB and 8192 MB | Equal to the size of RAM |
More than 8192 MB | 0.75 times the size of RAM |
#400 MB of disk space in the /tmp directory
必须被/tmp
目录留下400MB
#Between 1.5 GB and 3.5 GB of disk space for the Oracle software, depending on the installation type
需要预留1.5G到3.5G的磁盘空间
#1.2 GB of disk space for a preconfigured database that uses file system storage
Step1:查看内存大小
[root@jmilk Desktop]# grep MemTotal /proc/meminfo
MemTotal: 8046852 kB
Step2:查看Swap空间大小
[root@jmilk Desktop]# grep SwapTotal /proc/meminfo
SwapTotal: 4194296 kB
Step3:查看/tmp
分区的大小
[root@jmilk Desktop]# df -m /tmp
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/sda3 36088 5907 28349 18% /
软件检测
因为在安装Oracle的过程中,要重新编译安装许多内置软件程序。所以Oracle的安装环境需要软件依赖包的支撑,Oracle官方安装文档提供了需要预安装的软件包列表:
- Red Hat Enterprise Linux 4.0:
- binutils-2.15.92.0.2-10.EL4
- compat-db-4.1.25-9
- control-center-2.8.0-12
- gcc-3.4.3-9.EL4
- gcc-c++-3.4.3-9.EL4
- glibc-2.3.4-2
- glibc-common-2.3.4-2
- gnome-libs-1.4.1.2.90-44.1
- libstdc++-3.4.3-9.EL4
- libstdc++-devel-3.4.3-9.EL4
- make-3.80-5
- pdksh-5.2.14-30
- sysstat-5.0.5-1
- xscreensaver-4.18-5.rhel4.2
注意:因为Oracle 10g官方推荐在RHEL4上安装,所以提供的软件包列表版本会偏低。我们在RHEL6中安装Oracle时,无论是检测还是安装的过程中都需要忽略软件包的版本问题。
rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel
Step1:配置光盘YUM源
vim /etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///media
enabled=1
gpgcheck=0
Step2:安装依赖软件包
yum install -y gcc-*
yum install -y binutils-*
yum install -y openmotif-*
yum install -y compat-db-*
yum install -y compat-gcc-*
yum install -y compat-gcc-c++-*
yum install -y setarch*
yum install -y compat-libstdc++*
yum install -y compat-libstdc++-devel*
yum install -y compat-libstdc++-33
yum install -y glibc*
yum install -y libstdc++*
yum install -y make*
yum install libXt.i686
yum install libXtst.i686
yum install binutils-2.* compat-libstdc++-33* elfutils-libelf-0.* elfutils-libelf-devel-* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* ksh-2* libaio-0.* libaio-devel-0.* libgcc-4.* libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.* unixODBC-devel-2.* pdksh*
yum install -y compat-gcc* compat-glibc* compat-libstd*
rpm -ivh --force libXp-1.0.0-15.1.el6.x86_64.rpm #需要到Package目录下强制安装
编辑配置文件
Step1:配置系统版本
注意:因为Oracle默认只支持到RHEL4,所以我们需要修改系统版本来欺骗Oracle安装程序。
vim /etc/redhat-release
Red Hat Enterprise Linux Server release 4.0 (Santiago)
安装Oracle Database
Step1:解压Oracle Database安装软件
mkdir /mnt/hgfs/DataBase/
cd /mnt/hgfs/DataBase/
gunzip 10201_database_linux_x86_64.cpio.gz
cpio -idmv < 10201_database_linux_x86_64.cpio
Step2:重启并使用oracle用户账号登陆
注意:不能使用su - oracle
Step3:执行安装脚本
[oracle@jmilk Desktop]$ cd /mnt/hgfs/Database/database/
[oracle@jmilk database]$ ./runInstaller
注意:安装过程中如果报“ORA-27125:unable to create shared memory segment”这个错误,一般原因是操作系统用户权限不足的问题,可以通过下面的方式来解决
id oracle
echo vm.hugetlb_shm_group=501 > /etc/sysctl.conf
sysctl -p
输入Oracle最高级管理员orcl的密码
忽略这个错误,点击Continue
完成安装