How do I install the lamp server system on Ubuntu?

Source: Internet
Author: User
Tags web hosting phpmyadmin fully qualified domain name linux mint
Why should I install the lamp server on Ubuntu? When I was working on web development, I preferred to develop in a development environment on my computer without interference. I would rather make mistakes than most people can see, rather than being seen all over the Internet. In order to have this kind of private development environment, I installed a set of lamp system. By the way, if you are unfamiliar with lamp, it represents Linux, Apache, MySQL, and PHP (and/or Perl). Lamp is one of the most common web hosting platforms on the Internet, so it is one of the great environments for building and testing websites.

You can install and configure lamp on Ubuntu 12.04 (precise pangolin) by following these step-by-steps instructions. The process has also been tested for Linux Mint 13/14/15, Ubuntu 12.10 (Quantal Quetzal), and Ubuntu 13.04 Raring Ringtail. If you have a fairly fast broadband connection, it shouldn't take half an hour to get it done.

Installing Lamp on Ubuntu

Ubuntu developers make it easy to install and configure a lamp package, just by using a terminal command. So, open the terminal window and let's get started.

    1. sudo apt-get install lamp-server^

Yes, you did not read wrong. Do not miss the caret (^) at the end. If this caret is missing, this command will not work. It's so magical!

Installing Lamp on Ubuntu

The APT Package Manager now displays the packages that need to be installed and waiting to be confirmed. Type enter enter to confirm and continue the installation.

Installing Lamp Packages

After taking a little time to download the package, you will be prompted to set the password for the root user of MySQL.

Set MySQL root password

Enter the password you want to use for MySQL. There is no space here. You will be prompted for a second time to confirm your password.

Confirm MySQL Root password

After confirming the password, APT will continue to install the remaining packages.

Installation of remaining lamp packages

Your lamp installation is now complete. Wow, that's so easy! Now there are only a few steps left to configure so that you can easily use the system.

Test Apache

Open the Web browser window and enter the address http://localhost/. You should see a webpage that shows "It works!".

Apache is working properly

Test PHP

You have confirmed that the Apache Web server is working properly, so you should make sure that the PHP you are installing is working correctly. To do this, you need to create a file named testing.php in/var/www. You can use the common text editor as the root user, or you can use the following terminal command:

    1. echo " php phpinfo (); ?> " | sudo tee/var/www/testing.php

After that, you need to restart the Apache Web server.

    1. sudo service apache2 restart

Back to the Web browser, enter the address http://localhost/testing.php/, and you should see a webpage displaying information about the PHP installed.

PHP Information

Fix Apache fully qualified domain name

You may have noticed the error message from Apache, which is related to the server's fully qualified domain name.

    1. Apache2:could not reliably determine the server ' s fully qualified domain
    2. Name, using 127.0.1.1 for ServerName

It's not a big deal, but if the problem annoys you, you can use the following command to get it done.

    1. echo "ServerName localhost" | sudo tee/etc/apache2/conf.d/fqdn

Now reload the Apache Web server.

    1. sudo service apache2 Reload

You should never see this error message again.

Configure MySQL

Since this tutorial is intended to build a local Web development environment, you need to bind MySQL to the local host IP address. By default, this address should be 127.0.0.1 on your system. To be in case, you can use these commands to confirm the address.

    1. cat/etc/hosts | grep localhost

You should see something like this:

    1. 127.0.0.1 localhost
    2. :: 1 ip6-localhost ip6-loopback

Now you should confirm that you have the correct binding address in the MySQL my.cnf file.

    1. cat/etc/mysql/my.cnf | grep bind-address

You should see:

    1. bind-address = 127 . 0.0.1

If the binding address does not match the address set for the local host on your system, you need to edit the/etc/mysql/my.cnf as the root user to correct it.

Installing phpMyAdmin

You don't need to install phpMyAdmin, but unless you're an SQL whiz, you'll need it to handle administrative tasks on the MySQL database.

You can use this terminal command to install phpMyAdmin:

    1. sudo apt-get install Libapache2-mod-auth-mysql phpMyAdmin

You will be prompted to confirm that you want to install the package. Press ENTER to proceed.

Installing the phpMyAdmin Package

You will then be prompted to select the Web server configured for phpMyAdmin. It's important! Use the arrow keys on your keyboard to highlight apache2, and then use the space between them to select it. Then press ENTER to proceed. Make sure to click on the chart below to enlarge your view to see what I have described.

Configuring phpMyAdmin for Apache

The next screen will ask if you want to configure a database named Dbconfig-common for phpMyAdmin. Select "Yes" and press ENTER.

Configure Dbconfig-common for phpMyAdmin

You will then be prompted to enter the MySQL root password you set earlier so that you can create a new database. So, enter your MySQL root password and press ENTER.

Enter the MySQL root password

The next tip is to create a MySQL application password for phpmyadmin. If you want to create a random password, you can press ENTER. I usually use the same password for the MySQL root password. In terms of security, this may not be the best approach, but because it is used for a closed development environment, the risk may be minimal.

PhpMyAdmin MySQL app password

Finally, you are prompted to confirm the MySQL application password. Enter the same password as in the previous step and press ENTER.

Confirm MySQL Application password

At this point, the installation and configuration of phpMyAdmin has been completed.

Test phpMyAdmin

The final step is to make sure that the phpMyAdmin is running properly. Open a Web browser and enter the address http://localhost/phpmyadmin/. You should see a page like this.

phpMyAdmin Login Screen

You should now be able to log in with the user name root and the root password you created earlier.

phpMyAdmin is logged in

Congratulations, now that you have finished installing and configuring lamp and phpMyAdmin on Ubuntu 12.04. Now you can start creating a local site. If you are just working on a website development, you can put the file into/var/www. Please note:/VAR/WWW is owned by user and user group root, so you need to copy the file in the root of the user, or change the ownership and/or permissions of the directory, so that you can write files there. In addition, you can make some additional Apache configurations so that you can keep the files somewhere in the home directory. You can even build multiple sites in that way.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes how to install the Lamp server system on Ubuntu? , including the aspects of the content, want to be interested in PHP tutorial friends helpful.

  • 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.