1、环境准备 注意:当前Linux为CentOS-6.10-x86_64-bin-DVD1.iso
界面:使用图形界面
内存:4GB
硬盘:20GB
连接:SecureCRT,上传文件(rz命令)需要安装:yum -y install lrzsz
2、下载程序 32 位需要下载(需要登录账号):
http://download.oracle.com/otn/linux/oracle11g/R2/linux_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux_11gR2_database_2of2.zip
64 位需要下载(需要登录账号):
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip
3、解压程序
解压
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
注意:unzip可能会提示没有这个命令,那就需要我们安装一下了
yum -y install zip
yum -y install unzip
4、移动软件 1 2 [root@caochenlei ~]# mkdir -p /usr/local/oracle [root@caochenlei ~]# mv database/ /usr/local/oracle
5、域名映射 查看当前系统主机名:
1 2 [root@caochenlei ~]# hostname caochenlei
查看当前系统的IP地址:
1 [root@caochenlei ~]# ifconfig
修改系统的映射文件:
1 [root@caochenlei ~]# vi /etc/hosts
在末尾添加以下内容:
1 2 3 4 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.112.129 caochenlei
6、关闭selinux 1 [root@caochenlei ~]# vi /etc/selinux/config
设置SELINUX=disabled
临时关闭一下selinux:
1 [root@caochenlei ~]# setenforce 0
7、关闭防火墙 1 2 [root@caochenlei ~]# service iptables stop [root@caochenlei ~]# chkconfig iptables off
8、安装依赖包 1 [root@caochenlei ~]# yum install -y binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat unixODBC-devel pdksh java-1.8.0-openjdk*
9、添加新用户 1 2 3 4 [root@caochenlei ~]# groupadd oinstall [root@caochenlei ~]# groupadd dba [root@caochenlei ~]# useradd -g oinstall -G dba oracle [root@caochenlei ~]# passwd oracle
10、修改内核文件 1 [root@caochenlei ~]# vi /etc/sysctl.conf
在末尾添加以下内容:
1 2 3 4 5 6 7 8 9 10 11 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576
更新一下文件以生效:
1 [root@caochenlei ~]# sysctl -p
11、修改用户限制 1 [root@caochenlei ~]# vi /etc/security/limits.conf
在末尾添加以下内容:
1 2 3 4 oracle soft nproc 4096 oracle hard nproc 65536 oracle soft nofile 4096 oracle hard nofile 65536
修改完成后重启服务器:
1 [root@caochenlei ~]# reboot
12、创建安装目录 1 2 3 4 5 [root@caochenlei ~]# mkdir -p /data/oracle/product/11.2.0 [root@caochenlei ~]# mkdir -p /data/oracle/oradata [root@caochenlei ~]# mkdir -p /data/oracle/inventory [root@caochenlei ~]# chown -R oracle:oinstall /data/oracle [root@caochenlei ~]# chmod -R 775 /data/oracle
13、设置环境变量 切换到oracle用户下:
1 2 [root@caochenlei ~]# su - oracle [oracle@caochenlei ~]$ vi .bash_profile
在末尾添加以下内容:
1 2 3 4 5 ORACLE_BASE=/data/oracle ORACLE_HOME=$ORACLE_BASE/product/11.2.0 ORACLE_SID=orcl PATH=$PATH:$ORACLE_HOME/bin export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
更新一下文件以生效:
1 [oracle@caochenlei ~]$ source .bash_profile
14、安装应用程序 这一步需要在虚拟机里进行,因为会弹出窗体程序
1 2 [oracle@caochenlei response]$ cd /usr/local/oracle/database/ [oracle@caochenlei database]$ LANG=en_US ./runInstaller
用户安装截图:
然后提示要执行两个脚本,使用root执行,可以使用SecureCRT重新新建一个连接进行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 [root@caochenlei ~]# sh /data/oracle/inventory/orainstRoot.sh Changing permissions of /data/oracle/inventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /data/oracle/inventory to oinstall. The execution of the script is complete. [root@caochenlei ~]# sh /data/oracle/product/11.2.0/dbhome_1/root.sh Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /data/oracle/product/11.2.0/dbhome_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed. Finished product-specific root actions.
执行完成,点ok,安装成功