下载docker-desktop
官网下载docker-desktop
- 切换镜像源
{"builder": {"gc": {"defaultKeepStorage": "20GB","enabled": true}},"experimental": false,"registry-mirrors": ["https://docker.hpcloud.cloud","https://docker.m.daocloud.io","https://docker.unsee.tech","https://docker.1panel.live","http://mirrors.ustc.edu.cn","https://docker.chenby.cn","http://mirror.azure.cn","https://dockerpull.org","https://dockerhub.icu","https://hub.rat.dev"]
}
启动一个centos服务
基于centos启动一个容器,批量暴露端口号
docker run -d -it -p 8008:80 -p 13306:3306 -p 9500-9700:9500-9700 -p 16379:6379 --name lnmp_v1 -v /Users/linxi/app:/home/wwwroot -v /Users/linxi/app/nginxconf/:/usr/local/nginx/conf/ centos:latest
- 切换yum镜像源
我们知道,centos8已经停止维护了,我们切换一下yum的源,要不然拉不了文件
进入yum的repos目录
cd /etc/yum.repos.d/
- 修改centos的文件内容
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- 下载wget
yum install wget
- 下载镜像源文件
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repoyum clean allyum makecache
lnmp一键安装脚本
执行lnmp一键安装脚本
wget https://soft.lnmp.com/lnmp/lnmp2.1.tar.gz -O lnmp2.1.tar.gz && tar zxf lnmp2.1.tar.gz && cd lnmp2.1 && ./install.sh lnmp
安装redis
访问镜像服务
安装多版本php
./install.sh mphp
选择版本安装,这里我选择php7.3,安装完毕后创建软链
ln -si /usr/local/php7.3/bin/php /usr/bin/php7
安装redis扩展
wget https://pecl.php.net/get/redis-4.0.2.tgztar -zxvf redis-4.0.2.tgz cd redis-4.0.2/usr/local/php7.3/bin/phpize./configure --with-php-config=/usr/local/php7.3/bin/php-configmake && make installvi /usr/local/php7.3/etc/php.ini lnmp restart