51CTO多哥OCP—Oracle安装(一)

2022/1/8 19:06:40

本文主要是介绍51CTO多哥OCP—Oracle安装(一),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

安装准备工作

本安装教程中仅供学习使用

环境准备

操作系统 Oracle版本 系统镜像
CentOS 7.4 Oracle12 CentOS-7-x86_64-DVD-1708.iso

系统配置准备

  1. 配置域名
[root@oracle12 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.37.129.4 oracle12
[root@oracle12 ~]# hostname
oracle12
  1. 关闭防火墙
[root@oracle12 ~]# service firewalld status               # 检查防火墙状态
[root@oracle12 ~]# service firewalld stop                 # 关闭防火墙 
Redirecting to /bin/systemctl stop firewalld.service
[root@oracle12 ~]# systemctl disable firewalld            # 关闭防火墙开机自启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  1. 关闭SeLinux
[root@oracle12 ~]# setenforce 0                         # 临时关闭SeLinux                  
[root@oracle12 ~]# vi /etc/sysconfig/selinux            # 永久关闭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
[root@oracle12 ~]# reboot                               # 永久配置生效需要重启
  1. 配置本地镜像Yum源,解决部分依赖问题
[root@oracle12 ~]# mkdir /media/cdrom                                # 创建ISO镜像挂载的目录,目录可自定
[root@oracle12 ~]# mount /dev/cdrom /media/cdrom                     # 挂载ISO镜像到/media/cdrom 
[root@oracle12 ~]$ df -HT                                            # 查看挂载情况,可以看到/dev/sr0已经挂载到/media/cdrom
文件系统                类型      容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root xfs        66G   17G   50G   25% /
devtmpfs                devtmpfs  1.1G     0  1.1G    0% /dev
tmpfs                   tmpfs     1.1G     0  1.1G    0% /dev/shm
tmpfs                   tmpfs     1.1G  9.0M  1.1G    1% /run
tmpfs                   tmpfs     1.1G     0  1.1G    0% /sys/fs/cgroup
/dev/sda1               xfs       1.1G  131M  933M   13% /boot
/dev/sr0                iso9660   4.6G  4.6G     0  100% /media/cdrom
tmpfs                   tmpfs     210M  8.2k  210M    1% /run/user/1000
[root@oracle12 ~]# cd /etc/yum.repos.d/                              # 进到repo目录
[root@oracle12 ~]# mkdir ./bak                                       # 创建备份目录
[root@oracle12 ~]# mv ./*.repo ./bak                                 # 将现有的文件全部存入bak目录(任何操作务必备份)
[root@oracle12 ~]# cp ./bak/CentOS-Media.repo ./                     # 将CentOS-Media.repo文件取出到/etc/yum.repos.d/ 目录下
[root@oracle12 ~]# vi CentOS-Media.repo                              # 配置本地镜像repo
# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c7-media [command]
#  
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c7-media [command]
[CentOS7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/cdrom/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@oracle12 ~]# yum clean all                                      # 清理yum
[root@oracle12 ~]# yum makecache                                      # 建立yum缓存
  1. 安装依赖环境,避免后续安装Oracle出现依赖缺失的问题
[root@oracle12 ~]# yum install -y deltarpm python-deltarpm createrepo
[root@oracle12 ~]# yum install -y bc 
[root@oracle12 ~]# compat-libcap1* compat-libcap* compat-libstdc++-33
[root@oracle12 ~]# yum install -y binutils
[root@oracle12 ~]# yum install -y glfuils-libelf glfuils-libelf-devel
[root@oracle12 ~]# yum install -y gcc gcc-c++
[root@oracle12 ~]# yum install -y glibc-2.5 glibc-common glibc-devel glibc-headers glibc-kernheaders
[root@oracle12 ~]# yum install -y ksh libaio libaio-devel
[root@oracle12 ~]# yum install -y libgcc* libstdc++*
[root@oracle12 ~]# yum install -y make* sysstat* libXp* net-tools-*
  1. 修改Linux内核,进行系统的调优,以适合Oracle在最佳的系统环境运行
[root@oracle12 ~]# vi /etc/sysctl.conf
	kernel.shmall = 4294967296                    -----公式:内存大小*1024*1024*1024/4*1024,表示所有内存大小(单位:页=4K)
	kernel.shmmax = 277495689510912               -----表示最大共享内存大小,一般为物理内存的3/4,但是常用的就是将所有内存换算成字节后-1(单位:字节)
	kernel.shmmni = 4096                          -----表示最小共享内存,固定4096K,一般固定值
	kernel.sem = 250 32000 100 128                -----4个参数如下:(四个参数为固定内容大小)
							          SEMMSL	每个用户拥有信号量最大数
								  SEMMNS	系统信号量最大数
								  SEMOPM	每次semopm系统调用操作数
								  SEMMNI	系统辛苦量集数最大数
	net.core.rmem_default = 262144                -----表示套接字接收缓冲区大小的缺省值
	net.core.rmem_max = 4194304                   -----表示套接字接收缓冲区大小的最大值
	net.core.wmem_default =262144                 -----表示套接字发送缓冲区大小的缺省值
	net.core.wmem_max = 1048586                   -----表示套接字发送缓冲区大小的最大值
	fs.file-max = 6815744                         ----文件句柄,一次可以打开的文件个数
	net.ipv4.tcp_max_tw_buckets = 6000
	net.ipv4.ip_local_port_range = 9000 65500     -----表示端口范围,为指定的内容,一般是固定值
	net.ipv4.tcp_tw_recycle = 0 
	net.ipv4.tcp_tw_reuse = 1
	net.core.netdev_max_backlog = 262144 
	net.ipv4.tcp_max_orphans = 262144
	net.ipv4.tcp_max_syn_backlog = 262144 
	net.ipv4.tcp_synack_retries = 2 
	net.ipv4.tcp_syn_retries = 1 
	net.ipv4.tcp_fin_timeout = 1
	net.ipv4.tcp_keepalive_time = 30 
	net.ipv4.tcp_keepalive_probes = 6 
	net.ipv4.tcp_keepalive_intvl = 5 
	net.ipv4.tcp_timestamps = 0 
	fs.aio-max-nr =1048576
	net.ipv4.conf.all.rp_filter = 2
	net.ipv4.conf.default.rp_filter = 2
  1. 修改limits.conf的限制:
[root@oracle12 ~]# vi /etc/security/limits.conf       # 在文件末尾追加如下配置
	oracle soft nofile 1024 
	oracle hard nofile 65536 
	oracle soft nproc 16384 
	oracle hard nproc 16384 
	oracle soft stack 10240 
	oracle hard stack 32768 
	oracle hard memlock 134217728 
	oracle soft memlock 134217728
  1. 添加下列条目到/etc/pam.d/login,主要用于限制使用进程数
[root@oracle12 ~]# vi /etc/pam.d/login               # 在文件末尾追加如下配置
	session required /lib/security/pam_limits.so
	session required pam_limits.so
  1. 配置环境变量
[root@oracle12 ~]# vi /etc/profile                   # 在文件末尾追加如下配置
if [ $USER = "oracle" ]; then
	if [ $SHELL = "/bin/ksh" ]; then
		ulimit -p 16384
		ulimit -n 65535
	else
		ulimit -u 16384 -n 65535
	fi
fi
[root@oracle12 ~]# source /etc/profile


这篇关于51CTO多哥OCP—Oracle安装(一)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程