One, install Ubunto on virtual machine
Virtual machine--New virtual machine--Classic mode--set image Address--Setup admin account and pwd--Create, virtual machine automatically load iOS
Ubuntu system default root user is not able to log in, the password is also empty. If you want to log in using the root user, you must first set a password for the root user to open the terminal, enter: sudo passwd root and press ENTER to type the root user password
Second, install Apache
1. Use the command: "sudo apt-get install apache2"
1) Note that I have an error message after using this command: "e:unable to correct problems,you has held broken packages."
2) Use the command "sudo apt-get update" to solve, but it seems that the update speed will be very slow, see the online friends said can change the source, replaced by 163 of the source, sure enough speed a bit faster, the replacement method is as follows:
A. Use the command to back up the Ubunto source list. "Sudo cp/etc/apt/sources.list/etc/apt/sources.list10"
B. Modify the update source (remember to add sudo). "Sudo vim/etc/apt/sources.list"
C. Paste 163 of the source into the (#是注释, so you can safely post)
#163Deb http:mirrors.163.com/ubuntu/Natty main Universe restricted multiverse Deb-SRC http://mirrors.163.com/ubuntu/Natty main Universe restricted Multiverse Deb http:mirrors.163.com/ubuntu/natty-Security Universe main Multiverse restricted Deb-SRC http://mirrors.163.com/ubuntu/natty-Security Universe Main Multiverse restricted Deb http:mirrors.163.com/ubuntu/natty-Updates Universe main Multiverse restricted Deb http:mirrors.163.com/ubuntu/natty-proposed universe main multiverse restricted Deb-SRC http://mirrors.163.com/ubuntu/natty-proposed universe main Multiverse restricted Deb http:mirrors.163.com/ubuntu/natty-Backports Universe main Multiverse restricted Deb-SRC http://mirrors.163.com/ubuntu/natty-Backports Universe main Multiverse restricted Deb-SRC Http://mirrors.163.com/ubuntu/natty-updates Universe main Multiverse restricted
D. Save exit Vim format (: Wq+enter is vim in the Save exit)
E. Updating the Library with the command "sudo apt-get update"
3) "sudo apt-get update" after execution, then use the command "sudo apt-get install apache2" This time it should be normal to download Apache server
2. After the installation is complete, open the browser input "127.0.0.1" or "localhost" if you can properly load instructions Apache installation succeeded (default root:/var/www/)
Third, install MySQL
1. Use the command "sudo apt-get install mysql-server-5.0"
Here's another mistake. "Package ' mysql-server-5.0 ' have no installation candidate", the solution is as follows:
1) "Sudo apt-get update"
2) "Sudo apt-get upgrade" (if there is an error similar to "The following packages has been kept back", use the command "sudo apt-get-u dist-upgrade" to update to the released version This
3) "sudo apt-get install mysql-server-5.0"
2. You should be prompted to enter the password during the installation, remember the password
Third, install PHP 5 and Apache PHP 5 module
1. Use the command "sudo apt-get install php5 libapache2-mod-php5"
2. Using the command "sudo/etc/init.d/apache2 restart"
3. Try success:
Command: Gksudo gedit/var/www/text.php "Create a text.php file under the Apache default root directory/var/www/"
Verify that the installation was successful by entering the following code in the text.php file:
<?php
echo "Hello,world";
?>
Enter in the browser address bar: http://localhost/text.php If the page displays HelloWorld it is successful
Four, let Apache and PHP support PHP
--------------------------------------------------------------------------
1. "Sudo apt-get install Libapache2-mod-auth-mysql"
2. "Sudo apt-get install Php5-mysql"
3. "Sudo/etc/init.d/apache2 Restart" (Restart Apache)
--------------------------------------------------------------------------
The environment has been built!
/var/www/(apache2 Web file is here)
/var/lib/mysql (MySQL file put here)
If you want to connect remotely, also install SSH, command: sudo apt-get install SSH
Lamp Environment Construction