本文借鉴
1、参照前面文章并实践最终成功完成环境的安装。
一、安装的硬件要求
1.显存:
要求:显存最小1G,推荐2G或则更高。
查看:#grepMemTotal/proc/meminfo
2.Swap:
要求:
RAW
Swap
1G至2G1.5倍
2G至16G同RAW相等
16G以上16G
查看:#grepSwapTotal/proc/meminfo
二、环境打算
安装包:
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
Oracle下载地址:
三、安装Oracle前的打算
1.创建运行oracle数据库的系统用户和用户组
[root@localhost ~]$ su root #切换到root
Password:
[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的登陆密码,不设置密码,在CentOS的图形登陆界面没法登陆
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)
2.创建oracle数据库安装目录
[root@localhost]# cd /. #进入根目录
[root@localhost]# mkdir -p /data/oracle #oracle数据库安装目录
[root@localhost]# mkdir -p /data/oraInventory #oracle数据库配置文件目录
[root@localhost]# mkdir -p /data/database #oracle数据库软件包解压目录
[root@localhost]# cd /data
[root@localhost data]# ls #创建完毕检查一下(强迫症)
database oracle oraInventory
[root@localhost data]# chown -R oracle:oinstall /data/oracle #设置目录所有者为oinstall用户组的oracle用户
[root@localhost data]# chown -R oracle:oinstall /data/oraInventory
[root@localhost data]# chown -R oracle:oinstall /data/database
[root@localhost data]#
3.更改OS系统标示(oracle默认不支持CentOS系统安装,并且centos似乎就是redhat)
[root@localhost data]# cat /proc/version
Linux version 3.10.0-514.26.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 15:04:05 UTC 2017
[root@localhost data]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@localhost data]# vi /etc/redhat-release
[root@localhost data]# cat /etc/redhat-release
redhat-7
4.安装oracle数据库所须要的软件包
[root@localhost data]# 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*
5.关掉防火墙
[root@localhost data]# 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 Wed 2017-09-13 09:23:08 CST; 25min ago
Docs: man:firewalld(1)
Main PID: 641 (firewalld)
CGroup: /system.slice/firewalld.service
└─641 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Sep 13 09:22:58 localhost.localdomain systemd[1]: Starting firewalld - dynami...
Sep 13 09:23:08 localhost.localdomain systemd[1]: Started firewalld - dynamic...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost data]# systemctl stop firewalld.service #关闭防火墙
[root@localhost data]# systemctl status firewalld.service #查看防火墙状态(已关闭)
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2017-09-13 09:48:55 CST; 10s ago
Docs: man:firewalld(1)
Process: 641 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 641 (code=exited, status=0/SUCCESS)
Sep 13 09:22:58 localhost.localdomain systemd[1]: Starting firewalld - dynami...
Sep 13 09:23:08 localhost.localdomain systemd[1]: Started firewalld - dynamic...
Sep 13 09:48:54 localhost.localdomain systemd[1]: Stopping firewalld - dynami...
Sep 13 09:48:55 localhost.localdomain systemd[1]: Stopped firewalld - dynamic...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost data]# systemctl disable firewalld.service #禁止使用防火墙(重启也是禁止的)
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
6.关掉selinux(需重启生效)
[root@localhost data]# vi /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 - No SELinux policy is loaded.
***SELINUX=disabled #此处修改为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
7.更改内核参数(加入粗体部份)
[root@localhost data]# vi /etc/sysctl.conf
[root@localhost data]# cat /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
8.使配置更改内核的参数生效
[root@localhost data]# sysctl -p
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
sysctl: setting key "fs.file-max": Invalid argument
fs.file-max = 6815744 #设置最大打开文件数
fs.aio-max-nr = 1048576
sysctl: setting key "kernel.shmall": Invalid argument
kernel.shmall = 2097152 #共享内存的总量,8G内存设置:2097152*4k/1024/1024
sysctl: setting key "kernel.shmmax": Invalid argument
kernel.shmmax = 2147483648 #最大共享内存的段大小
sysctl: setting key "kernel.shmmni": Invalid argument
kernel.shmmni = 4096 #整个系统共享内存端的最大数
kernel.sem = 250 32000 100 128
sysctl: setting key "net.ipv4.ip_local_port_range": Invalid argument
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
9.对oracle用户设置限制,提升软件运行性能(粗体为添加部份)
[root@localhost data]# vi /etc/security/limits.conf
[root@localhost data]# cat /etc/security/limits.conf
@student - maxlogins 4
*oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536*
End of file
10.配置用户的环境变量(粗体部份为添加代码)
[root@localhost data]# vi /home/oracle/.bash_profile
[root@localhost data]# cat /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.AL32UTF8 #设置Oracle客户端字符集,必须与Oracle安装时设置的字符集保持一致
11.使用户的环境变量配置立刻生效
[root@localhost data]# source /home/oracle/.bash_profile
12.将安装包联通到/usr/local/src路径下
[root@localhost ~]# cd /.
[root@localhost /]# cd /home/richard/Desktop/
[root@localhost Desktop]# ls
linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
[root@localhost Desktop]# mv linux.x64_11gR2_database_1of2.zip /usr/local/src
[root@localhost Desktop]# ls
linux.x64_11gR2_database_2of2.zip
[root@localhost Desktop]# mv linux.x64_11gR2_database_2of2.zip /usr/local/src
13.重启系统,确保所有设置生效
[root@localhost Desktop]# reboot
14.从root用户切换oracle用户linux 创建oracle 用户,并从oracle用户步入/usr/local/src目录
[root@localhost /]#su oracle #root切换oracle直接可以,不用输入密码,反之则需要
[oracle@localhost /]$ cd /usr/local/src
[oracle@localhost src]$ ls
linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
15.解压两个软件包至/data/database/目录下
假如unzip没安装,会报错。unzipcommandnotfound.这时侯可以执行
[root@localhost /]#yum install unzip
进行安装,须要是root用户下安装
[oracle@localhost src]$ unzip linux.x64_11gR2_database_1of2.zip -d /data/database/ #解压
[oracle@localhost src]$ unzip linux.x64_11gR2_database_2of2.zip -d /data/database/ #解压
16.步入管理员权限,设置目录所有者为oinstall用户组的oracle用户,执行安装
[oracle@localhost src]$ su root
Password:
[root@localhost src]# chown -R oracle:oinstall /data/database/database/
[oracle@localhost /]$ cd /data/database/database/
[oracle@localhost database]$ ls
doc install response rpm runInstaller sshsetup stage welcome.html
[oracle@localhost database]$ ./runInstaller
Starting Oracle Universal Installer...
(省略...)
假如此处会报错,提示DISPLAY未设置。如下设置,在root权限下
Checking Temp space: must be greater than 120 MB. Actual 99804 MB Passed
Checking swap space: must be greater than 150 MB. Actual 8191 MB Passed
Checking monitor: must be configured to display at least 256 colors
>>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
Some requirement checks failed. You must fulfill these requirements before
continuing with the installation,
解决如下:
[root@localhost src]# DISPLAY=:0.0;export DISPLAY
[root@localhost src]# echo $DISPLAY
[root@localhost src]# find / -name "xhost"
/usr/bin/xhost
[root@localhost src]# cd /usr/bin/
[root@localhost bin]# ./xhost
[root@localhost bin]# ./xhost +
[root@localhost bin]# su oracle
[oracle@localhost bin]$ DISPLAY=:0.0;export DISPLAY
[oracle@localhost bin]$ echo $DISPLAY
四、Oracle图形界面选项
假如CentOS没有安装图形界面,是难以用图形界面安装ORACLE的,所以须要额外安装
[root@localhost bin]#yum groupinstall "X Window System"
[root@localhost bin]#yum groupinstall "GNOME Desktop"
.
.
complete!
安装完成以后,执行,步入图形界面,这儿必须是oracle用户下步入图形界面,否则会出问题(Couldnotexecuteautocheckfordisplaycolorsusingcommand/usr/bin/xdpyi…)
[root@localhost bin]# su oracle
[oracle@localhost bin]$ startx
步入图形界面
在图形界面右击,打开命令行
[oracle@localhost root]$ cd /data/database/database/
[oracle@localhost database]$ ls
doc install response rpm runInstaller sshsetup stage welcome.html
[oracle@localhost database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 99018 MB Passed
Checking swap space: must be greater than 150 MB. Actual 8191 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-11-17_10-39-00AM. Please wait ...[oracle@localhost database]$
如下:
1、去掉勾选
2、选YES
根据默认即可,假如安装到分配显存那块,执行程序卡住不动了,可以考虑linux 创建oracle 用户,将手动分配显存的选项取消,“CharacterSets"选择第二项或则第三项中的"UnicodestandardUTF-8…”
下边按部就班就可以成功。
OSKernelParameter下的semmni的缺位是Oracle没有检查到,虽然有arm linuxpuppy linux,选中缺位的依赖包,假如下方详情栏里Expectedvalue中有括弧中标明(i386)或(i686),是在提示缺乏32位的依赖包,而且实际上早已安装了64位的依赖包,忽视它们,pdksh包早已安装,就是之前安装的ksh依赖包。
假如还有提示的其他缺乏的依赖包没有安装就去安装,按提示解决缺乏的依赖包,然后点击“CheckAgain”,再检测一遍,没有问题了,勾选ignoreall,点击“Next”
前面仍然到安装完成
安装完成,使用sys用户进行联接尝试,那边选用的是oralce官方工具。
本文原创地址://q13zd.cn/cgazhjdbzyyq.html编辑:刘遄,审核员:暂无