The t1.micro instance comes with only 602MB of memory. Especially under high load, it is quite easy to deplete the available memory – and since no swap space is enabled by default, this can quickly lead to a server becoming unresponsive. Swap space can also allow the kernel to move unused data out of memory,… Continue reading Adding Swap Space to an EC2 Instance
Category: Computers
Things dealing with the wonderful world of IT – software, hardware, cloud computing, or anything else that might fit.
Shrink EBS Root
My EC2 instances are setup to have only the operating system and program files on the root volume, with all other data (logs, mail, etc.) on a second EBS volume. This leads to a very stable root volume, which sees a minimum of changes. Fully configured, my root volume (using Amazon’s Linux) is 1.2GB. The… Continue reading Shrink EBS Root
Capturing Termination Signals in PHP
Consider the scenario of a PHP script which can be run for a period of time, stopped, and continue its task later on. A common necessity for such a script may be to detect when the script is terminated, and perform some functions at that time. This can be accomplished by having the script capture… Continue reading Capturing Termination Signals in PHP
Installing ApacheBench without Apache on Amazon’s Linux
Having recently switched to a setup with only nginx (and no apache), I found myself wanting to run some tests. As nice as siege is, I rather like ApacheBench (ab). However, I really didn’t want to install all of Apache just to get ab. Quick and Easy Way On Amazon’s Linux, the ab binary can… Continue reading Installing ApacheBench without Apache on Amazon’s Linux
Missing mail command on Amazon’s Linux
I recently noticed that the mail command is not available by default on the latest version of Amazon’s Linux AMI (v2011.09). This functionality is available in the mailx package, which can be installed with the following: yum install mailx
Connect to Amazon’s Linux via WinSCP as root
SCP offers a number of advantages over FTP, not the least of which include no setup (you don’t need an FTP server) and increased security. However, when setting up a server, it can be rather inconvenient to be unable to save a file to most directories. The simplest solution, really, is to just upload the… Continue reading Connect to Amazon’s Linux via WinSCP as root
Starting Varnish – Amazon’s Linux
I decided to install the new version of Varnish (3.0.1) using the Varnish repository (instead of amzn repository). The installation progressed without issue (you do need to override the default priorities of the repositories though), however, I ran into an issue trying to start Varnish. Every time I tried to start Varnish I would simply… Continue reading Starting Varnish – Amazon’s Linux
Showing the Firebug icon
While it is easy enough to use F12 to display Firebug in Firefox, I just like the status bar icon. Unfortunately, it has been hidden in the last few releases of Firebug. To display it, open about:config, and set extensions.firebug.showStatusIcon to true.
Building an Nginx RPM on Amazon’s Linux
If no customizations are desired, a far simpler way to get the RPM, than that outlined below, is to use the nginx repository, available from nginx’s download page. After deciding to change my server stack today (based on Amazon’s Linux), I noted that, despite the current version of Amazon’s Linux being hardly a few days… Continue reading Building an Nginx RPM on Amazon’s Linux
Upgrading Amazon’s Linux
Today, after looking over the changes in the new version of Amazon’s Linux AMI, I decided to upgrade (from 2011.02 to 2011.09). After running yum upgrade, I ran into an error (below) with compat-openldap. Error: Package: compat-openldap-2.4.19_2.3.43-15.11.amzn1.i686 (@upgrade-updates/2010.11) Requires: openldap = 2.4.19-15.11.amzn1 Removing: openldap-2.4.19-15.11.amzn1.i686 (@upgrade-updates/2010.11) openldap = 2.4.19-15.11.amzn1 Updated By: openldap-2.4.23-15.13.amzn1.i686 (amzn-main) openldap = 2.4.23-15.13.amzn1… Continue reading Upgrading Amazon’s Linux
Optimize all MySQL Tables
A one-liner to optimize all MySQL tables, in all databases. Be advised that running optimize on InnoDB does a ‘recreate and analyze’. Run as root in the example below. mysqlcheck -o -u root -p –all-databases
Updating the Flash Plugin
Adobe’s Flash plugin (v10.3) is setup to check for updates on restart. However, at least recently, on my setup, there have been a couple of little annoyances. Either it launches and tries to check for updates before my wifi connects (rare) or it tells me that it must be run with administrator permissions. The end… Continue reading Updating the Flash Plugin
Verify that SSL caching is working
To verify that SSL caching is on, check the Session-ID across multiple sessions (i.e. resume/reconnect) – they should be the same: openssl s_client -host HOSTNAME -port 443 -reconnect | grep ‘Session-ID:’ The equivalent, using gnutls-cli should be: gnutls-cli -V -r HOSTNAME |grep ‘Session ID’
PHP-FPM on Amazon’s Linux
Update (Oct 1, 2011): The release notes for the newest version of Amazon’s Linux (2011.09) state that “PHP scripts have the option of using PHP-FPM.” PHP-FPM is now included in the amzn-main repository, and can be installed via yum install php-fpm (it is installed to /usr/sbin). As a point of mention, if you want to… Continue reading PHP-FPM on Amazon’s Linux