Phpmyadmin:linux Study-Install lamp with Apt-get method including phpMyAdmin

Source: Internet
Author: User
Tags command line config mysql php and readable phpmyadmin root directory linux

Linux Learning-Installing lamp with apt-get means including phpMyAdmin
For a friend who wants to learn Linux, it is a choice to install Linux on a virtual machine. As for what kind of Linux easy to use, radish cabbage, each other. I like Ubuntu, the virtual machine is installed on the latest ubuntu11.10
There are two ways to build the lamp environment, one is to install with Apt-get way, this is suitable for beginners. A bit of installation is simple, do not need to do what configuration can be used. The disadvantage is that the autonomy is too poor, installation directory Ah what is the default, not convenient for their own management, also dare not easily move the position. The second is to compile the installation method. This is a good friend with experience, the advantage is that you can automatically choose the extension that needs to be installed, the location of the installation and the root directory of the site, and so on. The disadvantage is that it is not easy to get started.
I am also a novice, first introduced under the first way, that is, apt-get way to install lamp, and install phpMyAdmin management MySQL. The article selected from the network, but after their own test, indeed no problem.
Open terminal (shortcut key ctrl+alt+t)
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 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.
Step 4 restart Apache 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:
sudo 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.
config.inc.php files in the/etc/phpmyadmin/directory must not be world writeable
But it must be readable. Readable
sudo chmod go-w config.inc.php//removes the group and other users, Group,other write permissions.
-rwxr-xr-x 1 root root 4388 February 03:24 config.inc.php*
So far, our lamp configuration is completely over and I hope it will help you.

This article links http://www.cxybl.com/html/wlbc/Php/20130608/38504.html

Related Article

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.