http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip?AuthParam=1479527366_c5c6af19e54f7eed218aafe6914b194e (下载地址)
安装时内存不要低于2G
1. 使用root用户登录操作系统 2. yum 安装 unzip 软件,用来解压上传的Oracle安装文件。 [iyunv@CentOS ~]# yum install unzip –y
3. 解压Oracle 安装程序 [iyunv@CentOS ~]# cd /tmp
[iyunv@CentOS tmp]# unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip
(这里有俩个包,1跟2都要下载)
4. Yum 安装vim软件,用于编辑配置文件(个人习惯,不安装vim,使用vi也可以)。 [iyunv@CentOS tmp]# yum install vim -y
5. 在/etc/hosts文件中添加主机名 [iyunv@CentOS tmp]# vim /etc/hosts
添加192.168.206.135 CentOS
6. 关闭selinux [iyunv@CentOS tmp]# vim /etc/selinux/config
设置SELINUX=disabled
[iyunv@CentOS tmp]# setenforce 0
7. 关闭防火墙 [iyunv@CentOS tmp]# service iptables stop
8. 安装Oracle 11g依赖包 [iyunv@CentOS tmp]# yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl sysstat libXp unixODBC unixODBC-devel -y
9. 添加安装用户和用户组
[iyunv@CentOS tmp]# groupadd oinstall
[iyunv@CentOS tmp]# groupadd dba
[iyunv@CentOS tmp]# useradd -g oinstall -G dba oracle
[iyunv@CentOS tmp]# passwd oracle
[iyunv@CentOS tmp]# id oracle
uid=1001(oracle) gid=1001(oinstall) 组=1001(oinstall),1002(dba)
10. 修改内核参数配置文件 [iyunv@CentOS ~]# vim /etc/sysctl.conf
添加以下内容
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
kernel.shmall = 2097152
kernel.shmmax = 1073741824
[iyunv@CentOS ~]# sysctl -p
其中kernel.shmmax = 1073741824为本机物理内存(2G)的一半,单位为byte。
这里会有个错误:
11. 修改用户的限制文件
[iyunv@CentOS ~]# vim /etc/security/limits.conf
添加以下内容
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
修改/etc/pam.d/login文件:
[iyunv@CentOS ~]# vim /etc/pam.d/login
添加以下内容:
session required /lib64/security/pam_limits.so
session required pam_limits.so
修改/etc/profile文件:
[iyunv@CentOS ~]# vim /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
12. 创建安装目录和设置文件权限
[iyunv@CentOS ~]# mkdir -p /u01/app/oracle/product/11.2.0
[iyunv@CentOS ~]# mkdir /u01/app/oracle/oradata
[iyunv@CentOS ~]# mkdir /u01/app/oracle/inventory
[iyunv@CentOS ~]# mkdir /u01/app/oracle/flash_recovery_area
[iyunv@CentOS ~]# chown -R oracle:oinstall /u01/app/oracle
[iyunv@CentOS ~]# chmod -R 775 /u01/app/oracle
13. 设置oracle用户环境变量
[iyunv@CentOS ~]# su - oracle
[oracle@CentOS ~]$ vim .bash_profile
添加如下内容:
ORACLE_BASE=/u01/app/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
[iyunv@oracle11g ~]# xhost + access control disabled, clients can connect from any host [iyunv@oracle11g ~]# su - oracle [oracle@oracle11g ~]$ unzip linux.x64_11gR2_database_1of2.zip [oracle@oracle11g ~]$ unzip linux.x64_11gR2_database_2of2.zip [oracle@oracle11g ~]$ cd database/
[oracle@oracle11g database]$ ./runInstaller 这里要在图形化界面安装 下运行./runlnstaller,不然会出错,
注意,这里./runInstaller会出现错误,需要安装yum groupinstall "KDE Desktop" 然后在图形界下重启服务器,就可以了
|