{"id":58,"date":"2011-10-29T06:53:02","date_gmt":"2011-10-29T06:53:02","guid":{"rendered":"http:\/\/rat32.com\/rat32\/?p=58"},"modified":"2013-10-11T03:42:10","modified_gmt":"2013-10-11T03:42:10","slug":"58","status":"publish","type":"post","link":"https:\/\/rat32.com\/rat32\/2011\/10\/29\/58\/","title":{"rendered":"Easiest way to install LAMP On Ubuntu"},"content":{"rendered":"<p>For a beginner its really a difficult to install LAMP on Ubuntu. Even if it is installed its very difficult to run phpmyadmin properly.<br \/>\nI am going to share my personal experience and difficulties we may encounter during installation.<br \/>\nFirst of all we are going to install apache, php, mysql and phpmyadmin<br \/>\n<strong>A) Installing Apache<\/strong><br \/>\n<strong>B) Installing Php<\/strong><br \/>\n<strong>C) Installing Mysql<\/strong><br \/>\n<strong>D) Installing Phpmyadmin<\/strong><\/p>\n<p><strong>A) Installing Apache<\/strong><br \/>\n1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo apt-get install apache2\n<\/div>\n<p>2. The Terminal might ask you for your password, type your password and then press enter.<br \/>\n3. Testing: Run http:\/\/localhost\/ url in your browser. If you get a message &#8220;It works!&#8221; then Apache is sucessfully installed.<\/p>\n<p><strong>B) Installing Php<\/strong><br \/>\n1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo apt-get install php5 libapache2-mod-php5\n<\/div>\n<p>2. The Terminal might ask you for your password, type your password and then press enter.<br \/>\n3. Restart apache by runing this code to make Php compatible with Apache.<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo \/etc\/init.d\/apache2 restart\n<\/div>\n<p>4. Testing PHP<br \/>\n\ti.   In the terminal copy\/paste the following line:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t\tsudo gedit \/var\/www\/testingphp.php\n<\/div>\n<p>\tii.  Copy and Paste following line code into the testingphp file:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t\t< ? php echo \"Hello World!!!\"; ?>\n<\/div>\n<p>\tiii. Save the file.<br \/>\n\tiv.  Run http:\/\/localhost\/testingphp.php in your browser. If it displays &#8216;Hello World!!!&#8217; then PHP is alswo sucessfully installed.<\/p>\n<p><strong>C) Installing Mysql<\/strong><br \/>\n1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo apt-get install mysql-server\n<\/div>\n<p>2. If you need to give access to the server you have created for others computer in your network you must edit the my.cnf file.<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tgksudo gedit \/etc\/mysql\/my.cnf\n<\/div>\n<p>  Modify the line <\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tbind-address = 127.0.0.1\n<\/div>\n<p>  to<br \/>\n\tChange  127.0.0.1 to your IP address (eg 192.168.0.1)<br \/>\n\t(Note you can skip this step)<br \/>\n3. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t mysql -u root\n<\/div>\n<p>\tIf you get Following error message<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black;padding: 1em;height:70px\">\n\t\t&#8220;ERROR-ERROR 1045 (28000): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217; (using password: NO)<br \/>\n\t\tCOMMAND:mysql> SET PASSWORD FOR &#8216;root&#8217;@&#8217;localhost&#8217; = PASSWORD(&#8216;yourpassword&#8217;);<br \/>\n\t\tERROR:mysql> SET PASSWORD FOR &#8216;root&#8217;@&#8217;localhost&#8217; = PASSWORD(&#8216;yourpassword&#8217;);&#8221;\n<\/div>\n<p>\tthen run <\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\nmysql -u root\n<\/div>\n<p>4. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo gedit \/etc\/apache2\/apache2.conf\n<\/div>\n<p>\tAdd the following line of code inside apache2.conf file:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t\tInclude \/etc\/phpmyadmin\/apache.conf\n<\/div>\n<p>\tand restart Apache:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo \/etc\/init.d\/apache2 restart\n<\/div>\n<p>5. Now copy and paste this line in your terminal:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tmysql> SET PASSWORD FOR &#8216;root&#8217;@&#8217;localhost&#8217; = PASSWORD(&#8216;yourpassword&#8217;);\n<\/div>\n<p>Note: You can change password of your choice. But if you wish to work without your password then you should modify \/etc\/phpmyadmin\/config.inc.php file<br \/>\n\ti. Run the following code in your terminal<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t\tsudo gedit \/etc\/phpmyadmin\/config.inc.php\n<\/div>\n<p>\t2. Change<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t\t\/\/$cfg[&#8216;Servers&#8217;][$i][&#8216;AllowNoPassword&#8217;] = TRUE;\n<\/div>\n<p> line to<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t\t$cfg[&#8216;Servers&#8217;][$i][&#8216;AllowNoPassword&#8217;] = TRUE;\n<\/div>\n<p><strong>D. Installing Phpmyadmin<\/strong><br \/>\n1. Open up the Terminal (Applications > Accessories > Terminal) and run the following line of code:<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin\n<\/div>\n<p>2. Edit php.ini file by running following code in your terminal<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tgksudo gedit \/etc\/php5\/apache2\/php.ini\n<\/div>\n<p>   Change<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\t;extension=mysql.so\n<\/div>\n<p>   to<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\textension=mysql.so\n<\/div>\n<p>   If you dont find ;extension=mysql.so then skip it uncomment other mysql lines eg.<\/p>\n<p>3. Run following code in your terminal to restart apache<\/p>\n<div style=\"background-color: #F9F9F9;font-style:italic;font-size:14px;margin-left:20px;margin-top:20px;margin-bottom:20px;border: 1px dashed #2F6FAB;color: black; line-height: .1em;padding: 1em;\">\n\tsudo \/etc\/init.d\/apache2 restart\n<\/div>\n<p>4. Testing: Run http:\/\/localhost\/phpmyadmin in your browser if you get window of phpmyadmin then you might be asked with username and password.<br \/>\n\tUsername: root<br \/>\n\tPassword:      (If you had set password from step C.5. then enter that password or leave it empty)<br \/>\n   If you get login then congrats. Now you have got installed all Apache, PHP, Mysql and Phpmyadmin.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>For a beginner its really a difficult to install LAMP on Ubuntu. Even if it is installed its very difficult to run phpmyadmin properly. I am going to share my personal experience and difficulties&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-58","post","type-post","status-publish","format-standard","hentry","category-ubuntu-2"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/58"}],"collection":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/comments?post=58"}],"version-history":[{"count":18,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/58\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/media?parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/categories?post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/tags?post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}