#!/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
Ubuntu之Docker安装Oracle
于 2023-01-07 00:09:42 首次发布