Installing LAMP on Ubuntu (Linux,Apache,MySQL,PHP)
Linux/Unix, PHP, Tutorials and Ubuntu
Apache, LAMP, Linux, MySQL, PHP, Ubuntu.
This guide is divided into 3 steps: installing/tesing Apache, PHP and finally MySQL.
Lets start with Apache:
1. Open the terminal (we will be using it through most of my guide) from Applications > Accessories > Terminal
2. Install apache2 using apt-get by typing the following
sudo apt-get install apache2
Note that you should know the root password.
Now everything should be downloaded and installed automatically.
To start/stop apache2 write:
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 stop
Your www folder should be in: /var/www/
If installing Apache2 was succesfull you should see an ordinary HTML page when you type: http://localhost in your browser
Finished with Apache ? lets conquer PHP:
1. Also in terminal write:
sudo apt-get install php5 libapache2-mod-php5
or any php version you like
2. restart apache
$ sudo /etc/init.d/apache2 restart
This is it for PHP :D Wanna test it ? Just create an ordinary PHP page in /var/www/ and run it.
Example:
$ sudo nano /var/www/test.php
and write in it:
$ < ?php Echo "Hello, World!"; ?>
Now run it by typing http://localhost/test.php in browser… You should see your ” Hello World ”
OK ,lets continue to installing MySQL:
1. Open terminal and type:
$ sudo apt-get install mysql-server-5.0
2. (optional) If you are running a server you should probably bind your address by editing bind-address in /etc/mysql/my.cnf and replacing its value (127.0.0.1) by your IP address
3. set your root password (although mysql should ask you about that when installing)
mysql> SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’xxxxxx’);
4. Try running it
mysql -uroot -pxxx
where xxx is your password.
Note: You can install PHPMyAdmin for a graphical user interface of MySQL by executing
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
5. restart apache for the last time
sudo /etc/init.d/apache2 restart
Congratulions your LAMP system is installed and running :D Happy Coding
1: To open PHPMYADMIN type just in your browser:
"http://localhost/phpmyadmin" - without quotes of course
2: To start, stop or restart APACHE2 - open terminal and type:
"apachectl start/stop/restart "
No comments:
Post a Comment