Install and Configure Apache2
First, update ubuntu repository with the following command :
sudo apt-get update
Install Apache2 and all related dependencies with these command:
sudo apt-get install apache2 apache2-utils
Once apache2 installed, modify file /etc/apache2/mods-enabled/dir.conf, with your favorite editor. I’ll used nano command:
sudo nano /etc/apache2/mods-enabled/dir.conf
You should see the following line:
<IfModule mod_dir.c> DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm </IfModule>
Change to:
<IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm </IfModule>
Restart apache2 with following command:
sudo service apache2 restart
Now you can check out apache2 is working or not by visiting your server’s public IP address or domain from your web browser ( http://ip_address or http://domain.com). If it work you will see the default Ubuntu 14.04 Apache web page, which is there for informational and testing purposes. It should look something like this:

Install and Configure MySQL Server
To install Mysql Server package and all related package dependencies run the followong command:sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysqlDuring the installation, you’ll be asked to setup the MySQL root user password. This is an administrative account in MySQL that has increased privileges, Enter the password and select [OK].

sudo mysql_install_db

sudo mysql_secure_installation

Install and Configure PHP5
To install PHP5 package and all related package dependencies run the following command below. by default ubuntu server 14.04 will installed PHP 5.5sudo apt-get install php5 php5-mysql php-pear php5-gd php5-mcrypt php5-curl
Testing PHP5 and MySQL
In order to test PHP script you need to create simple PHP script in directory /var/www/html. in this case I’ll create phpinfo.php:sudo touch /var/www/html/phpinfo.php
sudo nano /var/www/html/phpinfo.phpAdd the following line into file /var/www/html/phpinfo.php
<?php phpinfo(); ?>Save and exit ( Ctrl + O, Ctrl + X)
Test the php script you have made from web browser by typing in address bar http://ip_address/phpinfo.php. It will appear like screenshot on below.

Testing MySQL connection with PHP script. Create the file /var/www/html/phpmysql.php then add the following line on below. Replace the password with your mysql root password have made during mysql installation:
sudo touch /var/www/html/phpmysql.php
sudo nano /var/www/html/phpmysql.php
<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo "Congrats! connection established successfully";
}
mysql_close($con);
?>
Now open web browser and navigate to http://ip_address/phpmysql.php, The page should be appear like screenshot on below:
The following video created by LinuxScoop and is describes basic steps how to installing LAMP in Ubuntu Server 14.04 LTS. Original Video found here
Conclusion
Now that you have a LAMP (Linux, Apache2, Mysql 5, and PHP5) installed in Ubuntu Server 14.04. Installing LAMP in ubuntu server 14.04 you can also using single commandSumber : http://ubuntuserverguide.com/2014/06/how-to-install-lamp-in-ubuntu-server-14-04-lts.html
Tidak ada komentar:
Posting Komentar