Install apache,mysql,php under "Linux" Debian

Source: Internet
Author: User
Tags install php pear

First, update your source:

[Plain]View Plain Copy
    1. $ 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
    1. $ 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
    1. $ 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
    1. $ 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
    1. # mysql_secure_installation

This step will require your root password.

This will be done after the input:

[Plain]View Plain Copy
    1. Enter current password to root (enter for none):
    2. 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
  1. By default, a MySQL installation have an anonymous user, allowing anyone
  2. To log into MySQL without has to has a user account created for
  3. them. This was intended only for testing, and the installation
  4. Go a bit smoother. You should remove them before moving into a
  5. Production environment.
  6. Remove anonymous users? [y/n] Y
  7. ... success!
  8. Normally, Root should only is allowed to connect from ' localhost '. This
  9. Ensures that someone cannot guess at the root of password from the network.
  10. Disallow Root login remotely? [y/n] Y
  11. ... success!
  12. By default, MySQL comes with a database named ' test ' that anyone can
  13. Access. This was also intended only for testing, and should be removed
  14. Before moving into a production environment.
  15. Remove test database and access to it? [y/n] Y
  16. -Dropping test database ...
  17. ... success!
  18. -Removing privileges on test database ...
  19. ... success!
  20. Reloading the privilege tables would ensure that all changes made so far
  21. would take effect immediately.
  22. Reload privilege tables now? [y/n] Y
  23. ... success!
  24. 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
    1. # apt-get Install php5 php-pear php5-suhosin php5-mysql

Install PHP (Debian 7):

[Plain]View Plain Copy
    1. # 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
    1. # 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
    1. # nano/var/www/info.php

Write in the new file:

[Plain]View Plain Copy
    1. <?php
    2. Phpinfo ();
    3. ?>

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.