Configure Clojure web app to run on Ubuntu 13.04

Intro

It's super easy to configure your new Clojure web app on Ubuntu machine. Basically you need to install Java, Leinigen and Git.

General instructions

Update repositories:

sudo apt-get update

Install Java:

sudo apt-get install openjdk-7-jdk

Install Leiningen:


cd bin/ curl https://raw.github.com/technomancy/leiningen/stable/bin/lein > lein chmod a+x lein

Git installation

If you need to get source code of your application on server using git few steps should be made.

Install git:

sudo apt-get install git

Generate RSA key:

ssh-keygen

If you are using BitBucket follow this instructions.

For GitHub check this page.

In general you need to add RSA public key and grant read only access to this key.

Final steps

Then just clone source code using git. Enter directory with source code and launch your app using Leiningen:

lein ring server

or

lein with-profile prod ring server

Conclusion

I tried this on DigitalOcean Ubuntu instance and it worked great. There is another related blog post that covers how to create upstart configuration for your Clojure web app on Ubuntu 13.04.