- First install Apache2:
- sudo apt-get install apache2 -y
- Next install PHP:
- sudo apt-get install php -y
- Next install PHP MYSQL support:
- sudo apt-get install php7.3-mysql
- Next install PHP GD (Graphics) support:
- sudo apt-get install php-gd
- Next restart apache2 to invoke PHP support:
- sudo service apache2 restart
- Now create a PHP test file:
- sudo nano /var/www/html/php_test.php
- Enter this in the file:
- <?php echo phpinfo(); ?>sudo service apache2 restart
- Enter CTRL-X, then Y then Enter
- Now test apache2, by entering into the browser address line:
- http://localhost/index.hmtl
- You should see this:

- Now test PHP by entering into the browser address line:
- http:/localhost/php_test.php
- You should see this:

- Check for MYSQL support
- Now install SQL database support:
- sudo apt-get install mariadb-server
- Now run SQL to setup the database for WordPress:
- sudo mysql
- Enter:
- create database wordpress;
- create user ‘name’@’localhost’ identified by ‘password’;
- grant all privileges on *.* to ‘name’@’localhost’;
- flush privileges;
- exit;
- Now invoke the SQL installation:
- Enter:
- sudo mysql_secure_installation
- Enter password used at ii) above
- Enter N
- Then Y, Y, Y, Y
- Now move to the installation directory:
- cd /var/www/html
- sudo wget https://wordpress.org.latest.tar.gz
- sudo tar xzf latest.tar.gz
- sudo mv wordpress/* .sudo service apache2 restart
- sudo mv index.html index.html_old
- sudo chown -R www-data: .
- Start the WordPress install:
- http://localhost
- sudo a2enmod rewrite
- cd /etc/apache2
- sudo nano apache2.conf
- Change entry None to All:
- <Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
- sudo service apache2 restart
- Optionally install ‘phpmyadmin’
- sudo apt-get install phpmyadmin
- If importing a WordPress site copy that was exported to a zip file:
- Delete any existing databases
- Restart Rpi
- Create a new database usually the name given at i) above e.g. wordpress
- Then import file e.g. wordpress.sql.zip noting there is a maximum file size for import of 2M
- To increase the import limit, edit PHP.ini ‘upload’ value to 8M
- The installation is complete.