I will show you how to install a LAMP system. LAMP stands for Linux, Apache, MySQL, PHP. The guide is intended to help those who have very little knowlegde of using Linux.
To install Apache run this command –
sudo apt-get install apache2
To make sure apache installed correctly enter this URL or your web browser.
Then you will see a message saying “It works!” . That means Apache is running in your machine.
For install PHP5 run this command –
sudo apt-get install php5 libapache2-mod-php5
Then restart apache with this command
sudo /etc/init.d/apache2 restart
sudo service apache2 restart
To ensure that PHP is install correctly create a file named test.php in /var/www
Copy/Paste this line into the test file:
<?php phpinfo(); ?>
Save and type the following into the web address:
You will get a page with PHP information.
To install MySQL run –
sudo apt-get install mysql-server
In order for other computers on your network to view the server you have created, you must first edit the “Bind Address”. Begin by opening up Terminal to edit the my.cnf file.
gksudo gedit /etc/mysql/my.cnf
Change the line
bind-address = 127.0.0.1
And change the 127.0.0.1 to your IP address.
You should skip this step if you running Ubuntu on your local machine.
Now enter into MySQL and run –
mysql -u root
And then run this command –
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
(Make sure to change yourpassword to a password of your choice.)
Now install other necessary packages for your LAMP development environment.
Run this command –
sudo apt-get install build-essential php5-curl php5-gd php5-mysql php5-xdebug php-pear php5-memcache memcached
That’s it. Enjoy the power of PHP and MySQL.
Happy Coding 🙂