{"id":420,"date":"2013-06-14T14:06:49","date_gmt":"2013-06-14T08:36:49","guid":{"rendered":"http:\/\/prasadk.com\/my-press\/?p=420"},"modified":"2013-06-15T18:56:43","modified_gmt":"2013-06-15T13:26:43","slug":"install-apache-php-apc-mysql-on-amazon-ec2-with-amazon-linux-ami","status":"publish","type":"post","link":"https:\/\/www.prasadk.com\/my-press\/install-apache-php-apc-mysql-on-amazon-ec2-with-amazon-linux-ami\/","title":{"rendered":"Install Apache, PHP, APC, &#038; MySQL on Amazon EC2 with Amazon Linux AMI"},"content":{"rendered":"<p>The following guide is a step by step guide on installing and configuring Apache, PHP (with APC) &amp; MySQL (LAMP Stack) on an Amazon EC2 instance running Amazon Linux AMI.The procedure has been tested on Amazon Linux AMI<\/p>\n<h2><strong>1. Install Linux updates, set time zones, followed by GCC and Make<\/strong><\/h2>\n<pre>sudo yum -y update\r\nsudo ln -sf \/usr\/share\/zoneinfo\/America\/Indianapolis \\\r\n      \/etc\/localtime\r\nsudo yum install -y gcc make<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>2.\u00a0Install PHP and PHP extensions<\/strong><\/h2>\n<pre>sudo yum install -y php\r\nsudo yum install -y php-devel php-mysql php-pdo\r\nsudo yum install -y php-pear php-mbstring<\/pre>\n<pre>sudo pear install Log\r\nsudo yum install -y pcre-devel<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>3. Install Apache httpd<\/strong><\/h2>\n<pre>sudo yum -y install httpd\r\nsudo service httpd start<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>4. Install MySQL<\/strong><\/h2>\n<pre>sudo yum -y install mysql-server mysql\r\nsudo service mysqld start<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>5. Install PHP APC module<\/strong><\/h2>\n<pre>sudo yum -y install httpd-devel\r\nsudo pecl install apc-beta\r\necho \"extension=apc.so\" | sudo tee \/etc\/php.d\/apc.ini<\/pre>\n<h5><em>Or Simply:<\/em><\/h5>\n<pre>sudo yum install -y php-pecl-apc<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>6. MySQL Configuration<\/strong><\/h2>\n<pre>sudo vi \/etc\/my.cnf<\/pre>\n<pre>[mysqld]\r\n...\r\nskip-external-locking\r\nlong_query_time=1\r\nslow_query_log\r\nslow_query_log_file=\/var\/log\/log-slow-queries.log\r\nlog-bin=mysql-bin\r\nserver-id= 1\r\n...<\/pre>\n<pre>[mysqld_safe]\r\n...\r\nmyisam_recover_options\r\n...<\/pre>\n<pre>[mysqld]\r\n...\r\nkey_buffer_size = 128M\r\nmax_allowed_packet = 3M\r\ntable_open_cache = 64\r\nread_buffer_size = 2M\r\nread_rnd_buffer_size = 8M\r\nmyisam_sort_buffer_size = 16M\r\nthread_cache_size = 8\r\nquery_cache_size= 32M\r\nthread_concurrency = 8\r\ninnodb_buffer_pool_size = 128M\r\ninnodb_log_file_size = 32M\r\ninnodb_additional_mem_pool_size = 8M\r\ninnodb_log_buffer_size = 4M\r\n...<\/pre>\n<h5><em>Log Slow Queries:<\/em><\/h5>\n<pre>sudo touch \/var\/log\/log-slow-queries.log\r\nsudo chown mysql.mysql \/var\/log\/log-slow-queries.log<\/pre>\n<pre>sudo \/sbin\/chkconfig --levels 235 mysqld on\r\nsudo service mysqld start<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>7. PHP Configuration Changes in php.ini<\/strong><\/h2>\n<pre>sudo nano \/etc\/php.ini<\/pre>\n<pre>expose_php = Off\r\nmemory_limit = 128M\r\ndate.timezone = America\/Indianapolis<\/pre>\n<h5><em>Note: Location of error file<\/em><\/h5>\n<pre>\/var\/log\/httpd\/error.log<\/pre>\n<p>&nbsp;<\/p>\n<h2><strong>8. Auto Start Apache in EC2 Amazon Linux<\/strong><\/h2>\n<pre>sudo \/sbin\/chkconfig --levels 235 httpd on\r\nsudo service httpd start<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The following guide is a step by step guide on installing and configuring Apache, PHP (with APC) &amp; MySQL (LAMP Stack) on an Amazon EC2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0},"categories":[7],"tags":[17,22,18,20,21,19],"_links":{"self":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts\/420"}],"collection":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/comments?post=420"}],"version-history":[{"count":3,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts\/420\/revisions"}],"predecessor-version":[{"id":428,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/posts\/420\/revisions\/428"}],"wp:attachment":[{"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/media?parent=420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/categories?post=420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.prasadk.com\/my-press\/wp-json\/wp\/v2\/tags?post=420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}