CENTOS8 安装 Oracle

首先,环境配置

oracle数据库对环境要求很高,docker我没找到一个用起来顺手的,所以有了自己安装的想法。

在网上找到的一个一键配置oracle环境的shell:

chmod 777 oraclePreInstallCheck.sh
./oraclePreInstallCheck.sh

因为CENTOS8自带rpm,所以就不需要下载rpm了。

然后检查依赖包是否安装:

rpm -q binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel bc

如果发现没有安装的依赖,需要手动安装,到下面这个网址搜索:

https://centos.pkgs.org/
搜索到软件后,找到binary package,这是已编译好的包,也可以选择源码包Source Package。
CENTOS8 安装 Oracle

复制这个地址,然后输入命令,就开始安装了。如果有报错的请自行百度。

rpm -ivh http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/elfutils-libelf-devel-static-0.182-3.el8.x86_64.rpm

注意:compat-libstdc++ 这个包的名字改了,所以检查程序没有匹配得到,现在是2021年,我搜索出来的名字是Compat-libstdc++-33

依赖安装完毕后,终于

开始安装Oracle

然后解压在官网下载的安装包,我这里下载的是11.2G XE的版本

下载链接:https://download.oracle.com/otn/linux/oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip

unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

解压后的文件目录

[root@centos8-1 ~]# tree

├── Disk1
│   ├── oracle-xe-11.2.0-1.0.x86_64.rpm
│   ├── response
│   │   └── xe.rsp
│   └── upgrade
│       └── gen_inst.sql

开始安装

[root@centos8-1 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:oracle-xe-11.2.0-1.0             ################################# [100%]
Executing post-install steps...

You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

安装后进行配置:

[root@centos8-1 ~]# /etc/init.d/oracle-xe configure

Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition.  The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts.  Press <Enter> to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:   #默认端口8080没什么用,随意

Specify a port that will be used for the database listener [1521]:               #默认数据库监听端口

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration:
Confirm the password:

Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y   #是否开机启动

Starting Oracle Net Listener...Done
Configuring database...grep: /u01/app/oracle/product/11.2.0/xe/config/log/*.log: No such file or directory
grep: /u01/app/oracle/product/11.2.0/xe/config/log/*.log: No such file or directory
Done
/bin/chmod: cannot access '/u01/app/oracle/diag': No such file or directory
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

最后进行配置变量:

vim /etc/profile

文件尾加入以下配置

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe
ORACLE_SID=XE                                     #这里特别注意,XE一定要大写,与tnsnames.ora文件内容一致,否则在使用oracle时会报ORA-01034的错误
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

保存后执行:

source /etc/profile

ok,安装基本完成,如果需要开防火墙的:

firewall-cmd --zone=public --add-port=1521/tcp --permanent    #(--permanent永久生效,没有此参数重启后失效)

firewall-cmd --reload   #重新载入
上一篇:CentOS8 安装docker


下一篇:使用Docker安装ClickHouse