Skip to content

Instantly share code, notes, and snippets.

@ShepBook
Last active August 22, 2020 06:35
Show Gist options
  • Save ShepBook/5713899 to your computer and use it in GitHub Desktop.
Save ShepBook/5713899 to your computer and use it in GitHub Desktop.
Installing Clojure and Clojure Koans with Leiningen on Linux Mint 15

Installing Clojure and Clojure Koans with Leiningen on Linux Mint 15

Remove Existing OpenJDK

Generally, I'd recommend running Oracle's Java, if you're doing Clojure development. Seeing how Clojure is built around the standard JVM from Oracle, it seems like it would be best to use that. First, let's remove the existing OpenJDK from our OS.

Search for OpenJDK

$ dpkg --get-selections | grep jdk

Purge it with apt-get

For me, openjdk-7-jre was installed. Here's how I purged it. You'll need to use whatever package shows up for you.

$ sudo apt-get purge openjdk-7-jre

Add the PPA Repo for Oracle Java

One thing I love about Linux Mint being build on an Ubuntu base is that you can use all the great PPAs out there for Ubuntu. I've had good success with the Webupd8team PPAs. Here's how to install Oracle's Java with it.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

You'll need to accept the terms when the installer runs.

Install Leiningen

Now, we'll install Leiningen. It's the way to manage all things Clojure on your system.

First, let's make a ~/bin directory, if it doesn't already exist.

$ mkdir ~/bin

Now, we'll download the lein script.

$ wget https://raw.github.com/technomancy/leiningen/stable/bin/lein -P ~/bin/

Next, we'll make it executable.

$ chmod a+x ~/bin/lein

Finally, we'll add the ~/bin directory to our path, so our terminal can find the lein script. If you're using bash, you'll need to add this to the bottom of your ~/.bashrc file. If you're using zsh, it needs to go at the bottom of ~/.zshrc.

export PATH=$PATH:/home/<your username here>/bin

You'll need to put in your own username, as it's best to use explicit directory paths on your shell's PATH variable. For me, it was like this.

export PATH=$PATH:/home/shepbook/bin

Fire up a REPL and make sure it works.

A quick and easy test to make sure Clojure and Leiningen are working properly. Just run this in your terminal.

$ lein repl

That will install Clojure and make sure everything's working for you.

Installing Clojure Koans

Finally, the part we've been working toward.

First, you'll need to install git. I like the most up-to-date version of git, so I use another PPA repo. Add it and install git, like so:

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git

Next, we'll clone the Koans repo into a local directory. I like to use the ~/git directory to hold all my git repos. Here's what I do.

$ mkdir ~/git
$ cd ~/git
$ git clone git://github.com/functional-koans/clojure-koans.git

Last, but not least, we finally run the Koans.

$ cd ~/git/clojure-koans
$ lein koan run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment