2014年3月10日 星期一

[Ubuntu] Install LAMP (Linux + Apache + MySQL + PHP) server

想要用 Linux 來架設網站,我們可以使用 LAMP 這套開源的平台。
即使用 Linux 作為操作系統, Apache 作為 Web 服務器, MySQL 作為數據庫和使用 PHP 作為腳本語言。 ( Perl 或 Python 經常被用來取代 PHP )
事實上,各自安裝這些軟體是很麻煩的,還好有現成的安裝套件可以幫助我們快速的完成架設 LAMP server 。


Steps:

  1. There are two ways could install LAMP server
    1. Use the apt-get
      1. Execute following command
      2. sudo apt-get install lamp-server^

      3. Create password for the MySQL "root" user
      4. root

    2. Use tasksel
      1. Install tasksel
      2. sudo apt-get install tasksel

      3. Use tasksel to install LAMP stack
      4. sudo tasksel install lamp-server

      5. Create password for the MySQL "root" user
      6. root


  2. Checking Apache2 installation
  3. http://localhost


  4. Checking PHP5 installation
    1. Create a quick php info page (/var/www/index.php)
    2. echo -e "<?php phpinfo(); ?>" | sudo tee /var/www/index.php

    3. Checking
    4. http://localhost/index.php


  5. Checking MySQL installation
    1. Executd following command
    2. mysqladmin -u root -p status

    3. Enter the password. If everything is working correctly, will show massage like below:
    4. Uptime: 2117 Threads: 1 Questions: 575 Slow queries: 0 Opens: 421 Flush tables: 1 Open tables: 41 Queries per second avg: 0.271


  6. Install phpMyAdmin
    1. Install by apt-get
    2. sudo apt-get install phpmyadmin

    3. Choose the web server
    4. apache2

    5. Configure database for phpmyadmin with dbconfig-common?
    6. Yes

    7. Provide the password of MySQL administrator
    8. root

    9. Create and confirm MySQL application password for phpmyadmin
    10. root

    11. Configure apache2.conf to work with Phpmyadmin
    12. echo -e "\n# Include the phpMyAdmin configurations:\nInclude /etc/phpmyadmin/apache.conf" | sudo tee -a /etc/apache2/apache2.conf

    13. Restart Apache2
    14. sudo service apache2 restart

    15. Enter phpMyAdmin
    16. http://localhost/phpmyadmin

      User name: root
      Password: root



References:

沒有留言:

張貼留言