{"id":2462,"date":"2016-01-19T13:54:38","date_gmt":"2016-01-19T13:54:38","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=2462"},"modified":"2023-08-03T08:19:12","modified_gmt":"2023-08-03T07:19:12","slug":"lamp-on-centos-6","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/","title":{"rendered":"LAMP On CentOS 6"},"content":{"rendered":"<p><strong>LAMP<\/strong> stands for a Linux, Apache, MySQL and PHP. If you wish to host a website on your own Virtual Private Server, you will need to install LAMP.<\/p>\n<p>1. <strong>Linux<\/strong> &#8211; Linux is a Operating System using which you will be able to access your server and manage the applications over it.<br \/>\n2. <strong>Apache<\/strong> &#8211; Apache is a web server supported on Linux and Windows both. Using the web server you can service the web requests over the internet.<br \/>\n3. <strong>MySQL<\/strong> &#8211; MySQL is a open source Relation Database Management System (RDBMS). MySQL is the widely used database over the internet.<br \/>\n4. <strong>PHP<\/strong> &#8211; PHP is a server-side scripting language using which you can develop your website, applications, portal, etc. It is Open Source and used widely by many CMS and applications.<\/p>\n<h3><strong>Requirements<\/strong><\/h3>\n<p>You should have a virtual private server OR a physical server also called as dedicated server with root privileges. The server should be connected to internet and should be accessible via SSH.<\/p>\n<p>Make sure <a title=\"Set Server Hostname\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-change-servers-hostname-on-linux-centos\/\" target=\"_blank\" rel=\"noopener\">hostname<\/a> is set to the server. You can check the server&#8217;s hostname with command<\/p>\n<blockquote><p># hostname<\/p><\/blockquote>\n<h3><strong>Install Apache &amp; Configure<\/strong><\/h3>\n<p>To install apache2, use the command. Type y (yes) &amp; proceed with the installation.<\/p>\n<blockquote><p># yum install httpd<\/p><\/blockquote>\n<p>Once installed, start apache &amp; add it to chkconfig. This will ensure that the service starts even after server reboots.<\/p>\n<blockquote><p># service httpd start<\/p>\n<p># chkconfig httpd on<\/p><\/blockquote>\n<p>Now, try browsing the server IP &amp; it should show Apache 2 test page. You can locate your server IP with any of the command below.<\/p>\n<blockquote><p># ifconfig<\/p>\n<p># lynx -dump cPanel.net\/showip.cgi<\/p><\/blockquote>\n<p>Now let&#8217;s configure apache for the optimum performance. The apache tweak that we will perform will be suitable for VPS with 512MB to 1GB RAM. The values can be raised as and when the CPU and Memory is increased.<\/p>\n<p>Let&#8217;s backup the apache configuration file before making any changes. The best practice is to backup config files just in case anything goes wrong OR if you wish to revert the changes.<\/p>\n<blockquote><p># cp \/etc\/httpd\/conf\/httpd.conf \/root\/httpd.conf.backup<\/p><\/blockquote>\n<p>Open the config files and adjust the entries as below. These can be adjusted depending on the websites you wish to host &amp; the number of visitors on your website.<\/p>\n<blockquote><p>KeepAlive On<br \/>\n&lt;IfModule prefork.c&gt;<br \/>\nStartServers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2<br \/>\nMinSpareServers&nbsp;&nbsp;&nbsp;&nbsp; 6<br \/>\nMaxSpareServers&nbsp;&nbsp;&nbsp;&nbsp; 10<br \/>\nMaxClients&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100<br \/>\nMaxRequestsPerChild 3000<br \/>\n&lt;\/IfModule&gt;<\/p><\/blockquote>\n<p>Save the file and exit. Restart apache with command<\/p>\n<blockquote><p>service httpd restart<\/p><\/blockquote>\n<h3><strong>Configure VirtualHost In Apache<\/strong><\/h3>\n<p>You can configure apache depending on your needs. We will see how to configure apache for your first domain yourdomain.com. When installed, apache listens on all the IP&#8217;s assigned\/added on your server.<\/p>\n<p>Create a file under <strong>\/etc\/httpd\/conf.d<\/strong> named <strong>vhost.conf<\/strong>. Enter the contents below are replace yourdomain.com with your actual domain name.<\/p>\n<blockquote><p>NameVirtualHost *:80<\/p>\n<p>&lt;VirtualHost *:80&gt;<br \/>\nServerAdmin webmaster@yourdomain.com<br \/>\nServerName yourdomain.com<br \/>\nServerAlias www.yourdomain.com<br \/>\nDocumentRoot \/var\/www\/yourdomain.com\/public_html\/<br \/>\nErrorLog \/var\/www\/yourdomain.com\/logs\/error.log<br \/>\nCustomLog \/var\/www\/yourdomain.com\/logs\/access.log combined<br \/>\n&lt;\/VirtualHost&gt;<\/p><\/blockquote>\n<p>If you wish to host multiple websites on the same server, you can add the code in this same file as and when required.<\/p>\n<p>Let&#8217;s create the directories which are called\/used in your VirtualHost entry. Then restart apache without fail.<\/p>\n<blockquote><p># mkdir -p \/var\/www\/yourdomain.com\/public_html<\/p>\n<p># mkdir \/var\/www\/yourdomain.com\/logs<\/p>\n<p># service httpd restart<\/p><\/blockquote>\n<p>A default page will appear when you access yourdomain.com. If in case you make any changes to the vhost.conf file, make sure you restart OR reload httpd service without fail. Simply, replace restart with reload if you wish to reload httpd service.<\/p>\n<h3><strong>Install and Configure MySQL<\/strong><\/h3>\n<p>With yum install MySQL package\/rpm.<\/p>\n<blockquote><p># yum install mysql-server -y<\/p><\/blockquote>\n<p>Start the installed MySQL service and configure it so that MySQL starts at boot.<\/p>\n<blockquote><p># service mysqld start<\/p>\n<p># chkconfig mysqld on<\/p><\/blockquote>\n<p>Execute the command below which will secure MySQL. It will allow you to <strong>Set a root Password, Remove anonymous users, Disallow root login remotely, Remove test database and access to it, Reload privilege tables now.<\/strong><\/p>\n<blockquote><p># mysql_secure_installation<\/p><\/blockquote>\n<p><strong>Create MySQL Database<\/strong><\/p>\n<p>Login to your MySQL command prompt. It will ask you to enter the root password. Enter the root password when asked for.<\/p>\n<blockquote><p># mysql -u root -p<\/p><\/blockquote>\n<p>Create MySQL database and assign MySQL user.<\/p>\n<blockquote><p># create database dbname;<\/p>\n<p># grant all on dbname.* to &#8216;mysqluser&#8217; identified by &#8216;password&#8217;;<\/p><\/blockquote>\n<p><strong>Note <\/strong>Replace dbname, mysqluser &amp; password with the actual details that you wish to use. password should be alpha numeric &amp; strong. Avoid dictionary words when assigning a password.<\/p>\n<p>Exit MySQL command prompt by hitting <strong>Ctrl + d<\/strong> OR with <strong>quit<\/strong> command.<\/p>\n<h3><strong>Install and Configure PHP<\/strong><\/h3>\n<p>With yum install PHP package\/rpm.<\/p>\n<blockquote><p># yum install php php-pear php-mysql -y<\/p><\/blockquote>\n<p>The command will required PHP modules with MySQL support. php-mysql is required if you wish to connect the database using connection string in PHP.<\/p>\n<p>Let&#8217;s configure error reporting for logs being polled. Error logs are required when you are in the process to develop a website, portal, CMS, blog, etc.<\/p>\n<p>Open \/etc\/php.ini and modify the values as below.<\/p>\n<blockquote><p>error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR<br \/>\nerror_log = \/var\/log\/php\/error.log<\/p><\/blockquote>\n<p>Make sure to create the php directory so that error logs can be polled.<\/p>\n<blockquote><p># mkdir \/var\/log\/php<\/p>\n<p># chown apache.apache \/var\/log\/php -R<\/p><\/blockquote>\n<p>You can even modify <strong>upload_max_filesize, max_execution_time, disable_functions<\/strong>, etc depending on your requirement.<\/p>\n<blockquote><p># service httpd restart<\/p><\/blockquote>\n<p>Restart apache service whenever you commit changes in \/etc\/php.ini file.<\/p>\n<p><strong>You can adjust\/add the values that we have mentioned depending on your server configuration, type of website that you wish to host.<\/strong> Feel free to initiate a chat with our technician if you wish to discuss more about configuring LAMP on your server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LAMP stands for a Linux, Apache, MySQL and PHP. If you wish to host a website on your own Virtual Private Server, you will need to install LAMP. 1. Linux &#8211; Linux is a Operating System using which you will be able to access your server and manage the applications over it. 2. Apache &#8211; [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-2462","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LAMP On CentOS 6<\/title>\n<meta name=\"description\" content=\"Learn how to install and configure LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 6 with this comprehensive guide. Follow step-by-step instructions to set up a powerful web server environment, enabling seamless hosting of dynamic websites.\" \/>\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.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LAMP On CentOS 6\" \/>\n<meta property=\"og:description\" content=\"Learn how to install and configure LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 6 with this comprehensive guide. Follow step-by-step instructions to set up a powerful web server environment, enabling seamless hosting of dynamic websites.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2016-01-19T13:54:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-03T07:19:12+00:00\" \/>\n<meta name=\"author\" content=\"Chinmay Dingore\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chinmay Dingore\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/\",\"name\":\"LAMP On CentOS 6\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"datePublished\":\"2016-01-19T13:54:38+00:00\",\"dateModified\":\"2023-08-03T07:19:12+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dede1f85ff210bb6edccd736a1dfa256\"},\"description\":\"Learn how to install and configure LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 6 with this comprehensive guide. Follow step-by-step instructions to set up a powerful web server environment, enabling seamless hosting of dynamic websites.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LAMP On CentOS 6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dede1f85ff210bb6edccd736a1dfa256\",\"name\":\"Chinmay Dingore\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0d0115bf9737e455dd489276ed81b139?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0d0115bf9737e455dd489276ed81b139?s=96&d=blank&r=g\",\"caption\":\"Chinmay Dingore\"},\"description\":\"With over 10+ years of experience in the web hosting industry, I have achieved extensive exposure to result-oriented methodologies. And expertise in different domains like Datacentre Services, Cloud computing technology, Web hosting industry and many more.\",\"sameAs\":[\"https:\/\/www.milesweb.co.uk\/\"],\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/chinmay\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LAMP On CentOS 6","description":"Learn how to install and configure LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 6 with this comprehensive guide. Follow step-by-step instructions to set up a powerful web server environment, enabling seamless hosting of dynamic websites.","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.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/","og_locale":"en_GB","og_type":"article","og_title":"LAMP On CentOS 6","og_description":"Learn how to install and configure LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 6 with this comprehensive guide. Follow step-by-step instructions to set up a powerful web server environment, enabling seamless hosting of dynamic websites.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2016-01-19T13:54:38+00:00","article_modified_time":"2023-08-03T07:19:12+00:00","author":"Chinmay Dingore","twitter_misc":{"Written by":"Chinmay Dingore","Estimated reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/","name":"LAMP On CentOS 6","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"datePublished":"2016-01-19T13:54:38+00:00","dateModified":"2023-08-03T07:19:12+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dede1f85ff210bb6edccd736a1dfa256"},"description":"Learn how to install and configure LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 6 with this comprehensive guide. Follow step-by-step instructions to set up a powerful web server environment, enabling seamless hosting of dynamic websites.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/lamp-on-centos-6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"LAMP On CentOS 6"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dede1f85ff210bb6edccd736a1dfa256","name":"Chinmay Dingore","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0d0115bf9737e455dd489276ed81b139?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0d0115bf9737e455dd489276ed81b139?s=96&d=blank&r=g","caption":"Chinmay Dingore"},"description":"With over 10+ years of experience in the web hosting industry, I have achieved extensive exposure to result-oriented methodologies. And expertise in different domains like Datacentre Services, Cloud computing technology, Web hosting industry and many more.","sameAs":["https:\/\/www.milesweb.co.uk\/"],"url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/chinmay\/"}]}},"views":1266,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/2462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=2462"}],"version-history":[{"count":12,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/2462\/revisions"}],"predecessor-version":[{"id":14940,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/2462\/revisions\/14940"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=2462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=2462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=2462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}