本文主要记录RPi 2B如何安装Apache2、mysql、php5、vsftp服务器,并对其进行测试,为后续工作做准备,其中遇到SD卡空间不足的问题。
/*************************************************************************
* RPi 2B apache2 mysql php5 and vsftp
* 声明:
* 本文主要记录RPi 2B如何安装Apache2、mysql、php5、vsftp服务器,并对其进行
* 测试,为后续工作做准备,其中遇到SD卡空间不足的问题。
*
* 2016-2-19 深圳 南山平山村 曾剑锋
************************************************************************/
一、参考文章:
1. Apache Server (PHP + MySQL) on Raspberry PI
http://www.tuicool.com/articles/I7Jfue
2. 树莓派(raspberry pi)学习10: 安装ftp服务器
http://blog.csdn.net/c80486/article/details/8460854
二、安装流程:
1. sudo apt-get update
2. sudo apt-get install apache2 php5 libapache2-mod-php5
3. sudo apt-get install mysql-server mysql-client php5-mysql
mysql username: root
mysql passwd: zengjf
4. sudo apt-get install vsftpd
username: pi
passwd: raspberry
三、默认SD卡空间不够用:
1. sudo raspi-config
2. 选择选项卡1:Expand Filessystem
四、mysql 测试:
pi@raspberrypi:~ $ mysql -hlocalhost -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.5.44-0+deb8u1 (Raspbian)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql>
五、php5测试
pi@raspberrypi:~ $ php -v
PHP 5.6.17-0+deb8u1 (cli) (built: Jan 24 2016 12:25:22)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
六、apache2 php测试:
1. cat /var/www/html/index.php
<html>
<head>
<title> zengjf </title>
</head>
<body>
<?php
echo "I am zengjf"
?>
</body>
</html>
2. 浏览器访问:http://192.168.0.5
<html>
<head>
<title>zengjf</title>
</head>
<body>
I am zengjf
</body>
</html>
七、vsftp 测试:
浏览器键入:ftp://192.168.0.5
/ 的索引
名称 大小 修改日期
Desktop/ 16/2/19 下午2:04:00
Documents/ 15/11/21 下午9:31:00
Downloads/ 15/11/21 下午9:37:00
Music/ 15/11/21 下午9:37:00
Pictures/ 15/11/21 下午9:37:00
Public/ 15/11/21 下午9:37:00
Templates/ 15/11/21 下午9:37:00
Videos/ 15/11/21 下午9:37:00
python_games/ 15/11/21 下午9:31:00
show 0 B 16/2/19 下午2:06:00