DEV Community

iffishells
iffishells

Posted on

Installation and Configuration of Apache Server and Mysql Phpmyadmin on Ubuntu 18 .04

Agenda

  • What is Apache Server ?
  • Installation and Configuration of Apache2
  • What is Mysql-Server?
  • Installation and Configuration of Mysql-Server
  • What is Phpmyadmin?
  • Installation and Configuration of Phpmyadmin

What is Apache Server?

Apache is popular open-source , cross platform web Server that is , by number , the most popular web server in existence. Some high profile companies are using the Apache include IBM , CIsco , General Electric Adobe , VMWare ets . I don't do in more deeper but if want to now more deeply then you can read this post.

installation and configuration of apache2

first of all you will need to update the Ubuntu using following command .

sudo apt update

check it there if there need to upgrade then do using Following command .

sudo apt upgrade -y

for the installation of apache2 server you will need to run the following command .

sudo apt install apache2

Installing Apache2

Now your installation of Apache2 is complet but for checking i will cross check whether is it wrong or right .for this you run the following command .

sudo apache2ctl configtest

Output of this command is syntax Ok but if you see any error other then this you need to fix it using this way. In my case there is no error.

sudo apache2ctl configtest

In order to fixing the error if you are facing that you will need to add ServerName 127.0.0.1 on the last line in /etc/apache2/apache2.cong.

 sudo vim /etc/apache2/apache2.conf 

sudo vim /etc/apache2/apache2.conf

Now check it again by following command .after the configuration you need to restart the apache server by following command.

sudo apache2ctl configtest
sudo systemctl restart apache2

What is Mysql Server?

Mysql server is a sql complaint server , in other word it is relational model database server . it is very popular it because its is free. It was developed by sun and moved to Oracle When Oracle acquired Sun. Oracle continued improving it . and further more the relational model is way to organize data in the table. where each table as a primary key(which is Unique) and rows can relate to each other using key. If you want to know Further you can read this Post.

Installation and Configuration of Mysql-Server

for the configuration of mysql Server you need to change the permission of localhost file . In Ubuntu we can change the permission using terminal or GUI. I will do using Terminal because it is to follow.In order to do this by run the following Command.

sudo chmod 777 /var/www/html/

Now it's time to install Mysql -server by following command.

sudo apt install mysql-server

sudo apt isntall mysql-server

In order to works on the mysql server you will need more utilities/packages . but Don't worry you can install by following command.

sudo apt install php
sudo apt install libapache2-mod-php
sudo apt install php-mysql
sudo apt install php-mcrypt

or you can run by one's time instead of one by one.but This is good practice to run one by one by knowing about the packages

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

now Remaining part to config the files inside /etc/apache2/mods-enabled/dir.conf . you will need to add the index.php on the front of seconed line in that file. Don't worry! i 'll do on the live screenshot.

sudo vim /etc/apache2/mods-enabled/dir.conf 

sudo vim /etc/apache2/mods-enabled/dir.conf

again restart the apache Server by following command .

sudo systemctl restart apache2

for establish the connection from localhost to the local files I need to do little coding in PHP and keep this file in the specific directory.

sudo vim /var/www/html/index.php
# Add the following code on the index.php
<?php
        phpinfo();
?>

What is Phpmyadmin?

Phpmyadmin is a free software tool that allow you to manage the mysql database of your websites. for example for Wordpress websites specifically , the MYSQL database stores all the data related to your posts , pages , comments , links and much more.if you want to know more abou the phpmyadmin you can read Post.

Installation and Configuration of Phpmyadmin

In order to install Phpmyadmin by run the following command ,

sudo apt install phpmyadmin

sudo apt install phpmyadmin

set the password whatever you want.Approximately all the installation is completed.But you need to some config with files .For that you need to add one line in a Specific files.

sudo vim /etc/apache2/apache2.conf
## add the line on the bottom 
include /etc/phpmyadmin/apache.conf
## restart the Apache Server Again
sudo systemctl restart apache2

Conclusion

First i installed the Apache Server and config the files then establish the connection to localhost from the local file like index.php and then install the phpmyadmin. if you facing the any error please let me know on the comments. Allah Hafiz

Top comments (0)