Lift is a web framework that was built using the Scala programming language. It claims to be more secure, scalable and easy to use than other MVC frameworks (like Struts and Ruby on Rails). In this tutorial, you will learn how to install and run Lift on your Ubuntu machine.
- To proceed, you will need the following:
- Java 1.7 or later. If you don’t have this already, see this tutorial for instructions.
- Scala version 2.9 or later. If you don’t have this already, search for instructions on how to install Scala on Ubuntu. A shorter alternative would be to install Scala from the Ubuntu Software Center. Fire up a terminal (
Ctrl + Alt + T) and enter the following:
sudo apt-get install scala. At the moment, the above command will install Scala 2.9 on your computer.
- SBT version 0.10 or later. If you don’t have this already, search for how to install SBT on Ubuntu. Yet again, you have the option to install it from the Ubuntu Software Center using:
sudo apt-get install sbt.
- A strong, steady Internet connection.
Having met the above requirements, here are the steps you need to take to install the Lift framework on your Ubuntu computer.
Step 1: Download the Lift installation archive
Visit the Lift website’s download page to download the compressed file that contains Lift’s installation files. Presently, the latest stable version is Lift 3.0 and you may choose the tar or zip format, though I will prefer the tar archive because it will be (almost) certainly smaller.
Step 2: Extract the Lift archive
In your File Manager, navigate to where you saved the file from the previous step. Let’s say you saved the Lift archive with a filename of
LIFT_ARCHIVE.tar.gz in your
Downloads directory. Extract that archive into a directory called
lift-framework (or some other name you prefer). If you want to use the terminal instead, then enter these commands:
cd ~/Downloads tar -xzf LIFT_ARCHIVE.tar.gz lift-framework
~ is a shortcut in Ubuntu for the home directory of the current user (e.g
Step 3: Navigate into the extracted Lift directory
Fire up a terminal (if you haven’t done so already) and navigate into the directory from the last step.
cd into the
However, if you’re using Lift 2.6 or earlier,
lift_basic is a sub-folder of
scala_211 or something similar, so you need to enter this instead:
Finally, if you’re using Lift 2.5 (why?), then you need to enter this command instead:
Step 4: Compile your first Lift project
In this penultimate step, type the following to compile your Lift project for the first time:
Wait for the script to download all dependencies and initialize your Lift project. Note that you must be in the directory stated in the previous step when you enter the above command (it runs a script called
sbt that is in that directory). Trying to do so from another location in the file system will lead to errors because the script expects to be relative to some other folders.
Step 5: Run your project
Finally, run your project by entering the following command:
Note that this is not the same as
./sbt from the previous step. Afterwards, enter the following at the new prompt (i.e
Voila! You now have a functional Lift project running on your Ubuntu machine. Just open
http://localhost:8080 in a web browser and you should see something like the image at the beginning of this post. You’re now officially a Liftafarian!
Congrats on setting up Lift on your Ubuntu computer. Please use the comments section below to let me know if there is an update to (or mistake in) any of the steps described above.