How to install Apache Server, MySQL,PHP,phpmyadmin on linux

We will learn how to install Apache 2 web server with php, MySQL and phpmyadmin on Linux.For this Post i am will be using Ubuntu 12.4 but you can use any linux ditro.

Lets Start.Open up the command terminal in Linux and type “sudo apt-get install update” this will update the repository in ubuntu,After this type this command to install Apache 2 web server”sudo apt-get install apache2″ in the installation it will say do you want to Continue, type “y” to install it.

Ubuntu-2012-12-01-23-31-13

Next we need to install php5 programming language in ubuntu Linux, Type “sudo apt-get install php5” in the Terminal and press enter to install it.

Ubuntu-2012-12-01-23-37-38

After this we will Type this command “sudo apt-get install libapache2-mod-php5” to connect with apache 2 web Server.After this we need to install MySQL database, Type this command in the terminal “sudo apt-get install mysql-server” to install  MySQL database in ubuntu Linux, after the installation mysql server will ask you for the root  password, Type the desire password e.g ubuntusql and press enter after this it will again ask you to retype you password enter the same password and press enter.

Ubuntu-2012-12-02-00-01-34

After setting up the MySQL server on Ubuntu Linux its time to install phpmyadmin, Type “sudo apt-get install libapache2.mod-auth-mysql php5-mysql phpmyadmin”  and press enter, after installation process is over  Configuring phpmyadmin window will show up choose apache2 webserver and press enter.

Ubuntu-2012-12-02-00-10-59

After some Configuration process this window wills show up type your Mysql Database password e.g. “ubuntusql” and press enter.

Ubuntu-2012-12-02-00-15-42

After this another window will show up in that window type your desire phpmyadmin password e.g “ubuntuphp” and press enter, Type the same password again and press enter.

Ubuntu-2012-12-02-00-21-29

Now your good to go everything has install in the system properly now we need to create a link in the /var/www  directory for easy access  to that type this “sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin” in the Terminal and press enter.Now type this command “sudo /etc/init.d/apache2 restart” to restart apache.You can also start or stop apache2 by replacing restart with start or stop.

After that open Firefox or any web browser and type localhost, if you see the following screen that means apache2 server is working properly.

Ubuntu-2012-12-02-00-42-45

To add web content on this server open up the var/www/ directory and create a html or php web file.

To test php locate the www directory by typing this command in the terminal “cd /var/www” after this type this “sudo touch test.php” to create a new php after that type this “sudo gedit test.php” and press enter, a code editor will open up; type this line of code ““in the test.php file to check if  php is working.

Ubuntu-2012-12-02-01-02-24

Open up the web browse and type localhost/test.php in the url, if you see the following page that means php has properly installed on the system.

Ubuntu-2012-12-02-01-00-59

Now Type localhost/phpmyadmin in the url to open phpmyadmin.

Ubuntu-2012-12-02-00-47-07

Enter your Username and password,User name is “root” and the password is ubuntuphp yours will be different and click on go or just press enter. After logging in you will see the following screen.

Ubuntu-2012-12-02-01-09-56

Now everything is working fine to learn more about myself or php check my other posts.

Advertisements

3 comments on “How to install Apache Server, MySQL,PHP,phpmyadmin on linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s