{"id":54,"date":"2016-05-06T09:19:09","date_gmt":"2016-05-06T09:19:09","guid":{"rendered":"http:\/\/symbioticindia.in\/docu\/?p=54"},"modified":"2016-06-27T17:53:51","modified_gmt":"2016-06-27T17:53:51","slug":"how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-x","status":"publish","type":"post","link":"http:\/\/symbioticindia.in\/docu\/2016\/05\/06\/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-x\/","title":{"rendered":"How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.x"},"content":{"rendered":"<h3>About LAMP<\/h3>\n<p>LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here is how to install the rest.<\/p>\n<div data-unique=\"set-up\"><\/div>\n<h2>Set Up<\/h2>\n<p>The steps in this tutorial require the user to have root privileges on your VPS. You can see how to set that up in the <a href=\"https:\/\/www.digitalocean.com\/community\/articles\/initial-server-setup-with-ubuntu-12-04\">Initial Server Setup<\/a> in steps 3 and 4.<\/p>\n<div data-unique=\"step-1-install-apache\"><\/div>\n<h2>Step 1: Install Apache<\/h2>\n<p>Apache is a free open source software which runs over 50% of the world\u2019s web servers.<\/p>\n<p>To install apache, open terminal and type in these commands:<\/p>\n<pre>sudo apt-get update\r\nsudo apt-get install apache2<\/pre>\n<p>That\u2019s it. To check if Apache is installed, direct your browser to your server\u2019s IP address (eg. http:\/\/12.34.56.789). The page should display the words \u201cIt works!&#8221; like <a href=\"https:\/\/assets.digitalocean.com\/tutorial_images\/333VJ.png\">this<\/a>.<\/p>\n<h3>How to Find your Server\u2019s IP address<\/h3>\n<p>You can run the following command to reveal your server\u2019s IP address.<\/p>\n<pre>ifconfig eth0 | grep inet | awk '{ print $2 }'<\/pre>\n<div data-unique=\"step-2-install-mysql\"><\/div>\n<h2>Step 2: Install MySQL<\/h2>\n<p>MySQL is a powerful database management system used for organizing and retrieving data<\/p>\n<p>To install MySQL, open terminal and type in these commands:<\/p>\n<pre>sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql<\/pre>\n<p>During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.<\/p>\n<p>Once you have installed MySQL, we should activate it with this command:<\/p>\n<pre>sudo mysql_install_db<\/pre>\n<p>Finish up by running the MySQL set up script:<\/p>\n<pre>sudo \/usr\/bin\/mysql_secure_installation<\/pre>\n<p>The prompt will ask you for your current root password.<\/p>\n<p>Type it in.<\/p>\n<pre>Enter current password for root (enter for none): \r\n\r\nOK, successfully used password, moving on...<\/pre>\n<p>Then the prompt will ask you if you want to change the root password. Go ahead and choose N and move on to the next steps.<\/p>\n<p>It\u2019s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.<\/p>\n<pre>By default, a MySQL installation has an anonymous user, allowing anyone\r\nto log into MySQL without having to have a user account created for\r\nthem.  This is intended only for testing, and to make the installation\r\ngo a bit smoother.  You should remove them before moving into a\r\nproduction environment.\r\n\r\nRemove anonymous users? [Y\/n] y                                            \r\n ... Success!\r\n\r\nNormally, root should only be allowed to connect from 'localhost'.  This\r\nensures that someone cannot guess at the root password from the network.\r\n\r\nDisallow root login remotely? [Y\/n] y\r\n... Success!\r\n\r\nBy default, MySQL comes with a database named 'test' that anyone can\r\naccess.  This is also intended only for testing, and should be removed\r\nbefore moving into a production environment.\r\n\r\nRemove test database and access to it? [Y\/n] y\r\n - Dropping test database...\r\n ... Success!\r\n - Removing privileges on test database...\r\n ... Success!\r\n\r\nReloading the privilege tables will ensure that all changes made so far\r\nwill take effect immediately.\r\n\r\nReload privilege tables now? [Y\/n] y\r\n ... Success!\r\n\r\nCleaning up...<\/pre>\n<p>Once you&#8217;re done with that you can finish up by installing PHP.<\/p>\n<div data-unique=\"step-3-install-php\"><\/div>\n<h2>Step 3: Install PHP<\/h2>\n<p>PHP is an open source web scripting language that is widely use to build dynamic webpages.<\/p>\n<p>To install PHP, open terminal and type in this command.<\/p>\n<pre>sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt<\/pre>\n<p>After you answer yes to the prompt twice, PHP will install itself.<\/p>\n<p>It may also be useful to add php to the directory index, to serve the relevant php index files:<\/p>\n<pre>sudo nano \/etc\/apache2\/mods-enabled\/dir.conf<\/pre>\n<p>Add index.php to the beginning of index files. The page should now look like this:<\/p>\n<pre>&lt;IfModule mod_dir.c&gt;\r\n\r\n          DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm\r\n\r\n&lt;\/IfModule&gt;<\/pre>\n<div data-unique=\"php-modules\"><\/div>\n<h2>PHP Modules<\/h2>\n<p>PHP also has a variety of useful libraries and modules that you can add onto your virtual server. You can see the libraries that are available.<\/p>\n<pre>apt-cache search php5-<\/pre>\n<p>Terminal will then display the list of possible modules. The beginning looks like this:<\/p>\n<pre>php5-cgi - server-side, HTML-embedded scripting language (CGI binary)\r\nphp5-cli - command-line interpreter for the php5 scripting language\r\nphp5-common - Common files for packages built from the php5 source\r\nphp5-curl - CURL module for php5\r\nphp5-dbg - Debug symbols for PHP5\r\nphp5-dev - Files for PHP5 module development\r\nphp5-gd - GD module for php5\r\nphp5-gmp - GMP module for php5\r\nphp5-ldap - LDAP module for php5\r\nphp5-mysql - MySQL module for php5\r\nphp5-odbc - ODBC module for php5\r\nphp5-pgsql - PostgreSQL module for php5\r\nphp5-pspell - pspell module for php5\r\nphp5-recode - recode module for php5\r\nphp5-snmp - SNMP module for php5\r\nphp5-sqlite - SQLite module for php5\r\nphp5-tidy - tidy module for php5\r\nphp5-xmlrpc - XML-RPC module for php5\r\nphp5-xsl - XSL module for php5\r\nphp5-adodb - Extension optimising the ADOdb database abstraction library\r\nphp5-auth-pam - A PHP5 extension for PAM authentication\r\n[...]<\/pre>\n<p>Once you decide to install the module, type:<\/p>\n<pre>sudo apt-get install <i>name of the module<\/i><\/pre>\n<p>You can install multiple libraries at once by separating the name of each module with a space.<\/p>\n<p>Congratulations! You now have LAMP stack on your droplet!<\/p>\n<div data-unique=\"step-4-results-\u2014-see-php-on-your-server\"><\/div>\n<h2>Step 4: RESULTS \u2014 See PHP on your Server<\/h2>\n<p>Although LAMP is installed, we can still take a look and see the components online by creating a quick php info page<\/p>\n<p>To set this up, first create a new file:<\/p>\n<pre>sudo nano \/var\/www\/info.php<\/pre>\n<p>Add in the following line:<\/p>\n<pre>&lt;?php\r\nphpinfo();\r\n?&gt;<\/pre>\n<p>Then Save and Exit.<\/p>\n<p>Restart apache so that all of the changes take effect:<\/p>\n<pre>sudo service apache2 restart<\/pre>\n<p>Finish up by visiting your php info page (make sure you replace the example ip address with your correct one): http:\/\/12.34.56.789\/info.php<\/p>\n","protected":false},"excerpt":{"rendered":"<p>About LAMP LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here is how to install the rest. Set Up The steps ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"http:\/\/symbioticindia.in\/docu\/2016\/05\/06\/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-x\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,6],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-mysql","category-php"],"_links":{"self":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":1,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/54\/revisions"}],"predecessor-version":[{"id":55,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/posts\/54\/revisions\/55"}],"wp:attachment":[{"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/symbioticindia.in\/docu\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}