19/2/13

How To: Install LAMP on Ubuntu 10.10



PHP Info

How to install LAMP on ubuntu.

In this article I will explain how to install LAMP on ubuntu for biggners. LAMP stands for Linux, Apache, Mysql, PHP

Step 1. Installing Apache

  • Open a terminal and type the following command
sudo apt-get install apache2
  • You will be asked to enter your password. Type it and then press enter.
  • After the installation has finished. Open a web browser to navigate to your locatehost.
http://localhost
  • You should see a message saying It Works!.

Step 2. Installing PHP

  • Open the terminal again and enter the following command
sudo apt-get install php5 libapache2-mod-php5
  • After the installation has been completed. You need to restart Apache in order for PHP to work with it.
  • From the terminal type the following command to restart Apache.
sudo /etc/init.d/apache2 restart
  • Testing PHP
  • Create a simple php file in your www directory to test your PHP.
  • Open the terminal and type the following command to create test file
sudo gedit /var/www/phpinfo.php
  • This command will create and open a file called phpinfo.php in your wwwdirectory.
  • Enter the following code in phpinfo.php file and then save it.
<?php phpinfo();?>
  • Save and close the file.
  • Open the browser again and naviage to the newly created file.
http://localhost/phpinfo.php
  • You should see a page displaying your server information. Similar to the image at the beggining of this article.

Step 3. Installing MySQL.

  • Okay, now you have Apache server and PHP up and running. You will to install mysql database
  • Open the terminal and type the following command.
sudo apt-get install mysql-server
  • This will install MySQL database. You will be asked to set a password for the root user. I recommend you set a password.
  • After the installation has been completed you can test MySQL database. From the terminal type the following command
mysql -u root -p
  • Press Enter. You will be prompt to type your password.
  • Type exit to cloase mysql console.

Step 4. Installing phpMyAdmin.

  • The last thing we need to do is to install phpMyAdmin, so you can easily edit your databases.
  • Open the terminal and type the following command.
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
  • During the installation your will be asked to configure the server. Choose Apache server, and creating a password
  • Thats all now your done.
  • The last thing is to create symlink for phpmyadmin!
  • Open a terminal and type the following command.
sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
  • Now open your browser and type.
http://localhost/phpmyadmin
  • Enter the user name root unless you changed it, and type the password.
Here you go, Now you have fully functioned server up and running :)

Bài đăng phổ biến