free -m
cat /proc/cpuinfo
检查操作系统版本
cat /etc/os-release
hosts文件配置
echo "192.168.2.53 hisdb" >> /etc/hosts
配置语言环境变量
echo "export.UTF8" >> ~/.bash_profile
source ~/.bash_profile
准备文件系统
检查磁盘信息
fdisk -l
磁盘分区
fdisk /dev/sdb #n p 1 两个回车 w
格式化磁盘
mkfs.xfs /dev/sdb1
挂载到oracle目录
mkdir /oracle
mount /dev/sdb1 /oracle
设置开机自启动
echo "/dev/sdb1 /oracle xfs defaults 0 0" >> /etc/fstab
设置共享内存段
echo "none /dev/shm tmpfs defaults,size=12288m 0 0" >> /etc/fstab #默认情况下是内存的一半,根据实际情况设置
mount -o remount /dev/shm #重新挂载共享内存
df -h #查看挂载情况
创建用户,组,目录
新建用户组
/usr/sbin/groupadd -g 60001 oinstall
/usr/sbin/groupadd -g 60002 dba
/usr/sbin/groupadd -g 60003 oper
/usr/sbin/groupadd -g 60004 backupdba
/usr/sbin/groupadd -g 60005 dgdba
/usr/sbin/groupadd -g 60006 kmdba
/usr/sbin/groupadd -g 60007 asmdba
/usr/sbin/groupadd -g 60008 asmoper
/usr/sbin/groupadd -g 60009 asmadmin
新建用户
useradd -u 61001 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,oper oracle
useradd -u 61002 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
修改用户密码
passwd grid
passwd oracle
新建目录
mkdir -p /oracle/app/oracle
chown -R oracle:oinstall /oracle/app/oracle
mkdir -p /oracle/app/oraInventory
chown -R grid:oinstall /oracle/app/oraInventory
chmod -R 775 /oracle
配置yum软件安装环境及软件包安装
mount /dev/cdrom /mnt
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/
echo "[EL]">> /etc/yum.repos.d/itpux.repo
echo "name=Linux 7.9DVD">> /etc/yum.repos.d/itpux.repo
echo "baseurl=file:///mnt">> /etc/yum.repos.d/itpux.repo
echo "gpgcheck=0">> /etc/yum.repos.d/itpux.repo
echo "enabled=1">> /etc/yum.repos.d/itpux.repo
yum -y install autoconf
yum -y install automake
yum -y install binutils-devel
yum -y install bison
yum -y install cpp
yum -y install dos2unix
yum -y install ftp
yum -y install gcc
yum -y install gcc-c++
yum -y install python-devel
yum -y install compat-db*
yum -y install compat-gcc-44
yum -y install compat-gcc-44-c++
yum -y install compat-libcap1
yum -y install compat-libstdc++-33
yum -y install compat-libstdc++-33.i686
yum -y install glibc-*
yum -y install glibc-*.i686
yum -y install libXpm-*.i686
yum -y install libXp.so.6
yum -y install libXtst.so.6
yum -y install libstdc++-docs
yum -y install libstdc++.i686
yum -y install libstdc++-devel.i686
yum -y install libaio.i686
yum -y install libaio-devel
yum -y install libaio-devel.i686
yum -y install ksh
yum -y install libXp
yum -y install numactl
yum -y install numactl-devel
yum -y install unixODBC
yum -y install unixODBC-devel
yum -y install elfutils-libelf-devel
yum -y install redhat-lsb-core
修改系统相关参数
修改资源限制参数
#以下设置根据机器内存情况配置
echo "#ORACLE SETTING">> /etc/security/limits.conf
echo "grid soft nproc 16384">> /etc/security/limits.conf
echo "grid hard nproc 16384">> /etc/security/limits.conf
echo "grid soft nofile 65536">> /etc/security/limits.conf
echo "grid hard nofile 65536">> /etc/security/limits.conf
echo "grid soft stack 32768">> /etc/security/limits.conf
echo "grid hard stack 32768">> /etc/security/limits.conf
echo "oracle soft nproc 16384">> /etc/security/limits.conf
echo "oracle hard nproc 16384">> /etc/security/limits.conf
echo "oracle soft nofile 65536">> /etc/security/limits.conf
echo "oracle hard nofile 65536">> /etc/security/limits.conf
echo "oracle soft stack 32768">> /etc/security/limits.conf
echo "oracle hard stack 32768">> /etc/security/limits.conf
echo "oracle hard memlock 15000000">> /etc/security/limits.conf #小于物理内存
echo "oracle soft memlock 15000000">> /etc/security/limits.conf #小于物理内存
vi /etc/security/limits.d/20-nproc.conf #把最后两行注释掉,增加* soft nproc 16384
echo "* soft nproc 16384">> /etc/security/limits.d/20-nproc.conf
控制用户分配的资源
echo "session required pam_limits.so" >> /etc/pam.d/login
修改内核参数
#以下设置根据机器内存情况配置参数
echo "#ORACLE SETTING" >> /etc/sysctl.conf
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
echo "kernel.panic_on_oops = 1" >> /etc/sysctl.conf
echo "kernel.shmmax = 10995116278" >> /etc/sysctl.conf
echo "kernel.shmall = 2684354" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "vm.nr_hugepages = 5120" >> /etc/sysctl.conf
sysctl -p #强制生效
关闭透明页面
#cat /sys/kernel/mm/transparent_hugepage/defrag
#[always] madvise never
#cat /sys/kernel/mm/transparent_hugepage/enabled
#[always] madvise never
echo "if test -f /sys/kernel/mm/transparent_hugepage/enabled; then" >> /etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
echo "if test -f /sys/kernel/mm/transparent_hugepage/defrag; then" >> /etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.d/rc.local
echo "fi" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local #强制生效
#执行以下命令,确认cat /sys/kernel/mm/transparent_hugepage/defrag时结果为#always madvise [never]
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
关闭numa功能
vi /etc/default/grub #倒数第二行增加numa=off参数
GRUB_CMDLINE_LINUX="rhgb quiet numa=off"
grub2-mkconfig -o /etc/grub2.cfg #重新编译生效
图形界面启动级别从5改至3
systemctl set-default multi-user.target
配置安全
vi /etc/selinux/config
SELINUX=disabled #修改第6行SELINUX参数为disabled
setenforce 0 #强制生效
systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #开机不启动
systemctl status firewalld.service #查看状态
重启操作系统
reboot