Installation and Configuration of Apache Server and Mysql Phpmyadmin on Ubuntu 18 .04
Published: 2020-08-22 18:58:47

<!-- wp:paragraph {"ampFitText":true} -->
<p><amp-fit-text layout="fixed-height" min-font-size="6" max-font-size="72" height="80"><amp-fit-text layout="fixed-height" min-font-size="6" max-font-size="72" height="80"></amp-fit-text></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Agenda </h2>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li><strong>What is Apache Server ?</strong></li><li><strong>Installation and Configuration of Apache2</strong></li><li><strong>What is Mysql-Server?</strong></li><li><strong>Installation and Configuration of Mysql-Server</strong></li><li><strong>What is Phpmyadmin?</strong></li><li><strong>Installation and Configuration of Phpmyadmin</strong></li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>What is Apache Server?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"dropCap":true,"ampFitText":true} -->
<p class="has-drop-cap"><amp-fit-text layout="fixed-height" min-font-size="6" max-font-size="72" height="80">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 <a href="https://www.ibm.com/us-en/">IBM</a> , <a rel="noreferrer noopener" href="https://www.cisco.com/" target="_blank">CIsco</a> , <a rel="noreferrer noopener" href="https://www.adobe.com/" target="_blank">General Electric Adob</a>e , <a rel="noreferrer noopener" href="https://www.vmware.com/" target="_blank">VMWare</a> ets . I don't do in more deeper but if want to now more deeply then you can read this <a rel="noreferrer noopener" href="https://kinsta.com/knowledgebase/what-is-apache/" target="_blank">post</a>.</amp-fit-text></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>installation and configuration of apache2</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>first of all you will need to update the Ubuntu using following command .</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt update</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>check it there if there need to upgrade then do using Following command .</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt upgrade -y</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>for the installation of apache2 server you will need to run the following command .</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt install apache2</code></pre>
<!-- /wp:code -->

<!-- wp:image {"id":293,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://iffishells.files.wordpress.com/2020/08/step1.png?w=1024" alt="" class="wp-image-293"/><figcaption>Installing Apache2</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>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 .</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apache2ctl configtest</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Output of this command is <strong> <em>syntax Ok</em> </strong>but if you see any error other then this you need to fix it using this way. In my case there is no error.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":295,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://iffishells.files.wordpress.com/2020/08/step2.png?w=519" alt="" class="wp-image-295"/><figcaption>sudo apache2ctl configtest</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In order to fixing the error if you are facing that you will need to add  <em><strong>ServerName 127.0.0.1</strong>  </em>on the last line in <strong><em>/etc/apache2/apache2.cong. </em></strong></p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code> sudo vim /etc/apache2/apache2.conf </code></pre>
<!-- /wp:code -->

<!-- wp:image {"id":297,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://iffishells.files.wordpress.com/2020/08/step3.png?w=899" alt="" class="wp-image-297"/><figcaption>sudo vim /etc/apache2/apache2.conf</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Now check it again by following command .after the configuration you need to restart the apache server by following command.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apache2ctl configtest
</code></pre>
<!-- /wp:code -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo systemctl restart apache2</code></pre>
<!-- /wp:code -->

<!-- wp:heading -->
<h2>What is Mysql Server? </h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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 <strong><em><a rel="noreferrer noopener" href="https://www.techopedia.com/definition/8711/oracle-database" target="_blank">Oracle</a></em></strong> 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 <strong><em><a rel="noreferrer noopener" href="https://www.hostinger.com/tutorials/what-is-mysql" target="_blank">Post</a></em></strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>Installation and Configuration of Mysql-Server</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo chmod 777 /var/www/html/
</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Now it's time to install Mysql -server by following command.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt install mysql-server</code></pre>
<!-- /wp:code -->

<!-- wp:image {"id":300,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://iffishells.files.wordpress.com/2020/08/step4.png?w=697" alt="" class="wp-image-300"/><figcaption>sudo apt isntall mysql-server</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In order to works on the mysql server you will need more utilities/packages . but Don't worry you can install by following command.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt install php</code></pre>
<!-- /wp:code -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt install libapache2-mod-php</code></pre>
<!-- /wp:code -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt install php-mysql</code></pre>
<!-- /wp:code -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt install php-mcrypt</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>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</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>now Remaining part to config the files inside <strong><em>/etc/apache2/mods-enabled/dir.conf</em></strong> . 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.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo vim /etc/apache2/mods-enabled/dir.conf </code></pre>
<!-- /wp:code -->

<!-- wp:image {"id":303,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://iffishells.files.wordpress.com/2020/08/step5.png?w=903" alt="" class="wp-image-303"/><figcaption>sudo vim /etc/apache2/mods-enabled/dir.conf</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>again restart the apache Server by following command .</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo systemctl restart apache2</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo vim /var/www/html/index.php
# Add the following code on the index.php
&lt;?php
        phpinfo();
?>
</code></pre>
<!-- /wp:code -->

<!-- wp:heading -->
<h2><strong>What is Phpmyadmin</strong>?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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<a rel="noreferrer noopener" href="https://www.phpmyadmin.net/" target="_blank"> Post</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2><strong>Installation and Configuration of Phpmyadmin</strong></h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In order to install Phpmyadmin  by run the following command , </p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>sudo apt install phpmyadmin</code></pre>
<!-- /wp:code -->

<!-- wp:image {"id":307,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://iffishells.files.wordpress.com/2020/08/step6.png?w=840" alt="" class="wp-image-307"/><figcaption>sudo apt install phpmyadmin</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>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</code></pre>
<!-- /wp:code -->

<!-- wp:heading -->
<h2>Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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. <strong><em>Allah Hafiz</em></strong></p>
<!-- /wp:paragraph -->