合 在Docker中使用rpm包的方式安装Oracle 19c
Tags: OracleDocker安装部署OCP19crpm安装
一、安装Docker软件
CentOS 7安装Docker: https://docs.docker.com/engine/install/centos/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1、卸载掉旧版本的 Docker: yum remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine 2、执行以下安装命令去安装依赖包: yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum -y install docker-ce docker-ce-cli containerd.io ## 若执行报错,则配置yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo -- 或一键安装: curl -fsSL get.docker.com -o get-docker.sh sh get-docker.sh systemctl start docker systemctl status docker 3、检查版本 docker version docker info |
二、创建CentOS7.6的容器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | https://hub.docker.com/_/centos?tab=tags --拉取镜像 docker pull centos:7.6.1810 --创建容器 docker run -d --name lhr2019ocp -h lhr2019ocp -p 5500-5510:5500-5510 -p 1521:1521 -p 222:22 --privileged=true centos:7.6.1810 /usr/sbin/init --修改时区 docker cp /usr/share/zoneinfo/Asia/Shanghai lhr2019ocp:/etc/localtime --进入容器 docker exec -it lhr2019ocp /bin/bash --安装一些必要的系统包 yum install -y openssh-clients openssh-server initscripts net-tools telnet which wget passwd e4fsprogs lrzsz sudo unzip lvm2 tree traceroute bridge-utils dos2unix rlwrap yum -y install vim redhat-lsb --解决agetty进程cpu占用率100%,宿主机和容器都需要执行 systemctl stop getty@tty1.service systemctl mask getty@tty1.service --启动ssh进程 systemctl restart sshd --修改root用户密码 echo "root:lhr" | chpasswd --远程登录 ssh root@192.168.1.35 -p222 -- 配置容器内的yum源:阿里云 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean all rpm --rebuilddb |
三、rpm方式安装Oracle 19c
3.1、安装database-preinstall包
1 2 | ## https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/index.html yum install -y https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm |
3.2、下载安装db软件,上传到docker容器内
下载db 19c的地址:https://www.oracle.com/database/technologies/oracle-database-software-downloads.html
安装19c数据库软件:
1 | yum install -y oracle-database-ee-19c-1.0-1.x86_64.rpm |
3.3、创建数据库实例
参数文件:/etc/init.d/oracledb_ORCLCDB-19c、/etc/sysconfig/oracledb_ORCLCDB-19c.conf
1 | /etc/init.d/oracledb_ORCLCDB-19c configure #也可以重启数据库 |
运行过程:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | [root@lhr2019ocp ~]## /etc/init.d/oracledb_ORCLCDB-19c configure Configuring Oracle Database ORCLCDB. Prepare for db operation 8% complete Copying database files 31% complete Creating and starting Oracle instance 32% complete 36% complete 40% complete 43% complete 46% complete Completing Database Creation Creating Pluggable Databases 58% complete 77% complete Executing Post Configuration Actions 100% complete Database creation complete. For details check the logfiles at: /opt/oracle/cfgtoollogs/dbca/ORCLCDB. Database Information: Global Database Name:ORCLCDB System Identifier(SID):ORCLCDB Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details. Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user. |
此过程即静默建库的过程,我们也可以使用DBCA命令来直接创建数据库。