How to configure and use the lamp environment in Ubuntu 10.04

Source: Internet
Author: User
Tags mcrypt

1. refer to the previous network Abstract O (routing _ Routing) O ~

2. Install phpMyAdmin (a graphical database management software)

Why does phpMyAdmin or other graphical software need to be installed after lmap is installed?

As the name suggests, after MySQL is installed, it can only be accessed through a terminal (think back to the content above) to create a database and a user. It is very troublesome for cainiao. If you do not want to recite the commandCode, It is best to install phpMyAdmin:

Note:

1.If you log on to the system as the root user, you do not need to enter the sudo (Super User do) on the front)
The following example uses the same method.

2. You will be prompted to create a new database during installation. You can choose either or not to install the database, depending on your own wishes.

3. phpMyAdmin requires PHP-mcrypt extension. In most cases, you do not need to install phpMyAdmin independently.
A warning is displayed at the bottom of the page after phpMyAdmin. follow these steps:

Run in the terminal:

Code: Sudo apt-Get install php5-mcrypt

If the prompt is not installed, it will be automatically installed. If the prompt is already installed, proceed to the next step:

Edit the PHP configuration file and run it on the terminal:

Code: Sudo gedit/etc/PhP5/apache2/PHP. ini

In the pop-up interface, find the extension help document and syntax, and add:

Code: Extension = php5-mcrypt.so

Save and close this document, restart Apache, and run:

Code: Sudo/etc/init. d/apache2 restart

3. Configure the lamp Environment

Are all installed? Soon. It may take less than five minutes to configure your lamp! It can only be used after configuration.

These are the path of the configuration file (very important ):

Code: 1> Apache configuration file path/etc/apache2/apache2.conf
2> PHP. ini path/etc/PhP5/apache2/PHP. ini
3> MySQL configuration file path/etc/MySQL/My. CNF
4> phpMyAdmin configuration file path/etc/PHPmyAdmin/Apache. conf
5> website root directory/var/WWW

3.1 configure Apache

Use commands in the terminal

Code: Sudo gedit/etc/apache2/apache2.conf


Add the following lines at the end of the configuration file (do not copy Chinese ):
Support for adding file types

Code: Addtype application/X-httpd-PHP. php. htm. html


Default Character Set Based on your needs

Code: Adddefacharcharset UTF-8 Server address Code: Servername 127.0.0.1

The order of adding the three homepage files can be changed to the previous access priority (of course, you can also add other settings such as default. php)Code:<Ifmodule dir_module>
Directoryindex index.htm index.html index. php
</Ifmodule>

3.2 configure PhP5

Use commands in the terminalCode:Sudo gedit/etc/PhP5/apache2/PHP. ini

FindCode:; Date. timezone =ChangeCode:Date. timezone = PRC

Indicates the People's Republic of China (GMT + 8 time zone)

3.3 configure MySQL

Use commands in the terminalCode:Sudo gedit/etc/MySQL/My. CNF

Note that
By default, only local access to the database is allowed.Code:Bind-address 127.0.0.1

This statement restricts local access to MySQL only. If you need access from other machines, use # To comment out this sentence.Code:# Bind-address 127.0.0.1

3. 4. Configure phpMyAdmin

PhpMyAdmin is not installed under/var/WWW by default, but in/usr/share/phpMyAdmin
Right-click the folder, create a link, copy the link, and change the file name of The Link folder to phpMyAdmin.

Then run the command in the terminal

Code: Sudo gedit/etc/PHPmyAdmin/Apache. conf

Then change the path of the following two sentences to/var/www/phpMyAdmin (two sentences in the third row and fourth row)Code:Alias/PHPmyAdmin/usr/share/phpMyAdmin
<Directory/usr/share/phpMyAdmin>

Changed:Code:Alias/PHPmyAdmin/var/www/phpMyAdmin
<Directory/var/www/phpMyAdmin>After completing this step, restart Apache:Code:Sudo/etc/init. d/apache2 restart

4. How to verify that the lamp environment is installed?

It's easy to open var/WWW as the website root directory.(=. = I don't know how to open it? Log on to the system as the root user to view the complete file system)

. Open the browser and enter http: // localhost if you see the text:

Reference: It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.

Congratulations! Apache has been configured.

4. 2. Check whether PHP is configured?

Create or copy a PHP file to var/WWW through http: // localhost/xxx. PHP accesses this file. If the browser prompts you to download this file, it indicates that PHP is not configured. At this time, clear the browser cache. If the file is still inaccessible, PHP cannot be parsed, for more information, see "reconfigure PHP configuration" and restart Apache.

4.3.what about MySQL and phpMyAdmin?
Enter http: // localhost/phpMyAdmin in the browser. The access instructions are configured. Then, use root as the user name and the password entered during phpMyAdmin installation as the password? =. =) Log on to phpMyAdmin. At this time, you can freely create database and database users. After creating a user, don't forget to add the user to the database!

5. start to build a local website

5.1 taking WordPress as an example, we will introduce how to build a website in the lamp environment:

Download WordPress, decompress it to var/www/WordPress, and access it through a browser: http: // localhost/WordPress. Follow these steps to enter the database name and password for installation. Most people may be used to installing on virtual hosts like this,However, on the local machine, it is very likely that such installation is not successful !!

Why? This is because of the Ubuntu User Permissions mentioned above. Write operations are generally not allowed without modifying permissions. Therefore, WordPressProgramIf an error occurs while writing the config configuration file, you cannot proceed, and you cannot change the config file name. In this case, right-click var/www/WordPress in the permission column to ensure that the file can be executed through the program and that the read/write operations on the files in the folder are feasible (similar to the 777 attribute ), click the apply Permissions button for the contained files. Install it in a browser.

Of course, for those who are too lazy to install through the browser, just open the var/www/WordPress/wp-config-new.php to enter their own database parameters and so on (it is recommended to download the http://www.wpchina.org modified Chinese version, because the configuration file contains a detailed description of ipv_^)


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.