Ubuntu之Docker安装Oracle

#!/bin/bash

#基于Ubuntu 22.04.1 LTS
#自行安装Ubuntu 22.04.1
#硬盘大小最小200G

#开启SSH
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install openssh-server ssh -y
systemctl start ssh && systemctl enable ssh && systemctl status ssh
#安装DOCKER
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y ufw net-tools apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install -y docker-ce
systemctl start ufw && systemctl enable ufw && systemctl status ufw && systemctl start docker && systemctl enable docker
#安装ORACLE
docker search oracle
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g && docker images
mkdir -p /home/oracle/app/oracle/oradata
mkdir -p /home/oracle/app/oracle/product/11.2.0/dbhome_2
docker run -d -it -p 1521:1521 \
--name oracle \
--restart=always \
--mount source=oracle_vol,target=/home/oracle/app/oracle/oradata registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
docker exec -it oracle bash
su root
###密码:helowin
mkdir -p /home/oracle/app/oracle/oradata
mkdir -p /home/oracle/app/oracle/product/11.2.0/dbhome_2
#
#不会VI命令百度
vi /etc/profile
#
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
#
source /etc/profile
#
#不会VI命令百度
vi /home/oracle/.bashrc
#
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
#
source /home/oracle/.bashrc
ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
su - oracle
sqlplus /nolog
conn / as sysdba
select instance_name from v$instance;
show user;
exit
docker restart oracle && docker ps -a
sudo ufw allow 22 && sudo ufw allow 1521
sudo systemctl set-default multi-user.target
systemctl restart ufw && systemctl status ufw
chmod a-x /etc/update-motd.d/*
sudo touch .hushlogin
netstat -l | grep 1521
#外联1521
#helowin
#system
#helowin

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值