搭建LAMP环境

安装前先更新下自己的服务器

sudo apt-get update  获取最新资源包

sudo apt-get upgrade 本机软件全部更新

sudo apt-get dist-upgrad 本机系统软件更新

 

(1)安装apache2

sudo apt install apache2 -y

apache命令
apache启动
sudo /etc/init.d/apache2 start

apache重启
sudo /etc/init.d/apache2 restart

apache关闭
sudo /etc/init.d/apache2 stop

 

(2)安装MySQL

sudo apt install mysql-server mysql-client

测试MySQL是否安装成功
sudo netstat -ano | grep 3306

 

(3)安装PHP和需要的扩展

sudo apt install php7.0 php7.0-bz2 php7.0-cgi php7.0-curl php7.0-dev php7.0-fpm php7.0-gd php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-pgsql php7.0-xml php7.0-xmlrpc php7.0-zip  php7.0-readline

测试php
php --version

 

(4)查看phpinfo

vim /var/www/html/phpinfo.php

里面输入 
<?php  
  echo phpinfo();
?>
浏览器访问  192.168.1.108/phpinfo.php

  

posted @ 2019-01-18 13:27  王彭雷  阅读(183)  评论(0编辑  收藏  举报