目录
目录
1.首先查看redhat 7.0系统本身所安装的那些yum 软件包
端口范围-Verifying UDP and TCP Kernel Parameters
本次实验环境所使用虚拟机为VMware17(16或15版本也可以)
镜像版本为Red Hat 7.9:
ISO镜像地址:
百度网盘链接
链接:https://pan.baidu.com/s/1p318ZZGMfDp4MllXZXbusg?pwd=mpic
提取码:mpic
Oracle版本为11.2.0.4:
百度网盘链接
链接:https://pan.baidu.com/s/1Crvy_Cfgl4x3uxIdhVdEgg?pwd=rqsq
提取码:rqsq
或者官方下载:
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip
su root
vi /etc/sysconfig/network
增加插入插入
- NETWORKING=yes
- NETWORKING_IPV6=yes
- HOSTNAME=rhel
查看主机名
cat /etc/sysconfig/network
- 获取root权限
-
- su - root 输入密码
-
- 查看防火墙状态
-
- systemctl status firewalld
-
- 临时关闭防火墙
-
- systemctl stop firewalld
-
- 永久关闭防火墙
-
- systemctl disable firewalld
-
- 再次查看防火墙状态
-
- systemctl status firewalld
-
- 我们可以看到防火墙已经被关闭了
-
-
- 了解一下,不用执行
- 打开防火墙
-
- systemctl enable firewalld
查看分配给Oracle使用的内存,配置要求:一般大于1G即可。
df -lh /dev/shm/
查看内存大小,配置要求:内存>2G
grep MemTotal /proc/meminfo
查看swap大小,配置要求:按照此规则分配SWAP大小
grep SwapTotal /proc/meminfo
查看/tmp大小,配置要求:/tmp > 1G
df -lh /tmp/
- yum -y install bc binutils elfutils-libelf gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libaio libaio-devel libaio-devel.i686 libcap libXrender libX11 libXau libXi libXi.i686 libXtst libXtst.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libxcb libibverbs make policycoreutils smartmontools sysstat xdpyinfo elfutils-libelf-devel
- yum install -y compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel
- yum install -y ksh libaio-devel numactl-devel
- yum install -y unixODBC unixODBC-devel oracleasm oracleasmlib oracleasm-support
安装失败,原因没有注册(要钱),所以我们要想办法解决
最终解决方法如下:
rpm -qa | grep yum
- rpm -qa|grep yum|xargs rpm -e --nodeps
- rpm -qa |grep yum
这里警告只是告诉我们他吧这个东西已经删除了,但是怕你以后想要所以给你存在这个地方了
试试能不能连接百度
ping www.baidu.com
可以连接通之后停止通信,按住Ctrl+c就可以了
然后开始安装包:
包的连接来自:
Index of /centos/7/os/x86_64/Packages/ (163.com)http://mirrors.163.com/centos/7/os/x86_64/Packages/具体连接需要打开这个查看,包名都一样,注意后边的版本号就可以了
- 注意下面的链接可能会失效,打开上面WEB按照实际的版本下载这5个包即可。
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
以上5个包目前的是(除了第二个包,其他的相对之前的都已经改变了),下面这个是最新(2023年)的:
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-54.el7_8.noarch.rpm
-
- wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
- rpm -ivh yum-* --force --nodeps
- rpm -ivh python-* --force --nodeps
这里第二句执行可能会报错:
解决办法:
1.创建目录python和yum用以存放rpm包:
mkdir /usr/local/src/python2.使用wget分别下载python以及的rpm包(注意:一定要和系统的版本号对应)地址:http://vault.centos.org
下载python的rpm包:
cd /usr/local/src/python wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-2.7.5-34.el7.x86_64.rpm wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-pycurl-7.19.0-17.el7.x86_64.rpm wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-devel-2.7.5-34.el7.x86_64.rpm wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-libs-2.7.5-34.el7.x86_64.rpm wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/python-urlgrabber-3.10-7.el7.noarch.rpm wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/rpm-python-4.11.3-17.el7.x86_64.rpm3.安装python以及rpm包
(1)安装python:
rpm -ivh python-* 注意:这里要在/usr/local/src/python 下执行 然后执行 rpm -ivh python-* --force --nodeps (这个就是上边报错的第二句) --nodeps --force 为不考虑依赖包,强制安装。
将镜像源修改为阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
vim /etc/yum.repos.d/CentOS-Base.repo
- # CentOS-Base.repo
- #
- # The mirror system uses the connecting IP address of the client and the
- # update status of each mirror to pick mirrors that are updated to and
- # geographically close to the client. You should use this for CentOS updates
- # unless you are manually picking other mirrors.
- #
- # If the mirrorlist= does not work for you, as a fall back you can try the
- # remarked out baseurl= line instead.
- #
- #
-
- [base]
- name=CentOS-7 - Base - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
- http://mirrors.aliyuncs.com/centos/7/os/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #released updates
- [updates]
- name=CentOS-7 - Updates - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
- http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #additional packages that may be useful
- [extras]
- name=CentOS-7 - Extras - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
- http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #additional packages that extend functionality of existing packages
- [centosplus]
- name=CentOS-7 - Plus - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
- http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
-
- #contrib - packages by Centos Users
- [contrib]
- name=CentOS-7 - Contrib - mirrors.aliyun.com
- failovermethod=priority
- baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
- http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
- http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
cd /etc/yum.repos.d/
- yum clean all
- yum makecache
- yum update
yum -y install vim
- yum -y install bc binutils elfutils-libelf gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libaio libaio-devel libaio-devel.i686 libcap libXrender libX11 libXau libXi libXi.i686 libXtst libXtst.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libxcb libibverbs make policycoreutils smartmontools sysstat xdpyinfo elfutils-libelf-devel
- yum install -y compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel
- yum install -y ksh libaio-devel numactl-devel
- yum install -y unixODBC unixODBC-devel oracleasm oracleasmlib oracleasm-support
vi /etc/sysctl.conf
添加
net.ipv4.ip_local_port_range = 9000 65500
生效
sysctl -p /etc/sysctl.conf
cat /proc/sys/net/ipv4/ip_local_port_range
grep 127.0.0.1 /etc/hosts
这是为了主机名可以解析到地址
- groupadd oinstall
- groupadd dba
- useradd -g oinstall -G dba oracle
- passwd oracle
修改文件/etc/sysctl.conf
vim /etc/sysctl.conf
添加这些
- fs.file-max = 6815744
-
- kernel.shmall = 2097152
-
- kernel.shmmax = 536870912
-
- 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
-
- net.ipv4.tcp_wmem = 262144 262144 262144
-
- net.ipv4.tcp_rmem = 4194304 4194304 4194304
执行命令: /sbin/sysctl -p
使参数生效。
/sbin/sysctl -p
- mkdir -p /u01/app/
- chown -R oracle:oinstall /u01/app/
- chmod -R 775 /u01/app/
vi /etc/security/limits.conf
添加以下内容
- oracle soft nproc 2047
- oracle hard nproc 16384
- oracle soft nofile 1024
- oracle hard nofile 65536
- oracle soft stack 10240
- oracle hard stack 32768
重启系统让配置生效
vi /etc/sysctl.conf
插入如下内容
- # ============================
-
- # Oracle 11g
-
- # ============================
-
- # semaphores: semmsl, semmns, semopm, semmni
-
- kernel.sem = 250 32000 100 128
-
- kernel.shmall = 2097152
-
- kernel.shmmni = 4096
-
- # Replace kernel.shmmax with the half of your memory size in bytes
-
- # if lower than 4 GB minus 1
-
- # 6442450944 is 6 GigaBytes (12 GB of RAM / 2)
-
- kernel.shmmax=6442450944
-
- #
-
- # Max number of network connections. Use sysctl -a | grep ip_local_port_range to check.
-
- 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
-
- #
-
- # The maximum allowed value, set to avoid overhead and input/output errors
-
- fs.aio-max-nr = 1048576
-
- # 512 * Processes
-
- fs.file-max = 6815744
-
- fs.suid_dumpable = 1
使配置生效
sysctl -p /etc/sysctl.conf
编辑 /etc/profile
vi /etc/profile
添加以下
- if [ $USER = "oracle" ]; then
- if [ $SHELL = "/bin/ksh" ]; then
- ulimit -p 16384
- ulimit -n 65536
- else
- ulimit -u 16384 -n 65536
- fi
- fi
使生效
source /etc/profile
指的是oracle用户
- su - oracle
- vi ~/.bashrc
- vim /home/oracle/.bash_profile
插入以下内容
- PATH=$PATH:$HOME/.local/bin:$HOME/bin
-
- export PATH
- #For Oracle
- export DISPLAY=:0.0
- export TMP=/tmp;
- export TMPDIR=$TMP;
- export ORACLE_BASE=/u01/app/oracle;
- export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;
- export ORACLE_SID=orcl;
- export ORACLE_TERM=xterm;
- export PATH=/usr/sbin:$PATH;
- export PATH=$ORACLE_HOME/bin:$PATH;
- export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
使生效
source ~/.bashrc
注意!!! ORACLE_HOSTNAME变量一定需要设置成系统的主机名,否则安装会报错: [INS-20802] Oracle Net Configuration Assistant failed. 出现这个错误耳朵根本原因是ORACLE_HOSTNAME变量和真实的主机名不同。 这个错误虽然可以忽略,待安装完成再配置监听文件中的主机名,但是比较繁琐。
主机名查看命令
grep HOSTNAME /etc/sysconfig/network
上传Oracle文件到目录/home/oracle/下载
通过Xshell或者其他方式上传均可以
解压缩
- unzip linux.x64_11gR2_database_1of2
- unzip linux.x64_11gR2_database_2of2
现在到图形化界面
cd database
运行
./runInstaller
问题:乱码
解决:
export LANG=en_US.UTF-8
注意:这里可能会卡着,但是其实不是真的卡,只需要按住 上键+空格键 就可以跳过
这里有可能会出现报错,不过别慌
到这里先别动他,在打开一个终端执行解决步骤,解决步骤完成之后再点击Continue
解决步骤:
在makefile中添加链接libnnz11库的参数
修改$ORACLE_HOME/sysman/lib/ins_emagent.mk,找到下面这行
$(MK_EMAGENT_NMECTL)
修改为:
$(MK_EMAGENT_NMECTL) -lnnz11
建议修改前备份原始文件
- cd $ORACLE_HOME/sysman/lib
- cp ins_emagent.mk ins_emagent.mk.bak
- vi ins_emagent.mk
具体命令如上,进入文件之后就开始找那边所说的那一行,在中下的一个位置,然后把它进行替换
进入vi编辑器后 命令模式输入/NMECTL 进行查找,快速定位要修改的行。
在后面追加参数-lnnz11, 第一个是字母l,后面两个是数字1。
保存退出后Retry。
close之后安装成功,这是你的运行终端显示的是这样子,不要关闭,在打开一个终端执行之后的
命令
- [oracle@localhost database]$ ./runInstaller
- Starting Oracle Universal Installer...
-
- Checking Temp space: must be greater than 120 MB. Actual 23003 MB Passed
- Checking swap space: must be greater than 150 MB. Actual 2048 MB Passed
- Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
- Preparing to launch Oracle Universal Installer from /tmp/OraInstall2023-10-15_02-00-31PM. Please wait ...[oracle@localhost database]$ You can find the log of this install session at:
- /u01/app/oraInventory/logs/installActions2023-10-15_02-00-31PM.log
切换到oracle用户 su - oracle
执行监听命令
netca
监听状态查看
lsnrctl status
监听停止
lsnrctl stop
监听开始
lsnrctl start
切换至oracle用户
su - oracle
dbca命令
dbca
在这里可能会报错,同样的方法,别关闭,在打开一个终端进行执行
file ‘’etc oratab’’ is not accessible
解决:
切换到root用户:
su root
切换到oracle安装目录 :
cd $ORACLE_HOME
运行root.sh文件:
./root.sh
连接到数据库
su oracle sqlplus /nolog
管理员登录
conn / as sysdba
至此数据库安装成功