Apache
步骤一:安装apache
ronyao@ubuntu:~$ sudo apt install apache2
安装好后,在浏览器上输入localhost(服务器端,请输入你的IP地址),回车就会看到:
PHP7.0
步骤二:
- Ubuntu14.04下的默认源是PHP5.0,所以也需要添加外部源
- Personal Package Archive(PPA) 是一个apt仓库,允许第三方开发者发布用于ubuntu的外部资源
- Ondřej Surý 提供了用于PPA的PHP7.0
- sudo apt-get install software-properties-common
- sudo add-apt-repository ppa:ondrej/php
- sudo apt-get update
- sudo apt-get install php7.0
输入版本信息,检测安装是否成功
ubuntu@VM-11-192-ubuntu:~$ php -v
PHP 7.0.18-1+deb.sury.org~trusty+1 (cli) (built: Apr 11 2017 15:08:38) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-1+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies
PHP 7.0.18-1+deb.sury.org~trusty+1 (cli) (built: Apr 11 2017 15:08:38) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-1+deb.sury.org~trusty+1, Copyright (c) 1999-2017, by Zend Technologies
如果出现以上信息,则证明安装php7.0成功 整合一下php和apache
sudo apt install libapache2-mod-php7.0
MySQL
步骤三:
- 因为Ubuntu14.04下没有Mysql5.7的源,需要连接外部资源库进行下载
- wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
- sudo dpkg -i mysql-apt-config_0.6.0-1_all.deb
- sudo apt-get update
- sudo apt-get install mysql-server
- # 在安装过程中要输入密码
sudo apt-get install php7.0-mysql
重启MySQL和Apache
步骤四:
- sudo service mysql restart
- sudo service apache2 restart
OK,这样就安装好了
可参考该博主博客:为了_梦想