CentOS无图形界面静默安装Oracle

限于喜欢 提交于 2019-11-27 03:27:35

一、安装包下载

  Oracle下载地址:http://www.oracle.com/technetwork/indexes/downloads/index.html#database

  下载需要Oracle账户,可自行注册,我在注册遇到个问题,注册成功了但一直提示登录失败,重置密码也不行,等到了第二天突然又可以登录了。

二、安装前准备

1.配置主机名

[root@localhost]# vi /etc/redhat-release 
[root@localhost]# cat /etc/redhat-release
redhat-7

2.创建用户

[root@localhost]# groupadd oinstall  #创建用户组oinstall
[root@localhost]# groupadd dba  #创建用户组dba
[root@localhost]# useradd -g oinstall -g dba -m oracle  #创建oracle用户,并加入到oinstall和dba用户组
[root@localhost]# passwd oracle  #设置用户oracle的登陆密码
Changing password for user oracle.
New password:   # 设置密码
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:   # 确认密码
passwd: all authentication tokens updated successfully.
[root@localhost]# id oracle # 查看新建的oracle用户
uid=1001(oracle) gid=1002(dba) groups=1002(dba)

3.安装依赖

[root@localhost]# yum -y install binutils* compat-libcap1* compat-libstdc++* gcc* gcc-c++* glibc* glibc-devel* ksh* libaio* libaio-devel* libgcc* libstdc++* libstdc++-devel* libXi* libXtst* make* sysstat* elfutils* unixODBC*

4.关闭firewalld、selinux(粗体为修改内容)

[root@localhost]# systemctl status firewalld.service   #查看防火墙状态
[root@localhost]# systemctl stop firewalld.service     #关闭防火墙
[root@localhost]# systemctl disable firewalld.service  #禁止使用防火墙(重启也是禁止的)
[root@localhost]# vi /etc/selinux/config               #关闭selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

5.配置内核参数(粗体为修改内容)

[root@local++host]# vi /etc/sysctl.conf

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744 #设置最大打开文件数
fs.aio-max-nr = 1048576
kernel.shmall = 2097152 #共享内存的总量,8G内存设置:2097152*4k/1024/1024
kernel.shmmax = 2147483648 #最大共享内存的段大小
kernel.shmmni = 4096 #整个系统共享内存端的最大数
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4端口范围
net.core.rmem_default = 262144
net.core.rmem_max= 4194304
net.core.wmem_default= 262144
net.core.wmem_max= 1048576

6.修改用户限制(粗体为修改内容)

[root@localhost]# vi /etc/security/limits.conf
@student - maxlogins 4
 
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
 

7.配置用户的环境变量(粗体为修改内容)

[root@localhost]# vi /home/oracle/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export ORACLE_BASE=/data/oracle #oracle数据库安装目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle数据库路径
export ORACLE_SID=orcl #oracle启动数据库实例名
export ORACLE_UNQNAME=orcl
export ORACLE_TERM=xterm #xterm窗口模式安装
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #添加系统环境变量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #添加系统环境变量
export LANG=C #防止安装过程出现乱码
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #设置Oracle客户端字符集,必须与Oracle安装时设置的字符集保持一致

8.创建目录

[root@localhost]# mkdir -p /data/oracle
[root@localhost]# mkdir -p /data/oraInventory
[root@localhost]# mkdir -p /data/oracle/product/11.2.0/db_1
[root@localhost]# mkdir -p /data/oracle/backup
[root@localhost]# chown -R oracle:oinstall /data/oracle
[root@localhost]# chown -R oracle:oinstall /data/oraInventory

三、安装ORACLE

1.安装解压工具

[root@localhost]# yum install -y unzip zip

2.解压安装包

  把解压后的包放在了/home/oracle/目录下

[root@localhost]# unzip linux.x64_11gR2_database_1of2.zip  -d /data/oracle[root@localhost]# unzip linux.x64_11gR2_database_2of2.zip  -d /data/oracle

3.切换用户

[root@localhost]# su oracle

 未完待续...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!