Building a LYME server – Linux Yaws Mnesia Erlang

A LYME server is Linux Yaws Mnesia Erlang – similar to how LAMP is Linux Apache (Tomcat) MySQL PHP, but of course, this system focuses on functional programming.

I started studying functional programming awhile ago.  It’s pretty interesting.
Here are some resources for you:

  • The Wikipedia entry – it’s not Erlang, the person, or the measurements, thus the link (to go off on a tangent, here, look at Erlang and Markov early 20th century mathematicians who still influence our lives today).
  • The official Erlang site.
  • http://lisperati.com/ – This is a fun tour of functional programming in Lisp.
    • go through the “Casting SPELs to learn what a Lisp program looks like.
    • go through the “Land of Lisp” cartoon to learn the tech points of Lisp – read it and click on the links as you go.
  • http://mitpress.mit.edu/sicp/ –  This is the “not fun” tour of functional programming in Scheme.  It’s comprehensive, and you need to have an aptitude for math (or be able to ignore it and focus on the concepts).
  • http://www.sics.se/~joe/apachevsyaws.html – This is what really got me interested in using Erlang: Apache dies at about 4,000 parallel sessions. Yaws is still functioning at over 80,000 parallel connections.

You can create your own LYME server in about 5 minutes.

On Ubuntu, you can install yaws “apt-get install yaws”  That’ll create an http Yaws server pretty quickly.  However, there is no https.

On Fedora, you can do “yum install yaws” However, the http example site is not configured.

If you want to use CentOS, or https, then you are in for a longer setup.  The good thing about the following setup is:

  1. It is the latest code release
  2. It includes https and all example code.

These are my notes for building a LYME server using CentOS.  I hope you like the command line;)

yum install make wget gcc m4  openssl openssl-devel pam-devel ncurses-devel git automake glibc-devel.i386

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm; wget http://erlang.org/download/otp_src_R14B01.tar.gz; wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz

tar -xvzf otp_src_R14B01.tar.gz ; tar -vxzf autoconf-2.68.tar.gz

cd autoconf-2.68; ./configure; make; make install;

cd ../otp_src_R14B01; ./configure –with-ssl; make; make install

cd ..; git clone git://github.com/klacke/yaws.git

cd yaws; autoconf ; ./configure; make; make install

edit /etc/sysconfig/iptables  and add a rule to allow ports 80 and 443
-A RH-Firewall-1-INPUT -m state –state NEW -p tcp –dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -p tcp –dport 443 -j ACCEPT

/etc/init.d/iptables restart

yaws

http://[your machine IP or FQDN]/  you should see the yaws server page, with examples

back in yaws, cctrl-g, then q [enter]

That’s it!  All done!  On a decent server, if you are cutting and pasting commands, it’ll probably take < 30 minutes to complete.  On an slower machine, plan on taking some coffee breaks during the configure and make commands.

Also, on my latest run of the above script, the https port wasn’t showing the yaws app page.  I edited /usr/local/etc/yaws/yaws.conf as follows:
In the ssl configuration, I added the following lines under the line with “port=443”:
docroot = /usr/local/var/yaws/www
appmods = <cgi-bin, yaws_appmod_cgi>
Replace the existing docroot entry, of course…

Eric

Posted in Uncategorized Tagged with: , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*