: This article describes how to install the LAMP server on Ubuntu ?, If you are interested in the PHP Tutorial, refer. Why should I install the LAMP server on Ubuntu? When I am engaged in Web development, I prefer to develop in the development environment on my computer without interference. Most of the mistakes I would rather make are invisible to others, rather than being seen by everyone on the Internet. In order to have this private development environment, I installed a LAMP system. By the way, if you are not familiar 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 outstanding environments for building and testing websites.
Install and configure LAMP on Ubuntu 12.04 (Precise Pangolin) following the instructions below. This process has also been tested, and has been tested and tested on Linux Mint 13/14/15, Ubuntu 12.10 (Quantal Quetzal), and Ubuntu 13.04 Raring Ringtail. If you have a fast broadband connection, it will take less than half an hour.
Install LAMP on Ubuntu
Ubuntu developers make it easy for people to install and configure the LAMP package by using one terminal command. So open the terminal window and let's get started.
- Sudo apt-get install lamp-server ^
Yes, you are not mistaken. Do not miss the unsigned symbol (^) at the end ). If this escape character is missing, the command cannot be run. That's amazing!
Install LAMP on Ubuntu
The apt package manager now displays the packages to be installed and awaiting confirmation. Enter the Enter key to confirm and continue the installation.
Install the LAMP package
It takes some time to download the software package, and the system will prompt you to set a password for the root user of MySQL.
Set the MySQL root password
Enter the password you want to use for MySQL. It cannot be empty. The system will prompt you to enter the password for the second time.
Confirm the MySQL root password
After the password is confirmed, apt will continue to install the remaining software packages.
Installation of remaining LAMP packages
Your LAMP installation is now complete. Wow, it's that simple! There are only a few steps to configure it so that you can easily use the system.
Test Apache
Open the Web browser window and enter the address http: // localhost /. You should see "It Works!" on a webpage! ".
Apache works properly
Test php
You have confirmed that the Apache Web server works properly, so you should ensure that the installed php works properly. Therefore, you need to create a file named testing. php in/var/www. You can use a common text editor as the root user, or use the following terminal command:
- Echo" "| Sudo tee/var/www/testing. php
Then, you need to restart the Apache Web server.
- Sudo service apache2 restart
Return to the Web browser and enter the address http: // localhost/testing. php/. you should see a webpage showing information about the installed php.
Php information
Complete Apache qualified domain name
You may have noticed the error message from Apache, which is related to the server's fully qualified domain name.
- Apache2: cocould not reliably determine the server's fully qualified domain
- Name, using 127.0.1.1 for ServerName
This is not a big problem, but if it bothers you, you can use the following command to solve it.
- Echo "ServerName localhost" | sudo tee/etc/apache2/conf. d/fqdn
Now, reload the Apache Web server.
- Sudo service apache2 reload
You should never see this error message again.
Configure MySQL
Because this tutorial aims 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. You can use these commands to confirm the address just in case.
- Cat/etc/hosts | grep localhost
You should see something like this:
- 127.0.0.1 localhost
- : 1 ip6-localhost ip6-loopback
Now you should confirm that you have the correct binding address in the MySQL my. cnf file.
- Cat/etc/mysql/my. cnf | grep bind-address
You should see:
- Bind-address = 127.0.0.1
If the binding address does not match the address set for your local host on your system, edit/etc/mysql/my. cnf as the root user and correct it.
Install phpMyAdmin
You do not need to install phpMyAdmin. However, unless you are an Elasticsearch for SQL, you need phpMyAdmin to process management tasks on the MySQL database.
You can use this terminal command to install phpMyAdmin:
- Sudo apt-get install libapache2-mod-auth-mysql phpmyadmin
The system will prompt you to confirm that you want to install the software package. Press enter to continue.
Install the phpMyAdmin package
Next, you will be prompted to select the Web server configured for phpMyAdmin. This is important! Use the arrow keys on the keyboard to highlight apache2 and use spaces to select it. Then press enter to continue. Make sure to click the figure below to zoom in and see what I described.
Configure 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
Next, you will be prompted to enter the MySQL root password you set before, so that you can create a new database. Enter your MySQL root password and press enter.
Enter the MySQL root password
The next prompt is to create a MySQL application password for phpMyAdmin. If you want to create a random password, press enter. I usually use the same password for the MySQL root password. In terms of security, this may not be the best method, but the risk may be very small because it is used in a closed development environment.
PhpMyAdmin MySQL application password
Finally, the system prompts you to confirm the MySQL application password. Enter the same password as in the previous step and press enter.
Confirm MySQL application password
So far, the installation and configuration of phpMyAdmin have been completed.
Test phpMyAdmin
The last step is to ensure that phpMyAdmin runs properly. Open the Web browser and enter the address http: // localhost/phpmyadmin /. You should see a page like this.
PhpMyAdmin logon screen
Now you should be able to log on with the username root and the created root password.
PhpMyAdmin is logged on
Congratulations, you have finished installing and configuring LAMP and phpMyAdmin on Ubuntu 12.04. Now, you can start creating a local website. If you are only engaged in the development of a website, you can put the file into/var/www. Note:/var/www is owned by the user and user group root, so you need to copy the file as the root user, or change the directory ownership and/or permissions, in this way, you can write files there. In addition, you can perform some other Apache configuration to keep the file somewhere in the main directory. You can even build multiple websites in that way.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above introduces how to install the LAMP server system on Ubuntu ?, Including some content, hope to be helpful to friends who are interested in PHP tutorials.