Skip to content

Wednesday, November 11th, 2009

New Linux User

Beginner’s guide to setting up Apache2, PHP5, and MySQL

January 28, 2007 by admin  
Filed under How To

The following are beginners instructions on how to install Apache2, PHP5, MySQL, and PHPMyAdmin in one swoop. I tried to simplify the process as much as possible. This should work for all distributions (although I have only tested it on Ubuntu). Copy and paste the following command into a terminal:

apt-get install mysql-server mysql-admin apache2 php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql phpmyadmin

Once all these programs finish installing, you can go to /var/www and anything you put in /www will appear on your server. Open a browser and type “localhost” into the URL and you will see all the files on your server. There should only be two links in your localhost at this point: apach2-default and phpmyadmin.

Before you can begin using MySQL you need to give yourself permission to log into PHPMyAdmin. You can give yourself root access to begin with by typing the following command (obviously replace “yourPassword” with the password you want):


mysqladmin -u root password yourPassword

After you setup your access to PHPMyAdmin you need to restart your server and then you can log in. Type the following commands to restart MySQl and Apache2:


/etc/init.d/mysql restart
/etc/init.d/apache2 restart

Go to localhost/phpmyadmin and log in and you will be able to add databases to MySQL. Let me know if you have any questions and I’ll address them in the comments.

  • StumbleUpon
  • Digg
  • Facebook
  • Mixx
  • Google
  • TwitThis
  • Reddit
  • Yahoo! Buzz
  • Slashdot
  • E-mail this story to a friend!

Comments

6 Responses to “Beginner’s guide to setting up Apache2, PHP5, and MySQL”
  1. only_samurai says:

    This is surely a beginner’s guide. Not bad for a quick-setup; however, a lot of detail into how things are configured and used are left out. Nice job all the same.

  2. Rob says:

    I would agree with only_samurai, other than this:
    I have a major noob problem, in that after installing php, apache and mysql first (and phpmyadmin later) i just get a standard apache test page when i log in. this tutorial only covers if everything works perfectly.

  3. yahya says:

    Thanks for the efoort. Please not the following :
    1. easy,clear .
    2. Something is missing for a beginner . this is the steps prior to the following command :

    user01@user01-desktop:~$ mysqladmin -u root password Yourpassord
    because the followingresponce will appear :

    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Access denied for user ‘root’@'localhost’ (using password: NO)’

  4. Mr. Nandkishor G. Gokhe says:

    Hi,
    I am the student of Master of Computer Management. I want some specific topics like how to configure apache server and how to install it- with or without rpm? and i also want the mysql admin commands?

  5. Mr. Nandkishor G. Gokhe says:

    Hi,
    I am the syudent of master of computer management. i want the help releted to some special topics in linux like how install apache server – with or without rpm? and mysql admin commands? can you help me with this?

Trackbacks

Check out what others are saying about this post...
  1. [...] there are a lot of PHP-based wikis out there so it’s more or less required for you to have Apache and PHP installed. Some wikis don’t really require a database backend so it’s not always a necessity to [...]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


About Us | Advertise with us | Blog for EveryJoe | Privacy Policy | Terms of Use
Get This Theme | Sitemap


All content is Copyright © 2005-2009 b5media. All rights reserved.