First, update your source:
[Plain]View Plain Copy
- $ sudo apt-get update
First Step-Install Apache
Apache is an open source software that is currently running on more than 50% servers worldwide and is one of the LAMP (linux,apache,mysql,php) components.
Install Apache:
[Plain]View Plain Copy
- $ sudo apt-get install apache2
After the installation is complete, you can enter http://localhost/in the browser address bar and the installation will be successful with an IT works page.
You can find the IP address of your server by using the following command:
[Plain]View Plain Copy
- $ sudo ifconfig eth0 | grep inet | awk ' {print $} '
Step Two-Install MySQL
(Better reference: http://www.cnblogs.com/xusir/p/3334217.html)
MySQL is a widely deployed database management system for organizing and retrieving data.
Install MySQL:
[Plain]View Plain Copy
- $ sudo apt-get mysql-server
During the installation, MySQL requires you to set a root password, but if you forget to set it, you can also set it through the MySQL shell after installation.
After the installation completes MySQL you need to make the initial setup of MySQL, using the following command:
[Plain]View Plain Copy
- # mysql_secure_installation
This step will require your root password.
This will be done after the input:
[Plain]View Plain Copy
- Enter current password to root (enter for none):
- OK, successfully used password, moving on ...
You will then be prompted whether you want to change the root password, input N is not modified, enter the next step.
After the steps are all Yes, finally MySQL will reload to make the setup complete, as follows:
[Plain]View Plain Copy
- By default, a MySQL installation have an anonymous user, allowing anyone
- To log into MySQL without has to has a user account created for
- them. This was intended only for testing, and the installation
- Go a bit smoother. You should remove them before moving into a
- Production environment.
- Remove anonymous users? [y/n] Y
- ... success!
- Normally, Root should only is allowed to connect from ' localhost '. This
- Ensures that someone cannot guess at the root of password from the network.
- Disallow Root login remotely? [y/n] Y
- ... success!
- By default, MySQL comes with a database named ' test ' that anyone can
- Access. This was also intended only for testing, and should be removed
- Before moving into a production environment.
- Remove test database and access to it? [y/n] Y
- -Dropping test database ...
- ... success!
- -Removing privileges on test database ...
- ... success!
- Reloading the privilege tables would ensure that all changes made so far
- would take effect immediately.
- Reload privilege tables now? [y/n] Y
- ... success!
- Cleaning up ...
After completing the above steps, you can start to install PHP.
Step three-Install PHP
PHP is an open source Web scripting language and is widely used to make dynamic Web pages.
Install PHP (below Debian 7):
[Plain]View Plain Copy
- # apt-get Install php5 php-pear php5-suhosin php5-mysql
Install PHP (Debian 7):
[Plain]View Plain Copy
- # apt-get Install php5 php-pear php5-mysql
Next there will be two queries, all yes.
After completing the PHP installation, overload Apache:
[Plain]View Plain Copy
- # Service Apache2 Restart
Congratulations! You have successfully installed lamp!
Fourth Step--View the PHP version and other information on your server
Although we have installed lamp, we still need to look at the lamp with the successful installation.
First create a file:
[Plain]View Plain Copy
- # nano/var/www/info.php
Write in the new file:
[Plain]View Plain Copy
- <?php
- Phpinfo ();
- ?>
Then save the exit.
Now you can enter http://localhost/info.php in the browser to view the PHP version and other information, such as the following page:
Install apache,mysql,php under "Linux" Debian