{"id":4318,"date":"2018-02-01T20:25:24","date_gmt":"2018-02-01T20:25:24","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/02\/01\/how-to-install-lamp-stack-for-ubuntu\/"},"modified":"2021-08-16T22:28:35","modified_gmt":"2021-08-17T02:28:35","slug":"how-to-install-lamp-stack-for-ubuntu","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/","title":{"rendered":"How to Install LAMP Stack for Ubuntu"},"content":{"rendered":"<p>Follow the steps below in order to learn how to <strong>install a LAMP stack<\/strong> on a Cloud VPS using Ubuntu. We will be showing you the installation of the individual components that can be used to install the LAMP stack. These steps apply to Ubuntu versions 10 and higher.<\/p>\n<p class=\"alert alert-danger\">Note that all commands shown below require <a href=\"\/support\/amp\/obtain-root-access\/\">root access<\/a> on your server using SSH.<\/p>\n<h2>How to Install a LAMP Stack in Ubuntu<\/h2>\n<p>We will first explain how to install the individual modules installed in a LAMP. This will also provide the opportunity to make tuning adjustments and set security options that you may not often immediately address in the one-liner option for the installation.<\/p>\n<ol class=\"article_list\">\n<li>\n<p>So, first we&#8217;re going to make sure that everything is up-to-date, then we will install the Apache web server.<\/p>\n<p>\u00a0<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo apt-get update<\/span><\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo apt-get install apache2<\/span><\/p>\n<\/li>\n<li>\n<p>After the installation, we enable it and then start up the service with these commands:<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo systemctl enable apache2<\/span><\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo systemctl start apache2<\/span><\/p>\n<p>\u00a0<\/p>\n<p>You can then check the Apache browser:<\/p>\n<p>\u00a0<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\"><b>https:\/\/&lt;your_server_IP_address&gt;<\/b><\/span><\/p>\n<p>\u00a0<\/p>\n<p>You can find your server&#8217;s public IP with the following:<\/p>\n<p>\u00a0<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo apt-get install curl<\/span><\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">curl https:\/\/icanhazip.com<\/span><\/p>\n<p>\u00a0<\/p>\n<\/li>\n<li>\n<p>Next we&#8217;re going to install the MySQL server portion of the LAMP stack.<\/p>\n<p>\u00a0<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo apt-get install mysql-server<\/span><\/p>\n<\/li>\n<li>\n<p>After the installation you can set the root password for the MySQL installation with this command.<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">mysql_secure_installation<\/span><\/p>\n<p>\u00a0<\/p>\n<\/li>\n<li>\n<p>Finally, you need to install the &#8220;P&#8221; portion of the LAMP stack &#8211; PHP. Use the following instructions to install PHP.<\/p>\n<p>\u00a0<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql<\/span><\/p>\n<p>Restart Apache to get the PHP service started.<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo systemctl restart apache2<\/span><\/p>\n<p>After you restart the Apache web service, check the status of the web server to make sure that it&#8217;s running properly:<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo systemctl status apache2<\/span><\/p>\n<p>\u00a0<\/p>\n<\/li>\n<li>\n<p>Next, you need to test PHP in order to make sure that it is up and running. The easiest way to do this is to setup a <b>info.php<\/b> file. Then when you run the <b>info.php<\/b> file you will see the PHP configuration information.<\/p>\n<p>\u00a0<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">sudo nano \/var\/www\/html\/info.php<\/span><\/p>\n<p>\u00a0<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">&lt;?php phpinfo(); ?&gt;<\/span><\/p>\n<p>\u00a0<\/p>\n<p>Once you have entered the code into the text editor (nano), save the file and close Nano.<\/p>\n<\/li>\n<\/ol>\n<p>Next, you would enter the following line in order to see the PHP configuration page. You can verify the PHP installation with this page.<\/p>\n<p class=\"cli\"><span style=\"color: #00e000;\">https:\/\/&lt;your_server_IP_address&gt;\/info.php<\/span><\/p>\n<p>This completes the LAMP stack installation for Ubuntu.<\/p>\n\n\n<p>Learn more from our <a href=\"https:\/\/www.inmotionhosting.com\/support\/product-guides\/cloud-server\/\">Cloud Server Hosting Product Guide<\/a>.<\/p>\n\n\n<div class=\"jumbotron\"><p>Experience full control over your server environment and deploy the best operating and management systems that fit your needs with our reliable <a href=\"https:\/\/www.inmotionhosting.com\/cloud-vps\">Cloud VPS Hosting<\/a>!<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Follow the steps below in order to learn how to install a LAMP stack on a Cloud VPS using Ubuntu. We will be showing you the installation of the individual components that can be used to install the LAMP stack. These steps apply to Ubuntu versions 10 and higher. Note that all commands shown below<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\"> Read More ><\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4303],"tags":[],"class_list":["post-4318","post","type-post","status-publish","format-standard","hentry","category-amp"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install LAMP Stack for Ubuntu | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to install the LAMP stack for Ubunto on a Cloud VPS account.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install LAMP Stack for Ubuntu | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to install the LAMP stack for Ubunto on a Cloud VPS account.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-01T20:25:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-17T02:28:35+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/8d626175dd3b70ee90a172bdb09a460b\"},\"headline\":\"How to Install LAMP Stack for Ubuntu\",\"datePublished\":\"2018-02-01T20:25:24+00:00\",\"dateModified\":\"2021-08-17T02:28:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\"},\"wordCount\":432,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Account Management Panel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\",\"name\":\"How to Install LAMP Stack for Ubuntu | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2018-02-01T20:25:24+00:00\",\"dateModified\":\"2021-08-17T02:28:35+00:00\",\"description\":\"Learn how to install the LAMP stack for Ubunto on a Cloud VPS account.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install LAMP Stack for Ubuntu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/8d626175dd3b70ee90a172bdb09a460b\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/arn\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install LAMP Stack for Ubuntu | InMotion Hosting","description":"Learn how to install the LAMP stack for Ubunto on a Cloud VPS account.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/","og_locale":"en_US","og_type":"article","og_title":"How to Install LAMP Stack for Ubuntu | InMotion Hosting","og_description":"Learn how to install the LAMP stack for Ubunto on a Cloud VPS account.","og_url":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-02-01T20:25:24+00:00","article_modified_time":"2021-08-17T02:28:35+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/8d626175dd3b70ee90a172bdb09a460b"},"headline":"How to Install LAMP Stack for Ubuntu","datePublished":"2018-02-01T20:25:24+00:00","dateModified":"2021-08-17T02:28:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/"},"wordCount":432,"commentCount":2,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Account Management Panel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/","url":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/","name":"How to Install LAMP Stack for Ubuntu | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2018-02-01T20:25:24+00:00","dateModified":"2021-08-17T02:28:35+00:00","description":"Learn how to install the LAMP stack for Ubunto on a Cloud VPS account.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/amp\/how-to-install-lamp-stack-for-ubuntu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Install LAMP Stack for Ubuntu"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/8d626175dd3b70ee90a172bdb09a460b","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/arn\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4318"}],"version-history":[{"count":5,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4318\/revisions"}],"predecessor-version":[{"id":83777,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4318\/revisions\/83777"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}