Wednesday, August 12, 2015

Recipe: Getting Haskell running on AWS Linux EC2 instance

Steps for standing up dev tools, and Haskell, on AWS EC-2

So, you’ve configured your EC-2 with the standard AWS-Linux image, and now you want to compile your sources and have running executables to demo, including in not only Java and Perl but possibly C, C++ and, for my prototypes and graph-systems, Haskell. How to do this?

Unfortunately, the AMI for Haskell is rather unforthcoming, as it seems to compile the GHC from sources, an endeavor that takes hours of AWS-time. Unnecessary. So, I’ve cut out those middle steps and have a Haskell-image on my S3 that can be downloaded and used once the dev-tools are in place.

Let’s do this.

1. Get the ghc image from my public-S3-bucket:
$ wget https://s3-us-west-2.amazonaws.com/haskell-7-10-2/haskell-platform-7.10.2-a-unknown-linux-deb7.tar.gz

(you can either get this from my S3 bucket and be stuck with that version of haskell on a vanilla linux instance, or you can go to haskell.org and get the most recent version for your particular flavor of linux)

2. install the dev-tools from Amazon (this takes a bit)

$ sudo yum groupinstall “Development Tools”

3. Now you need to provide a soft link to libgmp.so:

$ cd /usr/lib64
$ sudo ln -s libgmp.so.3 libgmp.so
$ sudo ln -s libgmp.so.3 libgmp.so.10
$ cd

Yes, you need both of those soft links.

4. Once you have all that done, unzip ghc:

$ sudo tar xzf haskell-platform-7.10.2-a-unknown-linux-deb7.tar.gz

5. And now ghci will work for you:

$ ghci
Prelude> 3 + 4
~> 7


YAY! Do a happy dance!

1 comment:

Mathew Stephen said...

Cloud is one of the tremendous technology that any company in this world would rely on (Salesforce Training in Chennai). Using this technology many tough tasks can be accomplished easily in no time. Your content are also explaining the same(Salesforce admin training in chennai). Thanks for sharing this in here. You are running a great blog, keep up this good work.