Learn How To Install LAMP Stack, Apache, MySQL, PHP PhpMyadmin On Ubuntu 16.04 Or 18.04 And Create Free Website On Remote Server (VPS)

This is part 1 of the blog series to learn how to create free website or blog. All the steps one have to follow step by step of to create a website. Read, follow, run all instructions and commands.

1. Install Ubuntu 16.04 or 18.04 LTS to your computer with minimum resources of 1 GB RAM, 1 GB swap space, 20 GB SSD or HHD, 1 CPU core, and a dedicated Ip address. You can increase this as per your requirement. This is always good and cheap if buy a remote server (VPS) on rent and install your website on that server.

There are many companies providing this service. You can search on the internet or click the below links.

InterServer

UK Web Hosting

Start Your Own Online Store

Contabo Germany

Now connect to your server via putty, get access to the terminal, and log in with root/password.

2. Install Apache. Run the below-mentioned command.

sudo apt update && sudo apt install apache2

3. Install Nano.

sudo apt install nano

4. Install Zip Unzip.

sudo apt-get install zip unzip

5. Install UFW. Run below-mentioned commands one by one.

sudo apt install ufw

sudo ufw allow OpenSSH

sudo ufw allow in "Apache Full"

sudo ufw enable

sudo ufw status

6. Add a user. Give any user name of your choice.

adduser username

7. Give rights to your user name.

usermod -aG sudo username

8. Edit sshd config file and change PermitRootLogin yes to no. Press ctrl +x, y, and enter to save the file. Run the below-mentioned command.

nano /etc/ssh/sshd_config

9. Reload the SSH Service for changes to take effect.

sudo systemctl reload sshd

10. Install MySQL

sudo apt update && sudo apt install mysql-server

11. Check MySQL status and press q to exit.

sudo service mysql status

12. Configure MySQL Security & Enter Y Y Y Y

sudo mysql_secure_installation

13. Check Mysql Version

sudo mysqladmin -p -u root version

14. Install PHP

sudo apt update && sudo apt install php libapache2-mod-php php-mysql

15. Check PHP Version

php -version

16. Install PhpMyAdmin

sudo apt update && sudo apt install phpmyadmin

17. Create MySQL User. Run the below-mentioned commands. Make sure you change ‘pmuser’ and ‘password_here’ with your own. Note and remember the same. Run commands.

sudo mysql -p -u root

CREATE USER 'pmauser'@'%' IDENTIFIED BY 'password_here';

GRANT ALL PRIVILEGES ON . TO 'pmauser'@'%' WITH GRANT OPTION;

exit

18. Edit and secure PhpMyAdmin.config file. Change the Alias from /PHPMyAdmin to whatever you want. Press ctrl+x, y, and enter save the file. Login to PhpMyAdmin by typing your server’s IP address followed by the alias you just have changed as a URL into your windows browser (Ex. Chrome). If you did not change the alias then type your server’s IP address followed by PHPMyAdmin.

(Ex. http://192.168.01.188/phpmyadmin). After logging in to PhpMyAdmin create a new database in which we will Install WordPress. Run the below-mentioned command.

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

19. Reload and restart Apache 2

sudo service apache2 reload

sudo service apache2 restart

19. Allow .htaccess Override and Add AllowOverride All underneath DirectoryIndex index.php

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

20. Enable .htaacess.

sudo apt-get update

sudo a2enmod rewrite

sudo service apache2 restart

21. Edit 000-default.conf file. Paste and Save the below-mentioned lines beneath Documentroot. Press ctrl+x, y, and enter save the file.

<Directory "/var/www/html">
  AllowOverride All
</Directory>

sudo nano /etc/apache2/sites-enabled/000-default.conf

22. Configure Apache File. Find the below-mentioned coding and change AllowOverride None to AllowOverride All

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

sudo nano /etc/apache2/apache2.conf

23. Copy and paste the below-mentioned lines just beneath the above lines you edited.

<Directory /var/www/html>
   Options -Indexes
</Directory>

24. Copy and paste the below-mentioned lines at the end of the file. Press ctrl+x, y, and enter save the file.

ServerSignature Off
ServerTokens Prod

25. Install CURL. Check your PHP version and type the same in the command.

sudo apt-get update

sudo apt-get install curl

sudo service apache2 restart

sudo apt-get install php7.0-curl

sudo service apache2 restart

Now done with this part of the series. In the next part, you will learn how to configure and encrypt SSL certificates free for Apache on Ubuntu 16.04 or 18.04 LTS. Do remember that to create a WordPress-free website or blog you need to follow each step of each part. Click Here and continue to the next part.

The best and cheap web hosting service is Contabo. Click Here to know more.