{"id":1101,"date":"2020-08-21T16:14:22","date_gmt":"2020-08-21T16:14:22","guid":{"rendered":"https:\/\/hostingspell.com\/blog\/?p=1101"},"modified":"2020-08-21T16:14:22","modified_gmt":"2020-08-21T16:14:22","slug":"how-to-install-lamp-server-on-ubuntu","status":"publish","type":"post","link":"https:\/\/blog.hostingspell.com\/how-to-install-lamp-server-on-ubuntu\/","title":{"rendered":"How to &#8211; Install LAMP server on Ubuntu"},"content":{"rendered":"\n<p style=\"color:#147ba8\" class=\"has-text-color wp-block-paragraph\">LAMP Stack is a group of open-source software that set your servers up and running. LAMP stands for Linux, Apache, MySQL and PHP.<\/p>\n\n\n\n<p style=\"color:#1c80ab\" class=\"has-text-color wp-block-paragraph\">The VPS is already running Ubuntu, so the Linux part of the acronym is taken care of!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now let\u2019s move on to installing the <em>AMP<\/em> part of LAMP!<\/p>\n\n\n\n<p class=\"has-text-color has-theme-primary-color wp-block-paragraph\"><em>Requirements \u2013 you should have root privileges on your VPS.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>INSTALLING APACHE<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apache is free open software. Almost all the world\u2019s web servers run on apache.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open terminal and type in the below commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update\nsudo apt-get install apache2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You are done! To make sure Apache is installed, just direct your browser to the IP address of your server. The page will show the words \u2018<strong>It works!\u2019.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command to find your servers IP address<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ifconfig eth0 | grep inet | awk '{ print $2 }'<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>INSTALLING MySQL<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL is a database management system. It organizes and retrieves data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1. <\/strong>Enter the following command in the terminal to install Mysql<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL will ask you to set a root password. In case you miss this while installation, you can always set it later within the MySQL shell.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Activate mysql with this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql_install_db<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Clean up by the MySQL set up script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/usr\/bin\/mysql_secure_installation<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A prompt will ask you for your current root password. Type your password in.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enter current password for root (enter for none): <\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">OK, successfully used password, moving on...<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The prompt will ask you if you want to change the password, choose <strong>n <\/strong>and move on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the further prompt steps, it is easier to choose the yes option. Go ahead and choose <strong>y. <\/strong>Mysql will take care of the new changes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">By default, a MySQL installation has an anonymous user, allowing anyone<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">to log into MySQL without having to have a user account created for<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">them.&nbsp; This is intended only for testing, and to make the installation<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">go a bit smoother.&nbsp; You should remove them before moving into a<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">production environment.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Remove anonymous users? [Y\/n] y&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">&nbsp;... Success!<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Normally, root should only be allowed to connect from 'localhost'.&nbsp; This<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">ensures that someone cannot guess at the root password from the network.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Disallow root login remotely? [Y\/n] y<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">... Success!<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">By default, MySQL comes with a database named 'test' that anyone can<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">access.&nbsp; This is also intended only for testing, and should be removed<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">before moving into a production environment.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Remove test database and access to it? [Y\/n] y<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"> - Dropping test database...<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"> ... Success!<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"> - Removing privileges on test database...<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"> ... Success!<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Reloading the privilege tables will ensure that all changes made so far<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">will take effect immediately.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Reload privilege tables now? [Y\/n] y<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"> ... Success!<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Cleaning up...<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Now we can move onto installing PHP<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>INSTALLING PHP<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">So, PHP is an open-source web scripting language. It is used to create and build dynamic webpages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1. <\/strong>Type in this command to install PHP:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The prompt will ask you to confirm the installation twice, just answer yes. And the PHP will be installed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is really helpful to add PHP to the directory index :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/apache2\/mods-enabled\/dir.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After adding index.php to the beginning of your index files, the page should look like this ;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;IfModule mod_dir.c&gt;<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;\/IfModule&gt;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Yay! You have successfully installed the LAMP stack on Ubuntu<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">The end&#8230;<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Too make sure your components are online, create a php info page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For this, create a new file :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/var\/www\/info.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And add the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nphpinfo();\n?&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, save and exit!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the effects to take place, restart Apache :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo service apache2 restart<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-theme-primary-color wp-block-paragraph\"><em>Note \u2013 make sure you replace the example IP address with your IP address.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Conclude the adventure by visiting you PHP info page!<\/p>\n\n\n\n<p style=\"color:#2a990e\" class=\"has-text-color wp-block-paragraph\"><em>Found this article helpful? Let us know!<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>LAMP Stack is a group of open-source software that set your servers up and running. LAMP stands for Linux, Apache, MySQL and PHP. The VPS is already running Ubuntu, so the Linux part of the acronym is taken care of! Now let\u2019s move on to installing the AMP part of LAMP! Requirements \u2013 you should [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1101","post","type-post","status-publish","format-standard","category-general","entry"],"featured_image_src":null,"featured_image_src_square":null,"author_info":{"display_name":"Nikitha S.","author_link":"https:\/\/blog.hostingspell.com\/author\/nikitha\/"},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"single-featured-image":false,"blog-featured-image":false,"home-featured":false,"ab-block-post-grid-landscape":false,"ab-block-post-grid-square":false,"author-pro-image":false,"gb-block-post-grid-landscape":false,"gb-block-post-grid-square":false},"uagb_author_info":{"display_name":"Nikitha S.","author_link":"https:\/\/blog.hostingspell.com\/author\/nikitha\/"},"uagb_comment_info":0,"uagb_excerpt":"LAMP Stack is a group of open-source software that set your servers up and running. LAMP stands for Linux, Apache, MySQL and PHP. The VPS is already running Ubuntu, so the Linux part of the acronym is taken care of! Now let\u2019s move on to installing the AMP part of LAMP! Requirements \u2013 you should&hellip;","_links":{"self":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/posts\/1101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/comments?post=1101"}],"version-history":[{"count":0,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/posts\/1101\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/media?parent=1101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/categories?post=1101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hostingspell.com\/wp-json\/wp\/v2\/tags?post=1101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}