Latest Technology News, Mobile, Laptop, Gadgets and Much More

How to Install & Setup Custom WordPress on Ubuntu 18.04

0 3,063

In this tutorial, We’ll show you How to Install & Setup Custom WordPress on Ubuntu 18.04. Installing  PHP with Apache2, MySQL, PHP 7.4 on Ubuntu 18.04 Google Cloud VPS is an easy task, just follow the steps below and you should have it done in a few minutes. New PHP 7.4 comes with many new features and improvements and as a result of this many developers are using it for their projects.

We will learn How to Install & Setup Custom WordPress on Ubuntu 18.04 (Like Digitalocean, Vultr, Cloudways, AWS, Google Cloud, or any type of VPS Server).

Today, we will learn How To Install Custom WordPress with Apache2, MySQL, PHP 7.4 & Ubuntu 18.04 on Google Cloud 2020 step by step.

 

1. Install Apache

sudo apt update && sudo apt install apache2

2. Configure Firewall

sudo ufw allow OpenSSH
sudo ufw allow in "Apache Full"
sudo ufw enable
sudo ufw status

3. Test Apache

sudo service apache2 status

4. Install MySQL

sudo apt update && sudo apt install mysql-server
sudo service mysql status

5. MySQL Security

sudo mysql_secure_installation
-> ENTER | Y | Y | Y | Y
sudo mysqladmin -p -u root version

6. Install PHP

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt update && sudo apt install php libapache2-mod-php php-mysql
sudo apt-get install php7.2
sudo apt-get install php7.3
sudo apt -y install php7.4
php -v

7. Installing phpMyAdmin

sudo apt update && sudo apt install phpmyadmin
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo service apache2 reload

8. Create MySQL User

sudo mysql
CREATE USER 'newusername'@'localhost' IDENTIFIED BY 'newuserpassword';
GRANT ALL PRIVILEGES ON * . * TO 'newusername'@'localhost';
FLUSH PRIVILEGES;
exit

9. Secure PhpMyAdmin

sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Alias /enter your custom url /usr/share/phpmyadmin
sudo service apache2 reload

10. Enable .htaacess

sudo apt-get update
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-enabled/000-default.conf
<Directory "/var/www/html">
  AllowOverride All
</Directory>

11. Install ZIP/Unzip

sudo apt-get update
sudo apt-get install zip unzip

12. Configure Apache File

sudo nano /etc/apache2/apache2.conf
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
 </Directory>
 <Directory /var/www/html>
    Options -Indexes
 </Directory>
ServerSignature Off
ServerTokens Prod

13. Installing All PHP Modules/ Extensions

PHP 7.2

sudo apt install php7.2-cli php7.2-fpm php7.2-json php7.2-pdo php7.2-mysql php7.2-zip php7.2-gd  php7.2-mbstring php7.2-curl php7.2-xml php7.2-bcmath php7.2-json php7.2-imagick

PHP 7.3

sudo apt install php7.3-cli php7.3-fpm php7.3-json php7.3-pdo php7.3-mysql php7.3-zip php7.3-gd  php7.3-mbstring php7.3-curl php7.3-xml php7.3-bcmath php7.3-json php7.3-imagick

PHP 7.4

sudo apt install php7.4-cli php7.4-fpm php7.4-json php7.4-pdo php7.4-mysql php7.4-zip php7.4-gd  php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath php7.4-json php7.4-imagick

14. Install SSL Certificate

sudo apt-get update
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache
sudo apachectl stop
sudo letsencrypt --authenticator standalone --installer apache -d yourdomain.com -d www.yourdomain.com
sudo service apache2 start
service apache2 restart

15. WordPress File Read/ Write Permission

sudo chmod -R 755 /var/www/html/
sudo chmod -R 777 /var/www/html/

16. PHP.ini File Read/ Write Permission

sudo chmod -R 777 /etc/php/7.2/apache2
sudo chmod -R 777 /etc/php/7.3/apache2
sudo chmod -R 777 /etc/php/7.4/apache2

17. Zip File Extract & Remove Permission

cd
cd /var/www/html
unzip yourfilename.zip
rm -r yourfilename.zip

18. Install MOD Headers Apache2

sudo a2enmod headers
sudo service apache2 start
sudo service apache2 restart

19. Install Memcached Tool

sudo apt-get update
sudo apt-get install memcached
sudo apt-get install -y php-memcached
sudo service apache2 restart

Server Update/ Upgrade/ Stop/ Start/ Restart Command

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apachectl stop
sudo service apache2 start
sudo service apache2 restart

We hope this post helped you to find out How To Install Custom WordPress with Apache2, MySQL, PHP 7.4 & Ubuntu 18.04 on Google Cloud 2020

We love to hear your comments on this article. Please feel free to leave any comments here.

If you liked this article, then please share to Social Media Site. You can also find us on Facebook, Twitter, and Instagram.

Thanks for reading this.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More