Several months ago, I was inspired by the magnificent book ANSI Common Lisp written by Paul Graham, and the statement that Lisp could be used as a secret weapon in your web development, published by the same author on his blog. Wow, that is amazing. That is something that I have been looking for long time. The author really developed a successful web applcation and sold it to Yahoo.
With those encouraging images, I determined to spend some time (1 year or 2 year, who knows) on learning Common Lisp. Maybe someday I will development my web application and turn into a great Lisp expert. In fact, this is the second time for me to get to study Lisp. The first time was a couple of years ago when I was fascinated by the famous book SICP but found later Scheme was so unbelievably immature for real life application.
After reading some chapters of ANSI Common Lisp, I was pretty sure that is a great book full of detailed exploration of Common Lisp. Then I began to set up a web server in Common Lisp. After all, this should be the best way if you want to learn something. Demonstrations are always better than definations.
As suggested by the book Practical Common Lisp (by the way, this is also a great book), I chose to install AllegroServe on some Common Lisp implementation. Then, from somewhere else, I learned that Hunchentoot seems to be better than AllegroServe. (I don't remember where and whom this word is from. So don't argue with me.)
Ironically, you know what, I never could installed the two packages on any Common Lisp implementation. More annoyingly, I even don't know why. The machine always spit up a lot of jargon and lead me into a chaos. I've tried searching the internet and have not found anything.
Could anybody who has successfully installed these packages in Linux tell me how you did it? Have you run into any trouble? How did you figured out what is wrong and fixed it? The more detailed, the more helpful.
Have you tried these instructions?
I already had a working SBCL installation so I've only followed the second half of the instructions. It sets up a very minimal web app, so it lets you see just how to structure your own web app.
These instructions might not be quite what you're looking for - they're for setting up a web server (on Ubuntu) with remote interaction with emacs/SLIME, but I guess "remote interaction" could just as well mean localhost.
Basically, these installation steps are from this article A Simple Lisp Webapp for beginners, recommended by Frank Shearar (thanks again). But I didn't follow the exact steps because (1) I'd like to install Common Lisp with a local user; (2) I am not familiar with a few things the author mentioned. You can check out the original article or you can just follow me here. I am afraid my instructions are much easier to follow. :)
Three packages need to be downloaded before installation. sbcl binary and source packages can be downloaded here, and smanek package can be downloaded here.
sbcl-1.0.38-x86-linux-binary.tar.bz2
sbcl-1.0.38-source.tar.bz2
smanek-trivial-lisp-webapp-3681c1
Note: The version number may have changed when you see this essay. So don't bother to get the exact packages. However, this is right packages working for me.
Here is what I do (replace YOURPATH with your real path and I assume you are using BASH):
1. Install the binary sbcl package
tar jxf sbcl-1.0.38-x86-linux-binary.tar.bz2
cd sbcl-1.0.38-x86-linux
INSTALL_ROOT=YOURPATH sh install.sh
cd ..
Well, the binary sbcl package has been installed now. When the install program complains with something like "no manual found", it is OK since the manual stuff is not included in the binary package. Let it be.
2. Set the PATH and SBCL_HOME
export PATH=YOURPATH/bin/:$PATH
export SBCL_HOME=YOURPATH/lib/sbcl/
3. Install the source sbcl package
tar jxf sbcl-1.0.38-source.tar.bz2
cd sbcl-1.0.38
sh make.sh
export SBCL_HOME=''
INSTALL_ROOT=YOUROTHTERPATH sh install.sh
cd ..
NOTE: You may need to specify another directory for installation, or it will be installed into the same directory the binary sbcl resides in.
4. Set the PATH and SBCL_HOME
export PATH=YOUROTHERPATH/bin/:$PATH
export SBCL_HOME=YOUROTHERPATH/lib/sbcl/
5. Install the smanek package
unzip smanek-trivial-lisp-webapp-36816c1.zip
cd smanek-trival-lisp-webapp-36816c1
cd scripts
./startserver.sh
When it says "Webserver started on port 8080", you can visit "http://localhost:8080" in your web browser. It is there, right?
6. A few notes
5 years later.
it very easy with quicklisp. I assume you have installed SBCL or other CL implementation.
(ql:quickload :aserve)
(net.aserve:start :port 8000)
(net.aserve:publish-file :path "/" :file "~/hello.html")
Happy hacking!.
read more about Introduction to AllegroServe Tutorial
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With