1: first install Apache: Open the terminal (CTRL + ALT + T ),
Enter the following command:Sudo apt-Get install apache2To install,
After installation, open your browser and enter the following in the address bar:Localhost or http: // 127.0.0.1
If you see it works, the installation is successful!
Default root directory:/var/www/
2: Install MYSQL:
Sudo apt-Get install mysql-server-5.0
After installation, you will be asked to set a new MySQL Root Password, enter your own password, enter the key, and then confirm the password.
3: install PHP 5 and Apache PHP 5 module:
Sudo apt-Get install PhP5 libapache2-mod-php5
Sudo/etc/init. d/apache2 restart (restart Apache)
The attempt is successful. No:
Command: gksudo gedit/var/www/text. php [Create a text. php file under the default Apache root directory/var/www]
Enter the following in the text. php file:CodeCheck whether the installation is successful:
- <? PHP
- echo" helloworld ";
- ?>
Enter http: // localhost/text. php in the address bar of the browser. If helloworld is displayed on the page, the request is successful.
Tip: if you cannot enter the command again when you return to the terminal, press Ctrl + Z.
4: make Apache and PHP support PHP:
Sudo apt-Get install libapache2-mod-auth-mysql
Sudo apt-Get install php5-mysql
Sudo/etc/init. d/apache2 restart (restart Apache)
Now the environment has been set up!
/Var/www/(put The apache2 webpage file here)
/Var/lib/MySQL (put the MySQL file here)
If you want to connect remotely, you need to install SSH with the command: sudo apt-Get Install SSH
Maybe we are still used to phpMyAdmin.
5. Install phpMyAdmin.
Sudo apt-Get install phpMyAdmin
Enter http: // localhost/phpMyAdmin in the browser to find not found.
Therefore, you must transfer the installation to the phpMyAdmin folder to/var/www /.
Sudo ln-S/usr/share/phpMyAdmin // var/www/
Run the preceding command to transfer the phpMyAdmin folder to the destination. Alternatively, you can copy phpMyAdmin directly to the/var/www/folder.
When we enter http: // localhost/phpMyAdmin in the browser again, we find that the interface we are familiar with is back.
original: http://blog.csdn.net/guaikai/article/details/6905781