WIN10 linux 子系统安装lamp

1.换源

备份原先的源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list
换成
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
更新
apt-get update  

2.安装apache2

apt-get install apache2
service apache2 restart 
在本地浏览器打开localhost 应该可以看到apache2的欢迎界面

3.安装php

按照ubuntu安装的方法 apt-get install php5是没法用的,不晓得为啥子
我找的解决办法是如下:
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php
apt-get install libapache2-mod-php
service apache2 restart

4.测试php

在/var/www/html目录下新建test.php
内容如下:
<?php
phpinfo();
?>
打开localhost/test.php 正常显示则代表成功

5.至于mysql 的安装,后续再写

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容