docker 安装
# 安装yum工具
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2 --skip-broken
#更新本地镜像源
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
#docker-ce为社区免费版本。稍等片刻,docker即可安装成功。
yum install -y docker-ce
# 关闭防火墙
systemctl stop firewalld
# 禁止开机启动防火墙
systemctl disable firewalld
#查看是否关闭防火墙
systemctl status firewalld
systemctl start docker # 启动docker服务
systemctl stop docker # 停止docker服务
systemctl restart docker # 重启docker服务
systemctl enable docker
##配置阿里云镜像加速
sudo mkdir -p /etc/docker
> ##在文件夹内新建一个daemon.json文件
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://akchsmlh.mirror.aliyuncs.com"]
}
EOF
#重新加载文件
sudo systemctl daemon-reload
sudo systemctl restart docker
docker常用命令
# 查看完整Command
docker ps -a --no-trunc
# 进入容器
docker exec -it 容器ID /bin/bash
# 查看应用最近10秒日志
docker logs -f --since '10m' 容器名称
# 查看应用挂载目录
docker inspect container_id
# 本地到docker
docker cp 本地路径 容器id或者容器名字:容器内路径
docker cp /home/acc0526.dmp oracle11g:/home/
# 服务器到本地
docker cp 容器id或者容器名字:容器内路径 本地路径
docker安装各种软件
安装nginx
# 查找镜像
docker search nginx
# 拉取镜像到本地
docker pull nginx
1、本地配置创建文件夹
mkdir -p /AFCAPP/docker/nginx/conf.d
mkdir -p /AFCAPP/docker/nginx/html
mkdir -p /AFCAPP/docker/nginx/logs
mkdir -p /AFCAPP/docker/nginx/conf/nginx.conf
2、拷贝文件到本地
docker cp nginx:/etc/nginx/nginx.conf /AFCAPP/docker/nginx/nginx.conf
docker cp nginx:/etc/nginx/conf.d /AFCAPP/docker/nginx/conf.d
docker cp nginx:/usr/share/nginx/html /AFCAPP/docker/nginx/html
3、创建docker容器并挂载目录
docker run -p 80:80 --name nginx-acc --restart=always \
-v /AFCAPP/docker/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /AFCAPP/docker/nginx/conf.d:/etc/nginx/conf.d \
-v /AFCAPP/docker/nginx/html:/usr/share/nginx/html \
-v /AFCAPP/docker/nginx/logs:/var/log/nginx \
-d nginx
安装Oracle11g
1、拉取镜像,启动容器
# 1、拉取镜像
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
# 2、创建并启动容器
docker run --name oracle_temp -p 1500:1521 --privileged=true -d registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest
# 3 创建挂载目录
mkdir -p /home/oracle/data
docker cp oracle_temp:/home/oracle/app/oracle/oradata/ /home/oracle/data/
#修改挂载目录所属用户和用户组
chown -R 500:500 /home/oracle/data
# 删除临时容器
docker rm -f oracle_temp
# 创建正式容器
docker run -d --name oracle11g -p 1521:1521 --privileged=true -v /home/oracle/data/oradata:/home/oracle/app/oracle/oradata registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest
# 修改文件
docker exec -it oracle11g bash
rm -rf /home/oracle/app/oracle/flash_recovery_area/helowin/control02.ctl #删除oracle的机制文件
cp /home/oracle/app/oracle/oradata/helowin/control01.ctl /home/oracle/app/oracle/flash_recovery_area/helowin/control02.ctl #拷贝
exit;
docker restart oracle11g#重启
2、进入oracle容器,修改环境变量
source ~/.bash_profile
3、登录oracle 创建用户
sqlplus / as sysdba
# 修改system、sys密码
alter user system identified by system;
alter user sys identified by sys;
# 修改密码规则策略为密码永不过期
alter profile default limit password_life_time unlimited;
# 修改数据库最大连接数据
alter system set processes=1000 scope=spfile;
4、查看表空间、创建用户
# 查看数据库版本、表空间位置
select * from v$version;
select name from v$datafile;
# 创建表空间
CREATE TABLESPACE UDMTBS LOGGING
DATAFILE '/home/oracle/app/oracle/oradata/helowin/UDMTBS.dbf' SIZE 100M AUTOEXTEND ON
NEXT 50M MAXSIZE 10240M
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
# 建立用户
CREATE USER ACC PROFILE DEFAULT
IDENTIFIED BY ACC DEFAULT TABLESPACE ACC
ACCOUNT UNLOCK;
# 改变用户在表空间上的配额:
ALTER USER ACC quota UNLIMITED ON ACC;
# 建立授权
GRANT CONNECT TO ACC;
GRANT DBA TO ACC;
5、导入dmp数据库
su - oracle
imp ACC/ACC@192.168.1.227:1521/HELOWIN file=E:/BaiduNetdiskDownload/acc0712.dmp full=y buffer=3276800 ignore=y log=E:/imp.log
imp ACC/ACC@HELOWIN file=E:/BaiduNetdiskDownload/acc0712.dmp full=y buffer=3276800 ignore=y log=E:/imp.log
安装fastdfs
#关闭eslinux
setenforce 0
docker pull delron/fastdfs
docker run -dti --network=host --name tracker -v /home/fastdfs/tracker:/var/fdfs -v /etc/localtime:/etc/localtime delron/fastdfs tracker
docker run -dti --network=host --name storage -e TRACKER_SERVER=10.1.241.107:22122 -v /home/fastdfs/storage:/var/fdfs -v /etc/localtime:/etc/localtime delron/fastdfs storage