请先从win10应用商店里搜索安装ubuntu , 目前centos对win10子系统支持不是特别好,ubuntu已经很成熟了
安装完ubuntu后,win+r 运行cmd 输入bash命令进入系统
sudo su 转换成超级用户
在win10环境下访问Ubuntu文件系统的home目录:
C:\Users\xxx\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\xxx
在Ubuntu系统下访问win10的home目录:
/mnt/c/Users/xxx
编辑源
vim /etc/apt/sources.list 替换中科大源, 目前这个源php7.2的扩展比较齐全,截至19/8月,阿里云源已经有7.4的beta版可以安装,但扩展并不多还不成熟
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
保存后 sudo apt-get update 更新缓存
保存后 sudo apt-get upgrade 更新本地软件
安装常用工具包--------------------------------------------------------------
sudo apt-get -y install
安装php7.2--------------------------------------------------------------
sudo apt list | grep php 查看源上php的版本安装包
sudo apt-get -y install php7.2 查看源中PHP7.2版本
# 安装常用扩展
sudo apt-get install php7.2-dev php-pear php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml
# 安装其他扩展(按需安装)
sudo apt-get install php7.2-gd
sudo apt-get install php7.2-soap
sudo apt-get install php7.2-gmp
sudo apt-get install php7.2-odbc
sudo apt-get install php7.2-pspell
sudo apt-get install php7.2-bcmath
sudo apt-get install php7.2-enchant
sudo apt-get install php7.2-imap
sudo apt-get install php7.2-ldap
sudo apt-get install php7.2-opcache
sudo apt-get install php7.2-readline
sudo apt-get install php7.2-sqlite3
sudo apt-get install php7.2-xmlrpc
sudo apt-get install php7.2-bz2
sudo apt-get install php7.2-interbase
sudo apt-get install php7.2-pgsql
sudo apt-get install php7.2-recode
sudo apt-get install php7.2-sybase
sudo apt-get install php7.2-xsl
sudo apt-get install php7.2-cgi
sudo apt-get install php7.2-dba
sudo apt-get install php7.2-phpdbg
sudo apt-get install php7.2-snmp
sudo apt-get install php7.2-tidy
sudo apt-get install php7.2-zip
安装swoole 4.4.5--------------------------------------------------------------
cd /usr/local/etc/
wget http://pecl.php.net/get/swoole-4.4.5.tgz
tar -xzvf swoole-4.4.5.tgz
cd swoole-4.4.5
phpize
./configure
make
make test
make install
vim /etc/php/7.2/cli/php.ini
底部插入
extension=swoole.so
保存退出
用php -m 查看是否安装成功
安装composer--------------------------------------------------------------
apt-get install composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ //配置阿里云源