Skip to content

Installing Autolab on Ubuntu (DEPRECATED)

Aatish Nayak edited this page Feb 22, 2017 · 1 revision

Hey There!

These are the instructions for setting up Autolab for development and trial purposes. It's the fastest way to get up and running with a version of Autolab that you can play around with, but because of that, we leave out some deployment nicities (like setting up Apache, among other things). Be sure to check out "Autolab in Production" in the sidebar when you decide to set up Autolab for real!

Onwards

If you've set up a Rails app or worked with Ruby before, this part should feel pretty familiar. If not, the steps are pretty straight-forward. Remember: if you run into help at anytime, chances are there's something we can do to either guide you through the process or clarify our documentation, so feel free to contact us!

These installation instructions are for Ubuntu. If you're on Mac OS X, check out Installing Autolab on Mac OS X. If you're on Windows, we suggest installing Ubuntu--there are no plans to support Windows.

1. Grab the source

Go ahead and clone this repo anywhere you want:

$ git clone https://github.com/autolab/Autolab

2. Install rbenv and ruby-build

You can skip this step and the next step if you already have a recent version of Ruby installed. Autolab is developed against Ruby 2, and it has not been tested on Ruby 1.9.

First, install rbenv, a program that helps to manage installing Ruby. Installation instructions are available on the rbenv GitHub page. You'll want to follow the Basic GitHub Checkout instructions if you don't know what else to do.

Next, install ruby-build, a program used by rbenv to... build Ruby. Again, installation instructions are on the ruby-build GitHub page. Installing as an rbenv plugin is probably your best bet.

3. Install Ruby

Now that we've installed rbenv, let's use it to install Ruby. From the root of the Git project, install the version of Ruby we're using:

$ rbenv install $(cat .ruby-version)

At this point, confirm that rbenv is working (depending on your shell, you might need to log out and log back in):

$ which ruby
~/.rbenv/shims/ruby

$ which rake
~/.rbenv/shims/rake

4. [OPTIONAL] Install MySQL

Autolab requires either MySQL or SQLite. If you want to just use SQLite (for example, in development), feel free to skip this step.

Ubuntu 12.04 and up ship with it installed by default. To check, see if this grep command returns something:

$ dpkg --get-selections | grep mysql

If you don't see anything, you can install MySQL manually:

sudo apt-get install mysql-server
sudo apt-get install libmysqlclient-dev 

5. Install bundler and all RubyGems dependencies

Now's the time to grab all the Ruby gems required to get the Rails app up and running. It's just three simple commands (make sure you're still in the project directory):

$ gem install bundler
$ rbenv rehash
$ bundle install

Note that the bundle install command will probably fail if you messed up the MySQL installation.

6. Configure the database for Rails

Next up, we need to let Rails know about the database so that it can manage the rest for us.

$ cp config/database.yml.template config/database.yml

SQLite

Comment out the MySQL Configuration block and uncomment the SQLite Configuration block. You're all set.

MySQL

Make sure you fill in

  • The username and password
    • Chances are that the username is root and the password is blank, otherwise Google around.
  • The socket
    • Make sure that the socket is configured correctly for your installation of MySQL, otherwise you will get weird database errors when you try to spin up the server. The default in config/database.yml.template is the default socket for Ubuntu, though, so you shouldn't have to change anything.

7. Configure Devise for safe Authentication

Next up, we need to create the initializer for Devise auth system with a unique key.

$ cp config/initializers/devise.rb.template config/initializers/devise.rb

Make sure you fill in <YOUR_WEBSITE> and insert a new secret_key. You can get a random token with

$ bundle exec rake secret

8. Create and initialize the database tables

Now that we've told Rails how to handle the database, the rest is a cinch:

$ bundle exec rake db:create
$ bundle exec rake db:migrate

You'll have to use bundle exec in front of every rake and rails command, though there is a way around this.

9. [OPTIONAL] Populate dummy data

If you want to contribute to Autolab or you're just taking it out for a spin, you might want to populate some dummy data so that you don't have to go through the process of creating it all yourself:

$ rake autolab:populate

10. Fire it up!

The moment of truth; to start the Rails server, run:

$ bundle exec rails s -p 3000

Jump on over to http://localhost:3000 and see if it's live. If you autopopulated some dummy data, you should be able to log in by clicking "Developer Login" and entering the email address admin@foo.bar (this login only works when we set up Autolab in development mode, like we have here).

In order to run a production server with the following command

$ bundle exec rails s -e production

you will need to create config/autogradeConfig.rb and populate it with your desired options. Use the following command:

$ cp config/autogradeConfig.rb.template config/autogradeConfig.rb

You will also need this file when you install Tango

11. That's all folks!

Actually, there's a ton more things that Autolab can do. If you're looking to get started as an instructor of TA, you'll probably want to look into "Course Management" or "Assessments and Labs". If you're looking to install Autolab in production, make sure to check out some of the deployment tips we've written up.

And most importantly, if you want Autolab to be able to autograde actual assignments, make sure you install Tango, the backend service that handles everything to do with Autograding!