Main steps:
1, install Apache
sudo apt-get install apache2
Sudo/etc/init.d/apache2 restart
2, install PHP
sudo apt-get install libapache2-mod-php5 php5 php5-gd php5-mysql
Sudo/etc/init.d/apache2 restart
3. Install MySQL Database
sudo apt-get install mysql-server mysql-client
/etc/init.d/mysql start
4, install Phpmyadmin-mysql database management
Apt-get Install phpMyAdmin
When the above installation is complete, the following configuration begins:
Find phpMyAdmin
Whereis phpMyAdmin
/usr/share/phpmyadmin
Locate and then connect to the site Directory/var/www/html
Ln-s/usr/share/phpmyadmin
Enter "127.0.0.1/phpmyadmin" in the browser to open the database management interface
Step one, install Apache
sudo apt-get install apache2
Installation is complete.
Run the following command to restart:
Sudo/etc/init.d/apache2 restart
Enter http://localhost or http://127.0.0.1 in the browser, if you see the IT works!, it means that Apache installed successfully, Apache default installation, will be in/var under a directory called WWW, This is the Web directory, all Web files that can be accessed by the browser should be placed in this directory.
It is estimated that there will be friends Apt-get install Apache results returned cannot find this software, anyway I am.
Step two, install PHP
sudo apt-get install libapache2-mod-php5 php5 php5-gd php5-mysql
After installation, we will restart Apache and let it load the PHP module:
Sudo/etc/init.d/apache2 restart
Next, we'll create a new test.php file underneath the Web directory to test if PHP works
Then enter:
<?
Phpinfo ();
?>
Step three, install the MySQL database
sudo apt-get install mysql-server mysql-client
Start command
/etc/init.d/mysql start
Login mysql-uroot-p123456
The Apt-get program will automatically download and install the latest MySQL version. At the end of the installation, it will require the root password to be entered, note that the root password here is not the root password of Ubuntu, it is the root password you want to set for MySQL.
Step four, install Phpmyadmin-mysql database management
Skip here, casually Baidu, download, a decompression, put in the directory can be used.
Apt-get Install phpMyAdmin
Step five, set the Ubuntu file to perform read and write permissions
After the lamp is assembled and installed, the default settings for the PHP Web server root directory are:/var/www. Because of the security principle of Linux system, the file read and write permission in the directory is only allowed by root user, so we can't create a new php file in www folder or modify or delete it, we must first modify the read and write permission of the/var/www directory. In the interface manager through the right-click property cannot modify the file permissions, you have to execute the root terminal command:
sudo chmod 777/var/www
。 You can then write to the HTML or PHP file. 777 is the highest privilege in Linux, which means readable, writable, and executable.
、、—————— other ———————
Ubuntu Modify apache2 Default Web site directory and default home page document
1. Modify the default Site Directory
ubuntu8.10 the default document directory to modify Apache2 by default is in/var/www
sudo gedit/etc/apache2/sites-enabled/000-default
Locate the DocumentRoot in the document and modify the directory where you want to place the Web page file later.
Don't forget to restart the APACHE2 server when you're done.
Command: sudo/etc/init.d/apache2 restart
2. Modify the default home page
Modify default home page: Usually in sudo gedit/etc/apache2/apache2.conf inside
Find DirectoryIndex in the back add such as index.php etc.
However, with the apache2 version of the different file placement location is not the same as I ubuntu8.10 under the configuration file.
Don't be afraid to enter this command Grep-ir directoryindex/etc/apache2
View DirectoryIndex in the Apache2 file.
That's what I do.
/etc/apache2/mods-enabled/dir.conf:directoryindex index.html index.cgi index.pl index.php index.xhtml index.htm
/etc/apache2/mods-available/dir.conf:directoryindex index.html index.cgi index.pl index.php index.xhtml index.htm
Use Apt-get Configuration in Ubuntu environment Apache+php+mysql