第1章CentOS 7.1静默安装11.2.0.3 64位单机数据库软件
1.1 安装前的准备工作
1.1.1 软件准备
1.1.2 检查硬件
注意这里的内存应该满足要求,不然可能引起数据库在安装过程中长时间的挂起等待。。。。
在正式安装开始前,请先检查你的软硬件条件是否满足安装需要。
硬件上可以使用命令查看内存情况和cpu特性:
more /proc/meminfo
more /proc/cpuinfo
其中内存的要求是不低于1G
下面的不是必须的,可选使用
#df–k /dev/shm检查共享内存
k /tmp检查临时磁盘空间
#more /proc/version检查操作系统版本
#unamer检查内核版本
内存:
交换空间
磁盘空间
# free
#free -m
1.1.3 修改hosts文件、修改主机名
永久生效:
或修改文件/etc/hostname:
COSLHR
临时生效:
查看/etc/hosts文件中必须包含a fully qualified name for the server,必须包含127.0.0.1和真实的IP地址这2行:
# Do not remove the following line,or varIoUs programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.59.155 COSLHR
注意将主机名对应到真实地址,否则Oracle有可能将监听程序仅仅建立在上。
注意:修改主机名后,需要重启系统后生效。
1.1.3.1 配置固定IP
IPADDR=192.168.59.51
NETMASK=255.255.255.0
NETWORK=192.168.59.0
broADCAST=192.168.59.255
GATEWAY=192.168.59.2
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
#HWADDR=00:0c:29:97:f1:5b
TYPE=Ethernet
IPV6INIT=no
DNS1=202.96.209.5
DNS2=8.8.8.8
NAME="ens33"
1.1.4 安装软件包检查
http://blog.itpub.net/26736162/viewspace-2133603/
可以统一检查:
binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
expat \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
pdksh \
sysstat \
unixODBC \
unixODBC-devel | grep "not installed"
如果部分包不存在,可以批量更新安装,但如果依赖关系缺失,可能需要多执行两遍或者手工调整,所以建议使用yum进行安装:
package elfutils-libelf-devel is not installed
package gcc-c++ is not installed
package libaio-devel is not installed
package libstdc++-devel is not installed
package pdksh is not installed
package unixODBC is not installed
package unixODBC-devel is not installed
依次安装如下的包:
yum install -y elfutils-libelf-devel
yum install -y gcc-c++
yum install -y libaio-devel
yum install -y libstdc++-devel
yum install -y pdksh
yum install -y unixODBC
yum install -y unixODBC-devel
安装完成后再次检查是否还有没有安装的包。
注意:其中的pdksh包可以忽略。
1.1.5 内核参数--shell限制
1.1.5.1 /etc/security/limits.conf
设置Shell Limits
在/etc/security/limits.conf文件中加入下列行:
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
为安装用户设置资源限制
要改善Linux系统上的软件性能,必须对软件所有者用户(grid、oracle)增加以下资源限制:
Shell限制 limits.conf中的条目 硬限制
打开文件描述符的最大数 nofile 65536
可用于单个用户的最大进程数 nproc 16384
进程堆栈段的最大大小 stack 10240
1.1.5.2 /etc/pam.d/login
/etc/pam.d/login文件中加入下列行,如果里面没有的话:
session required pam_limits.so
1.1.5.3 /etc/profile
对默认的shell启动文件进行以下更改,以便更改所有安装所有者的ulimit设置:
在/etc/profile后加入以下语句:
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 16384
else
ulimit -u 16384 -n 16384
fi
fi
1.1.5.4 /etc/sysctl.conf
Configuring Kernel Parameters for Linux
vim /etc/sysctl.conf
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
生效
参数的含义:http://blog.itpub.net/26736162/viewspace-2147273/
1.1.6 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
[root@localhost /]# systemctl status firewalld.service
●firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active:active (running)since Thu 2016-04-07 18:54:29 PDT; 2h 20min ago
Main PID: 802 (firewalld)
CGroup: /system.slice/firewalld.service
└─802 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Apr 07 18:54:25 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 07 18:54:29 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
[root@localhost /]# systemctl stop firewalld.service #关闭防火墙
[root@localhost /]# systemctl status firewalld.service再次查看防火墙状态,发现已关闭
inactive (dead)since Thu 2016-04-07 21:15:34 PDT; 9s ago
Main PID: 802 (code=exited,status=0/SUCCESS)
Apr 07 21:15:33 localhost systemd[1]: Stopping firewalld - dynamic firewall daemon...
Apr 07 21:15:34 localhost systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@localhost /]# systemctl disable firewalld.service禁止使用防火墙(重启也是禁止的)
Removed symlink /etc/systemd/system/dbus-org.Fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost /]#
1.1.7 禁用selinux
修改/etc/selinux/config
编辑文本中的SELINUX=enforcing为SELINUX=disabled
[root@OCPLHR ~]# more /etc/selinux/config
# 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 - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
[root@OCPLHR ~]# /usr/sbin/sestatus -v
SELinux status: disabled
[root@OCPLHR ~]# getenforce
disabled
临时关闭(不用重启机器):setenforce 0
SELinux状态:
1/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
SELinux status: enabled
getenforce ##也可以用这个命令检查
1.2 新建用户和组
The Oracle Inventory group (oinstall)数据库安装组
The OSDBA group (dba)数据库管理员组
The Oracle software owner (oracle)管理员用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -m oracle
passwd oracle