一. vagrant 安装centos
vagrant init centos/7
vagrant up
vagrant ssh
二. centos安装docker
安装docker
yum install docker
修改配置文件
vi /etc/selinux.config
将标红处修改为图中数据
启动docker
systemctl enable docker //开机启动
systemctl start docker //启动docker
干净地卸载docker
1. yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
2. rm -rf /etc/systemd/system/docker.service.d
3. rm -rf /var/lib/docker
4. rm -rf /var/run/docker
三.docker安装mysql等镜像
1.安装mysql
a.安装
docker pull mysql:5.7
docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql\
-v /mydata/mysql/data:/var/lib/mysql\
-v /mydata/mysql/conf:/etc/mysql\
-e MYSQL_ROOT_PASSWORD=mysql密码\
-d mysql:5.7
b.登录
docker exec -it mysql /bin/bash
mysql -u root -p
(mysql密码)
use mysql;
grant all privileges on *.* to 'root'@'%' identified by 'mysql密码' with grant option;
2.安装redis
1.安装
docker pull redis
docker run -p 6379:6379 --name redis --restart=always\
-v /mydata/redis/data:/data\
-v /mydata/redisl/conf/redis.conf:/etc/redis/red\is.conf\
-d redis redis-server /etc/redis/redis.conf