joseph.dattilo// lansing · mi

pcDuino 3 LAMP Server: Installing Apache, PHP, and FTP

By Joseph Dattilo · · restored from the archive

This guide consolidates Virtuabotix’s original three-part pcDuino 3 LAMP server series into one article: installing Apache, then PHP, then an FTP daemon (FTPD) on a pcDuino 3 single-board computer. All three parts were originally posted the same day, September 14, 2014, by Joseph Dattilo.

Part 1: Installing Apache

If you are reading this then you probably have a PcDuino 3 that you need to install a LAMP (Linux Apache MySQL PHP) server on, and the first step is to install Apache. This guide should work for all older versions of the PcDuino as well, though some things may be specific to the current version of the board. For those of you who are not aware Apache is a free open source web server that can be installed on just about any machine. The instructions in this guide are specific to the PcDuino 3, but should be roughly identical on most Ubuntu builds.

The Pcduino 3 requires 5V DC power through use of a USB micro, an HDMI cable to be connected to a television or monitor that allows HDMI input, a standard keyboard, and a mouse (technically not required, but it sure makes it easier to open things up). To ensure that the keyboard and mouse can be used together it is wise to use a powered USB hub throughout set-up since some Mouse/Keyboard combos may exceed your supply if you don’t have the recommended 2A supply connected.

Installing the Apache server on PcDuino 3:

Once PCDuino3 has completed boot up a desktop several preset icons will be present on the

screen. One of these icons will be labeled LXTerminal. Opening this icon allows for you to enter the terminal commands throughout this guide.

Linux – Lucky for you the Linux operating system should already be installed, and the PcDuino 3 uses a custom version of Ubuntu. If you have time you can get started by updating the built in apt-get software repositories by inputting the command “sudo apt-get update” into the terminal.

**NOTE: the “sudo apt-get update” command can take several hours to update all

repositories **depending on how out of date yours are. Most users can proceed without

the update, but if unexpected problems come up this can often be the cause.

Now to install Apache on the PcDuino 3. The Apache web server can be installed by typing the following command into the terminal “sudo apt-get install apache2”. This should start a 10 to 20 minute installation process which may require you to type “y” once or twice to confirm installation.

When asked to continue type y and press enter. To ensure the Apache web server is working the chromium web browser in the task bar at the bottom of the screen can be opened and in the address bar type localhost or 127.0.0.1 and press enter. If it is working properly the page will display

It works!” or another Apache diagnostics landing page with some details on your installation. To ensure that the Apache server can be accessed outside of the local host go back to the PCDuino3 desktop and right click on the network icon in the bottom toolbar and select network properties. The IP address will be displayed in the information page that appears. Go to another device (computer or phone) on the same network and open up the web browser. In the address line type the IP address and hit enter. If it is working properly the page will display the same page you just saw from localhost on the PcDuino 3.

If you were able to see the page on the localhost, but are not able to see it from another machine double check the IP address you typed. Generally if you are unable to view the page from another machine it means there may be a problem with your network configuration, or that maybe your phone or PC are not on the same network (eg. check that you are on wifi with a phone, a 3G/4G network won’t have access to your internal addresses).

If you have problems with your server you can always try the following before taking any drastic measures restart the Apache server with the following command “sudo service apache2 restart”.

After that you should be good to go for regular HTML pages. However, most people want just a little more kick in their websites then text and images… so check out the next guide to learn how to install PHP!

Part 2: Installing PHP

This guide is designed to help you install PHP on your PcDuino 3 and is a follow up to the PcDuino Apache Installation Guide, and part two of the PcDuino 3 LAMP Server installation guide. If you are reading this then you probably have a PcDuino 3 that you need to install a LAMP (Linux Apache MySQL PHP) server on. Again if you haven’t install Apache yet please follow the guide linked above to do so before proceeding. This guide should work for all older versions of the PcDuino as well, though some things may be specific to the current version of the board. For those of you who are not aware PHP is a free open source web programming language engine that powers some part of almost every major website in the world. Also be advised that the instructions in this guide are specific to the PcDuino 3, but should be roughly identical on most Ubuntu builds.

The Pcduino 3 requires 5V DC power through use of a USB micro, an HDMI cable to be connected to a television or monitor that allows HDMI input, a standard keyboard, and a mouse (technically not required, but it sure makes it easier to open things up). To ensure that the keyboard and mouse can be used together it is wise to use a powered USB hub throughout set-up since some Mouse/Keyboard combos may exceed your supply if you don’t have the recommended 2A supply connected.

Install PHP on the PcDuino 3:

Once PCDuino3 has completed boot up a desktop several preset icons will be present on the

screen. One of these icons will be labeled LXTerminal. Opening this icon allows for you to enter the terminal commands throughout this guide.

Linux – Should be installed by default.

NOTE: the “sudo apt-get update” command can take several hours to update all

repositories depending on how out of date yours are. Most users can proceed without

the update, but if unexpected problems come up this can often be the cause.

Apache – Should have been installed before proceeding: PcDuino Apache Installation Guide

PHP – Your server is about to get a whole lot more powerful with the PHP scripting language for server side scripting.

To install PHP type “sudo apt-get install php5 libapache2-mod-php5” and press enter. When asked if you wish to continue type “y” and press enter.

After installation is complete restart the Apache web server by entering “sudo service apache2 restart” into the command line.

To ensure php is running properly create a test file by typing the following into the command line:

sudo touch /var/www/test.php” and pressing enter (this creates the file).

Then edit the file by typing “sudo nano /var/www/test.php “(substitute your favorite installed text editor for nano if you like) and press enter. If command is not found you will have to install nano (or call an existing editor like leafpad). The Nano editor can be installed by typing “sudo apt-get install nano”.

Once the text editor is up type in the following content to the PHP file

[The original guide’s PHP test snippet is missing from every archived copy of this page — see sources.md. It should be a one-line <?php phpinfo(); ?> call, standard for this kind of Apache/PHP smoke test, but that is an inference, not a recovered quote, so it is not reproduced here as if it were his exact text.]

This code will make the test.php file call the phpinfo() function for displaying detailed php configuration and installation information. After

typing the commands press CTRL X to exit and type y and press enter to save (these are nano specific instructions) and return to the

LXTerminal. Now open the chromium web browser in the taskbar and in the address bar type “localhost/test.php” and hit enter. If working properly a page displaying all information about your PHP install should be visible. This ensures php is working with the Apache Web Server.

At this point you should ensure that there is no issue with privileges the by granting the appropriate privileges to the web folder. Type “nano /etc/sudoers” and then add the line “USER ALL=(ALL:ALL) ALL” to allow the user root privileges. This will be particularly important for when we install our FTP server in the next guide.

A change mod will also need to be performed to allow directory access for files to be created, and edited on the web server.

To do this run the command “sudo chmod 777 –R /var/www/html”.

And there you have it, now you can probably do three fourths of everything you would want to do on a custom PcDuino 3 server, but in the next guide we are going to make things even better by adding FTP access to allow editing web files with out the need for a monitor, keyboard, or mouse to be connected to our PcDuino 3!

Part 3: Installing FTPD (FTP access)

Okay so having FTPD on the PcDuino 3 is not really technically part of a LAMP server, so with this addition I guess you could call yours a FLAMP server. That said FTP is a great addition to the PcDuino 3, and it can really save you a lot of hassle by eliminating the need to use a screen on your server, and allowing you to edit files remotely. This guide is designed to help you install FTPD on your PcDuino 3 and is a follow up to the PcDuino PHP Installation Guide, and part three of the PcDuino 3 LAMP Server installation guide. If you are reading this then you probably have a PcDuino 3 that you need to install a LAMP (Linux Apache MySQL PHP) server on. Again if you haven’t install Apache, or PHP yet please follow the guide linked above, and later in this guide we recommend installing them first. That said, you can technically run FTPD on your board without running a web server of any kind just to make it easier to access your files, and make changed to the PcDuino remotely.

The Pcduino 3 requires 5V DC power through use of a USB micro, an HDMI cable to be connected to a television or monitor that allows HDMI input, a standard keyboard, and a mouse (technically not required, but it sure makes it easier to open things up). To ensure that the keyboard and mouse can be used together it is wise to use a powered USB hub throughout set-up since some Mouse/Keyboard combos may exceed your supply if you don’t have the recommended 2A supply connected.

Installing the PHP on the PcDuino 3:

Once the PCDuino3 has completed boot up a desktop several preset icons will be present on the

screen. One of these icons will be labeled LXTerminal. Opening this icon allows for you to enter the terminal commands throughout this guide.

Linux – Should be installed by default.

NOTE: the “sudo apt-get update” command can take several hours to update all

repositories depending on how out of date yours are. Most users can proceed without

the update, but if unexpected problems come up this can often be the cause.

Apache – Should have been installed before proceeding: PcDuino Apache Installation Guide

PHP – Should have been installed before procedding: PcDuino PHP Installation Guide

FTPD – At this point you should ensure that there is no issue with privileges the by granting the appropriate privileges to the web folder. Type “nano /etc/sudoers” and then add the line “USER ALL=(ALL:ALL) ALL” to allow the user root privileges. This will be particularly important for the installation of our FTP server which is why we are re-iterating it here.

A change mod will also need to be performed to allow directory access for files to be created, and edited on the web server.

To do this run the command “sudo chmod 777 –R /var/www/html”.

To allow file transfer the “Very Secure FTP Daemon” is installed by typing “sudo apt-get install vsftpd” into the terminal. Once installed the configuration will need to be adjusted.

To open the configuration file type “sudo nano /etc/vsftpd.conf” (once again you can substitute your favorite installed text editor).

Once opened scroll down to anonymous_enable=YES and comment it out by typing # in front of the line

(aka #anonymous_enable=YES).

Then scroll down and ensure that local_enable and write_enable are uncommented (by deleting any # infront of their lines) and are set equal to YES.

Continue to scroll down and uncomment chroot_list_enable=YES and chroot_list_file/etc/vsftpd.chroot_list.

After making these changes press Ctrl+x (in nano). When asked if you would like to save these changes press y and then enter. Once back in the terminal type “sudo touch /etc/vsftpd.chroot_list” to create the file. Once created type “sudo nano /etc/vsftpd.chroot_list” and press enter. Type the user to obtain access which in this case is root (but it could be a different user). To exit press Ctrl+x, type y to save and enter to return to the terminal.

Finally either restart the machine, or try typing the following command “sudo service vsftpd restart” which should restart your FTP server and load your new settings. Now try to connect to your PcDuino 3 with your favorite FTP client (mine is Filezilla) with the username root, and your password (PcDuino 3 default password is “ubuntu”).

Now if you browse to /var/www/ you should be able to edit and add any files to your webserver. If you have any problems with files make sure you did a proper sudo chmod as shown at the beginning of this guide.

Now we are getting really close, only two more steps before we have a pretty much fully featured webserver running on our little embedded linux PcDuino 3 board. In the next guide we will go over how to install MySQL & PhpMyAdmin on the PcDuino 3.

[Joseph’s own text here announced a fourth guide, “MySQL & PhpMyAdmin on the PcDuino 3,” but it was never captured by the Wayback Machine and could not be recovered. See sources.md.]


I'm Joseph Dattilo — engineer-founder in Lansing, Michigan, author of the FleetHarbor suite, and founder of Date Palm Media. More about me · More writing · Get in touch