Skip to content
daveho edited this page Mar 18, 2013 · 37 revisions

This web page contains instructions for installing and configuring CloudCoder on some variety of Linux or Unix other than Ubuntu or Debian. (If you can use Ubuntu or Debian, use the Bootstrap instructions.)

Note that these instructions are a work in progress. Please email dhovemey@ycp.edu if you find an error or you have suggestions for how to improve these instructions.

Install required packages

You should install

  • OpenJDK (1.6 or later)
  • MySQL (version 5 or later)
  • Apache (version 2 or later), with mod_ssl and mod_proxy
  • OpenSSL

For example, if you are running a Linux distribution which uses the yum package manager, the command might be something like:

sudo yum install java-1.6.0-openjdk.x86_64 mysql mysql-server httpd mod_ssl openssl

Note that in the command above httpd is Apache. Also, the command above assumes that mod_proxy is installed automatically. (If your distribution makes mod_proxy available as a separate package, make sure you install it.)

You will need to consult your distribution's documentation to determine exactly which packages you need and how to install them.

You may need to start the MySQL server: one of the following commands may work:

# Works on Amazon Linux / CentOS
sudo /etc/init.d/mysqld start
# Works on Fedora?
sudo systemctl start mysqld.service

You may need to configure the system so that MySQL and Apache start automatically. For example, on Amazon Linux and CentOS this is

sudo chkconfig mysqld on
sudo chkconfig httpd on

You may also need to configure a password for the MySQL root user.

sudo /usr/bin/mysqladmin -u root password 'new-password'

(Replace new-password with the actual root user password.)

Create CloudCoder database and database user

CloudCoder needs a database in which to store the exercises, user information, submissions, etc. It also needs a database user account with which to access this database.

You should be able to use the following commands:

mysql --user=root --pass \
--execute="create user 'cloudcoder'@'localhost' identified by 'ccuserpassword'"
mysql --user=root --pass \
--execute="grant all on cloudcoderdb.* to 'cloudcoder'@'localhost'"

Replace ccuserpassword with the password you would like to use for the MySQL cloudcoder user. For each command, you will be prompted to enter the password for the MySQL root user.

Install the webapp

Log into the server you will use to host the web application. Create a cloud user account, which is the user under which the webapp will run. For example, using the useradd command:

sudo useradd cloud

Switch over to running as the cloud user:

sudo su cloud
cd /home/cloud

Create a webapp directory under the cloud user's home directory and navigate into it:

mkdir -p webapp
cd webapp

Download the latest version of the CloudCoder webapp:

wget http://s3.amazonaws.com/cloudcoder-binaries/LATEST
wget http://s3.amazonaws.com/cloudcoder-binaries/cloudcoderApp-`cat LATEST`.jar

Configure the webapp

Run the following command to configure CloudCoder:

java -jar cloudcoderApp-v*.jar configure

Here is a sample transcript. Note that the value for the GWT SDK directory is not important, so you can enter any value. For most of the options, just pick the default. Make sure you enter the password for the MySQL user account you created earlier in place of ccuserpassword. Enter your server's hostname when prompted. When prompted to enter the name of the jar file to configure, enter the exact filename of the jar file you downloaded. This will be something like cloudcoderApp-v0.0.7.jar. (Use the ls command to find out the filename.)

Do you want to read new configuration properties from a file?
[default: no] ==> no
It looks like you have already configured CloudCoder.
Use the previous configuration settings as defaults?
[default: yes] ==> no
Where is your GWT SDK installed (the directory with webAppCreator in it)?
[default: ] ==> /home/dhovemey/gwt-2.5.0

########################################################################
 >>> Database configuration properties <<<
########################################################################

What MySQL username will the webapp use to connect to the database?
[default: ] ==> cloudcoder
What MySQL password will the webapp use to connect to the database?
[default: ] ==> ccuserpassword
What MySQL database will contain the CloudCoder tables?
[default: cloudcoderdb] ==> 
What host will CloudCoder connect to to access the MySQL database?
[default: localhost] ==> 
If MySQL is running on a non-standard port, enter :XXXX (e.g, :8889 for MAMP).
Just hit enter if MySQL is running on the standard port.
[default: ] ==> 

########################################################################
 >>> Login service properties <<<
########################################################################

Which login service do you want to use (imap or database)?
[default: database] ==> 

########################################################################
 >>> Builder properties <<<
########################################################################

What host will the CloudCoder webapp be running on?
(This information is needed by the Builder so it knows how to connect
to the webapp.)
[default: localhost] ==> ec2-174-129-44-38.compute-1.amazonaws.com
How many threads should the Builder use? (suggestion: 1 per core)
[default: 2] ==> 
What port will the CloudCoder webapp use to listen for connections from
Builders?
[default: 47374] ==> 

########################################################################
 >>> TLS/SSL (secure communication between webapp and builder(s) <<<
########################################################################

What is the hostname of your institution?
[default: None] ==> 
What is the name of the keystore that will store your public/private keypair?
(A new keystore will be created if it doesn't already exist)
[default: keystore.jks] ==> 
What is the keystore/key password?
[default: changeit] ==> 

########################################################################
 >>> Web server properties (webapp) <<<
########################################################################

What port will the CloudCoder web server listen on?
[default: 8081] ==> 
What context path should the webapp use?
[default: /cloudcoder] ==> 
Should the CloudCoder web server listen only on localhost?
(Set this to 'true' if using a reverse proxy, which is recommended)
[default: true] ==> 
What is the name of the jarfile containing all of the code for CloudCoder?
[default: cloudcoderApp.jar] ==> cloudcoderApp-v0.0.7.jar
Creating new keystore keystore.jks...
Wrote new configuration properties to cloudcoder.properties contained in jarfile cloudcoderApp-v0.0.7.jar

Next, create the CloudCoder database with the command:

java -jar cloudcoderApp-v*.jar createdb

You will be prompted to create an initial user account. Example transcript:

Please enter some information needed to configure the Cloudcoder
database.  (Hit enter to accept a default value, if there is one.)
Enter a username for your CloudCoder account: 
[default: ] ==> dhovemey
Enter a password for your CloudCoder account
[default: ] ==> hax0r4l1f3
What is your first name?
[default: ] ==> David
What is your last name?
[default: ] ==> Hovemeyer
What is your email address?
[default: ] ==> dhovemey@ycp.edu
What is your website URL?
[default: ] ==> http://faculty.ycp.edu/~dhovemey
What is your institution name (e.g, 'Unseen University')?
[default: ] ==> York College of Pennsylvania
Enter the URL of the exercise repository
[default: https://cloudcoder.org/repo] ==> 
Creating database
Creating schema version table...
Creating table cc_changes
Creating table cc_configuration_settings
Creating table cc_courses
Creating table cc_course_registrations
Creating table cc_events
Creating table cc_problems
Creating table cc_submission_receipts
Creating table cc_terms
Creating table cc_test_cases
Creating table cc_test_results
Creating table cc_users
Creating table cc_quizzes
Creating table cc_modules
Creating table cc_started_quizzes
Adding configuration settings...
Creating terms...
Creating demo course...
Creating initial user...
Registering initial user for demo course...
Creating sample problems in demo course...
Success!

Configure Apache

Next, configure Apache so that it accepts SSL connections and forwards them to the webapp.

It is possible that Apache is already configured to use a default self-signed certificate. For example, this is true on Amazon Linux (and perhaps CentOS and RHEL).

If you have a real (trusted) SSL certificate, install it instead of the self-signed certificate described below. (Note that you may need to set the SSLCertificateChainFile option if your SSL certificate authority issued you a chain certificate.)

If your distribution does not configure a self-signed certificate for Apache automatically, and you do not have a real (trusted) SSL certificate, you will need to create and install a self-signed certificate as described in the following section.

Installing a self-signed certificate

Important: run the commands in this section as a user that can use the sudo command to execute commands with superuser privileges.

You will need an SSL certificate. You can generate a self-signed certificate as follows (source: CentOS wiki):

openssl genrsa -out ca.key 1024
openssl req -new -key ca.key -out ca.csr
openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt

In the second command (generating the CSR), you can just accept the default values.

The certificate and private key will need to be installed in a location where the Apache server can find them. For example (for CentOS):

sudo cp ca.crt /etc/pki/tls/certs
sudo cp ca.key /etc/pki/tls/private/ca.key
sudo cp ca.csr /etc/pki/tls/private/ca.csr

Then, edit the Apache SSL configuration file (e.g., /etc/httpd/conf.d/ssl.conf on CentOS) to point to your self-signed certificate:

SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key

Note that the private key file should be readable only by the root user. You can ensure this using the commands:

sudo chown root /etc/pki/tls/private/ca.key
sudo chmod 0400 /etc/pki/tls/private/ca.key

Testing Apache/SSL

You can test your Apache installation by using a web browser to navigate to

https://hostname

where hostname is the hostname of your server. If you see a test page, then you are in good shape. Note that if you are using a self-signed certificate, your browser will issue a security warning.

Setting up Apache to forward connections to CloudCoder

Once Apache and SSL are working, edit the Apache SSL configuration file (e.g., /etc/httpd/conf.d/ssl.conf on Amazon Linux and CentOS) to set up Apache as a reverse proxy for CloudCoder.

Editing the file (replace with your Apache SSL config file if it is different):

sudo vi /etc/httpd/conf.d/ssl.conf

Find the line in the file that begins with something like <VirtualHost _default:443>. Add the following lines underneath:

# Transparently proxy requests for /cloudcoder to the
# CloudCoder Jetty server
ProxyPass /cloudcoder http://localhost:8081/cloudcoder
ProxyPassReverse /cloudcoder http://localhost:8081/cloudcoder
<Proxy http://localhost:8081/cloudcoder>
    Order Allow,Deny
    Allow from all
</Proxy>

Note: depending on how Apache is installed, you may also need to add LoadModule directives to ensure that mod_proxy and mod_proxy_http are available. This should not be necessary on Amazon Linux and CentOS.

Restart Apache: for example, on Amazon Linux/CentOS:

sudo /etc/init.d/httpd restart

Starting the CloudCoder webapp

Once Apache has been configured as a reverse proxy, you can start the CloudCoder webapp:

sudo su cloud
cd /home/cloud/webapp
java -jar cloudcoderApp-v*.jar start

At this point, you should be able to open the URL

https://hostname/cloudcoder

in your web browser (replacing hostname with your server's hostname) and see the CloudCoder login page.

Configure the builder

One you have the webapp working, you can download and configure the builder. As the cloud user, cd to /home/cloud/webapp and run the comand

wget http://s3.amazonaws.com/cloudcoder-binaries/cloudcoderBuilder-`cat LATEST`.jar

Then, configure the builder to match the configuration of the webapp:

java -jar cloudcoderBuilder-v*.jar configure \
  --editJar=cloudcoderBuilder-`cat LATEST`.jar \
  --fromWebappJar=cloudcoderApp-`cat LATEST`.jar

At this point you can copy the configured cloudcoderBuilder-vXXX.jar (where XXX is the latest version) onto the server you will use to build and test submissions. See the "Installing the Builder" section in the Bootstrap instructions.

Install

Downloads

Screenshots

For more info (demo server, exercise repository, contributing to cloudcoder, etc): cloudcoder.org

Clone this wiki locally