For those of you who prefer VPS over Shared Hosting, then you must first install all the needs of the web server before actually launching the website of the vps. VPS gives you freedom, you can activate the modules you need like Apache, MySQL, PHP and phpMyAdmin.
Need to know, using VPS means we will work a lot with linux command line. But to install Apache, MySQL, PHP and phpMyAdmin is not difficult. Follow the steps below:
Update the package list on your system so that you can have the latest Apache Apache, PHP, MySql and phpMyAdmin versions.
sudo apt-get update
Step 19: Install Apache
Install Apache via the following command:
sudo apt-get install apache2
Notice that it will install the latest Apache version.
Step 3: Check for a successful Apache Installation
You can check if Apache has been installed by typing your server's IP address http: // your-ip-address or http: // localhost if you do it on a local server. Will appear as below if successful:
Step 4: Install MySql
Install MySql via the following command:
sudo apt-get install mysql-server
You will also asked to enter the desired MySql root password. Although optional, do not leave it alone. The default root account password is empty.
Step 5: Check MySql Installation if Success
Type the following command:
mysql -u root -p
If MySql has been successfully installed, you must be prompted to enter a password. Enter the password you chose in the step above. You should see a MySql prompt like this:
Here you can run mysql query, create tables etc.
Now to go back, quit MySql by typing command:
Step 6: Installing PHP with Commonly Used Extensions
Install PHP and commonly used extensions:
sudo apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-json php-mcrypt php- zip
In the above command besides PHP, the following PHP extension is also installed:
- MySql Extension: To use MySql functions available in PHP
- Curl Extension: To make CURL requests via PHP, it is commonly used in implementing API calls web service
- GD Extensio: To enable GD library. PHP using GD library for image manipulation tasks
- JSON Extension: To decode and encode JSON via PHP
- Mcrypt Extension: Contains various encryption functions
- Zip Extension: Zip and unzip via PHP
PHP offers more extensions, but these are the most commonly used. If necessary, you can install the extension later.
Note also that libapache2-mod-php is Apache Module to run PHP. This module provides connections between Apache and PHP.
Step 7: Check for Successful PHP Installation
Type the following command:
echo " php phpinfo ();?>" | sudo tee /var/www/html/phpinfo.php
This will create a phpinfo.php file in the root directory. Type this url in the browser http: //your-ip-address/phpinfo.php or http: //localhost/phpinfo.php if install locally. You will see a page like this, showing your PHP configuration:
Step 8: Install phpMyAdmin
Install phpMyAdmin via commannd:
sudo apt-get install phpmyadmin  You will be prompted to select the type of web server. The default option is apache2. Press space key to select. Now press the Tab key to highlight the Ok button, then press the enter key
You will then be asked whether to configure the database for phpmyadmin with dbconfig-common. Select Yes and click enter.
You will then be prompted to enter the MySql root account password. Enter the password you type when installing MySql. Use the Tab key to highlight the Ok button and press enter.
Do the same when requesting password confirmation
Step 9: Check for successful phpMyAdmin Installation
Go to url http: // your-ip-address / phpmyadmin or http: // localhost / phpmyadmin in your browser. If phpMyAdmin is installed successfully, you should see the standard phpMyAdmin login page. Type in root as the username, and the MySql keyword you selected earlier to access the database
Step 10: Enable Apache Rewrite Module
Enable Rewrite Module in Apache, so your application can take advantage of pretty seo-friendly URLs, such as http: //website.com/posts/12/post-on-ubuntu/ (not http: // website. com post_id = 12). Most likely you will need a beautiful URL in the future, better enable it now.sudo a2enmod rewrite
Now restart Apache for this change to live.sudo service apache2 restart
problem, can devote the comment below.