- First install the apache2 package by typing the following command into the terminal:
sudo apt-get install apache2 -y
Test the install with browser by going to http://YOUR_PI_IP/ (examp. http://192.168.1.110). More about networking read here. You should see the following page:
- Install the PHP and Apache packages with the following command:
sudo apt-get install php5 libapache2-mod-php5 -y
To test the install navigate to your html folder with:
cd /var/www/htmlcommand. Next create/open file:
sudo nano index.php
And paste the following to the file:
<?php echo "hello world"; ?>Next Ctrl+X and Y to save.
Now navigate your browser to http://YOUR_PI_IP/index.php and it will display “hello world” text on the page.
- For MySQL and PHP-MySQL run following command:
sudo apt-get install mysql-server php5-mysql -y
In the installation process you will be prompted the MySQL root password select so insert your password you wish to use to access the
MySQL as root user
- Now restart Apache:
sudo service apache2 restart
And check that MySQL works with:
/etc/init.d/mysql statusResult should look something like this:
- Next up.. PhpMyAdmin. Run:
sudo apt-get install phpmyadmin
The package will begin installing. You will be asked which web server is installed, choose apache2.
- Configure for dbconfig-common. You will be prompted the following window:Press Enter/Yes.
Next you’ll be asked for an administrative password, this is the root password that was set during the MySQL installation on step 3.
You’ll be asked to set a password for PhpMySQL. I’ve used the same password as the MySQL root password, but its up to you what you set here.
Make a note of it somewhere.
- Configure Apache to work with PhpMyAdmin
We need to alter the Apache configuration in order to access PhpMyAdmin. To do this, enter the following command to alter the configuration.
sudo nano /etc/apache2/apache2.conf
Navigate to the end of file and add the following new line to the file:
Save the file (CTRL + X and enter Y when prompted to save) and restart Apache2. To restart Apache, enter the following command:
Check that everything works by going http://YOUR_PI_IP/phpmyadmin/ and log in with your root user and MySQL root password.
- And last but not least FTP. Firstly lets install ftp server:
sudo apt-get install vsftpd
- Now lets change the www folders owner from root to pi:
sudo chown -R pi /var/www
- Now lets configure the vsftpd by:
sudo nano /etc/vsftpd.conf
Search through the file and change the following lines:
anonymous_enable=YES Change To anonymous_enable=NO
#local_enable=YES Change To local_enable=YES
#write_enable=YES Change To write_enable=YES
For me on the current install most of the lines where already set.
add a line to the bottom of the file:
Save file by Ctrl+x and the y.
- Now restart the FTP server with “sudo service vsftpd restart“
Danzo. open up your favorite ftp client and log in user is pi and your pi-s password is the well.. password.
*Tutorial on Linux version 4.4.50/ Raspbian v. 8 (jessie)