## Install Apache2 ##
$ sudo apt install apache2 -y
sudo a2enmod rewrite
sudo chown -R pi:www-data /var/www/html/
sudo chmod -R 770 /var/www/html/
$ sudo nano /etc/apache2/apache2.conf
Find: (You can use Ctrl & W to find)
Directory /var/www/
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
/Directory
Change to:
Directory /var/www/
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
/Directory
Ctrl & O > Enter > Ctrl & X
sudo visudo
add following line
www-data ALL=NOPASSWD: ALL
$ sudo service apache2 restart
Step 4: ## Install PHP7 ##
$ sudo apt install php libapache2-mod-php -y
Testing PHP
You will first need to delete the file “index.html” in the directory “/var/www/html”.
$ sudo rm /var/www/html/index.html
Then create an “index.php” file in this directory, with this command line
$ echo "<?php phpinfo ();?>" > /var/www/html/index.php
Refresh the web broswer on the same Wi-Fi network, you should now see the PHP info page.
## Install MySQL ##
$ sudo apt install mariadb-server-10.0 php-mysql -y
$ sudo service apache2 restart
$ sudo mysql_secure_installation
You will be asked enter current password for root (default is blank): press Enter.
Set root password, type Y and press Enter.
Type in a new password and press Enter. Important: remember this root password.
Re-enter the new password and press Enter.
Type Y and press Enter to Remove anonymous users.
Type Y and press Enter to Disallow root login remotely.
Type Y and press Enter to Remove test database and access to it.
Type Y and press Enter to Reload privilege tables now.
When complete, you will see the message All done! and Thanks for using MariaDB!.
$ sudo mysql -uroot -p
Enter the root password.
$ create database YOURDATABASENAME;
$ GRANT ALL PRIVILEGES ON YOURDATABASENAME.* TO 'root'@'localhost' IDENTIFIED BY 'YOURROOTPASSWORD';
$ FLUSH PRIVILEGES;
https://downloads.joomla.org/cms/joomla3/3-9-18/Joomla_3.9.18-Stable-Update_Package.zip |
Ctrl & D
Step 6: ## Install PHPMyAdmin ##
$ sudo apt install phpmyadmin -y
Select Apache2 with the cursor keys and press the spacebar to highlight Apache2 > Tab > Enter.
Configure database for phpmyadmin with dbconfig-common? Select 'No' > Enter, we have already setup a database above with the MySQL installation.
sudo nano /etc/apache2/apache2.conf
add following line in last
Include /etc/phpmyadmin/apache.conf
sudo service apache2 restart
To access phpmyadmin use the IP address of the RasPi e.g. 192.168.0.100/phpmyadmin/ Username: root and YOURROOTPASSWORD
Step 7: ## Setup an FTP ##
$ sudo apt install vsftpd -y
$ sudo nano /etc/vsftpd.conf
Find: (You can use Ctrl & W to find)
local_enable=YES
ssl_enable=NO
Change to:
#local_enable=YES
#ssl_enable=NO
Add to the bottom of the file:
# CUSTOM
ssl_enable=YES local_enable=YES chroot_local_user=YES local_root=/var/www user_sub_token=pi write_enable=YES local_umask=002 allow_writeable_chroot=YES ftpd_banner=Welcome to my Raspberry Pi FTP service.
Ctrl & O > Enter > Ctrl & X
$ sudo usermod -a -G www-data pi
$ sudo usermod -m -d /var/www pi
$ sudo chown -R www-data:www-data /var/www
$ sudo chmod -R 775 /var/www
$ sudo reboot