Install lamp and phpMyAdmin under Ubuntu

Source: Internet
Author: User
Tags phpmyadmin

About the lamp configuration under Ubuntu, has become some people's heart disease, plus phpmyadmin configuration, is to make them selves here. Now I'm going to share some of my experience with the lamp and phpMyAdmin under Linux. I hope it will be of some help to you.

The first thing we need to install lamp is APACHE,PHP5,MYSQL5.

Open the terminal and enter the command line. 1. Install Apache

1. Open Terminal

2. Enter the following command

sudo apt-get install apache2

3. If you do not have sudo permissions, you need to enter a password. 2. Test Apache

To determine if the installation was successful, let's test it.

1. Open the browser, enter the following URL

http://localhost/

If successful, you will see the following "It works!", congratulations, the first step, you are a stepping out. 3. Install PHP5

Step 1. Open the terminal (ctrl+alt+t).

Step 2. Enter the following command line:

sudo apt-get install php5 libapache2-mod-php5

Step 3. To make PHP and Apache work together, we need to configure PHP and test it.

Sudo/etc/init.d/apache2 Restart 4. Test PHP

Step 1 We first build a PHP test file (we call it phptest.php) and enter the following:

sudo gedit/var/www/testphp.php

Step 2. At this time we will open a text editor, in which to enter the following content.

<?php phpinfo ();?>

Step 3. Save exit.

Step 4. Now open the browser and look at what we just built. Enter the following URL.

http://localhost/testphp.php If you show PHP's information content page, you've done a small step.

5. Install MySQL

Here we will install MYSQL5 (this is the last step, but also a more troublesome step, the installation of the time to note.) )

Step 1. Once again, open the terminal and enter the following content.

sudo apt-get install Mysql-server

Step 2, if you are required to enter a MySQL password when installing, enter the password. If there is no requirement, proceed to the next step. Enter the following command in the terminal.

Mysql-u Root

Later, you have to enter the following content;

mysql> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' YourPassword '); The above ' root ' is your MySQL username, ' YourPassword ' is your new password.

Step 3. We're going to deal with the more tricky phpmyadmin. The problem that often occurs here is that when phpMyAdmin is installed, the management interface does not appear when you enter Http://localhost/phpmyadmin. Instead, there are pages that are not found. No hurry, we first install again phpMyAdmin and then to solve. Enter the following command:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

The phpMyAdmin here is compatible with the PHP5 we installed before, and if you don't match the PHP and phpMyAdmin, they won't work.

Step 4 Now we go to solve the problem of "phpMyAdmin", when we install the phpMyAdmin, do not think everything is ready. In fact, we still have a job to do, is to configure phpMyAdmin and apache2. The same terminal, enter:

Cp/etc/phpmyadmin/apache.conf/etc/apache2/sites-available/phpmyadmin

This allows us to copy the apache.conf (Apache configuration file) in phpMyAdmin to the phpMyAdmin file under Apache2/sites-available.

Step 5, then enter into the sites-enabled folder:

cd/etc/apache2/sites-enabled/

Step 6. After entering, we want to create a link to the configuration file so that we can take advantage of it. Input:

sudo ln-s. /sites-available/phpmyadmin

Step 7 Restart Apache2

Sudo/etc/init.d/apache2 restart

All right. Open http://localhost/phpmyadmin to experience it.

So far, our lamp configuration is completely over and I hope it will help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.