Day1-01_12:
【安装虚拟机】
1.下载,安装
https://www.virtualbox.org
安装要开CPU虚拟
2.app.vagrantup.com下镜像
https://www.vagrantup.com/
3.安装好vagrantup后,cmd命令:
vagrant init centos/7
vagrant up
vagrant reload
进入虚拟机:
vargrangt ssh
exit (退出)
【linux常用命令】
whoami
ls / 根目录所有目录
sudo --超级管理员权限
坑1:powershell版本过低
the version of powershell currently installed on this host is less than the required minimum version
解决:下载
https://docs.microsoft.com/zh-cn/powershell/scripting/install/installing-windows-powershell?view=powershell-6
作者:
【安装Docker】用VPM上:
https://docs.docker.com/engine/install/centos/
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
【Complete!】是什么意思?
启动Docker命令:
sudo systemctl start docker
sudo docker images --有哪些镜像
开机启动
sudo systemctl enable docker
VistualBox
默认端口:3306 - mySQL 6379-Redis
【阿里云镜像加速器】
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
【docker 安装mysql 5.7】
sudo docker pull mysql:5.7
先进超级管理员: su root
参数
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=root \
-d mysql:5.7
配置 my.cnf
cd 进 conf
vi my.cnf ,加A转INSERT,插入
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
退出 esc,加:wq
操作平台
docker exec -it mysql /bin/bash
【安装redis】
docker pull redis
目录结构创建
mkdir -p /mydata/redis/conf
cd /mydata/
cd conf/
touch redis.conf
docker run -p 6379:6379 --name redis -v /mydata/redis/data:/data \
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis redis-server /etc/redis/redis.conf
修改redis.conf,持久化
vi redis.conf
appendonly yes
可视化工具
【虚拟机网络配置】
修改Vagrantfile,打开注释