web环境安装
Apache网页服务器安装
安装Apache服务器
yum install httpd httpd-devel
开启服务并设置为开机启动
systemctl start httpd
systemctl enable httpd
php与php扩展安装
安装php
yum -y install php
安装php相关扩展
yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath
重启Apache服务,并查看状态
systemctl restart httpd
systemctl status httpd
防火墙放通80、443端口
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
ftp文件上传、下载服务器安装
服务器安装
安装vsftpd服务
yum -y install vsftpd
开启服务并设置为开机启动
systemctl start vsftpd
systemctl enable vsftpd
编辑配置文件
vi /etc/vsftpd/vsftpd.conf
进入配置文件后,按i
进入编辑模式,确认anonymous=NO
,即禁止匿名登录,esc
退出编辑模式,:wq
保存并退出
客户端设置
客户端使用root
用户登录,选择主动模式,端口保持默认
GPIO库安装
git拉取wiringPi的源代码
git clone git://git.drogon.net/wiringPi
cd wiringPi
git pull origin
如果没有安装gcc的make等常用命令,可通过以下命令安装
yum -y install gcc yum install gcc-c++ yum -y install gcc automake autoconf libtool make
进行编译
./build
若编译成功,可以使用以下命令测试
gpio -v
//返回结果为
gpio version: 2.46
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
Raspberry Pi Details:
Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Embest
* Device tree is enabled.
*--> Raspberry Pi 3 Model B Rev 1.2
* This Raspberry Pi supports user-level GPIO access.
实际接线与网页代码
针脚与接线


网页代码

网页代码已托管在GitHub上,下载后放置在网页服务器根目录即可
寒假考虑要不要买个树莓派玩
牧羊 2019-01-23 20:03