You will also require a Linux kernel with support for control groups and namespaces. Support has been in the Linux kernel since 2.6.32. Other distributions, or systems with custom kernels, may not have support enabled. At a minimum, you will need to enable the following Linux kernel options: CONFIG_CGROUPS, CONFIG_CGROUP_CPUACCT, CONFIG_MEMCG (previously called as CONFIG_CGROUP_MEM_RES_CTLR), CONFIG_CPUSETS, CONFIG_PID_NS, CONFIG_IPC_NS, CONFIG_NET_NS. It is anyway suggested to use Linux kernel version at least 3.8.

Then you require the compilation and execution environments for the languages you will use in your contest:

On Arch Linux, unofficial AUR packages can be found: cms or cms-git. However, if you do not want to use them, the following command will install almost all dependencies (some of them can be found in the AUR):

Download CMS 1.4.dev0 from GitHub as an archive, then extract it on your filesystem. You should then access the cms folder using a terminal.

Warning

If you decided to gitclone the repository instead of downloading the archive, and you didn’t use the --recursive option when cloning, then you need to issue the following command to fetch the source code of the sandbox:

git submodule update --init

In order to run CMS there are some preparation steps to run (like installing the sandbox, compiling localization files, creating the cmsuser, and so on). You can either do all these steps by hand or you can run the following command:

sudo python3 prerequisites.py install

This script will add you to the cmsuser group if you answer Y when asked. If you want to handle your groups by yourself, answer N and then run:

sudo usermod -a -G cmsuser <your user>

You can verify to be in the group by issuing the command:

groups

Remember to logout, to make the change effective.

Warning

Users in the group cmsuser will be able to launch the isolate program with root permission. They may exploit this to gain root privileges. It is then imperative that no untrusted user is allowed in the group cmsuser.

There are good reasons to install CMS and its Python dependencies via pip (Python Package Index) instead of your package manager (e.g. apt-get). For example: two different Linux distro (or two different versions of the same distro) may offer two different versions of python-sqlalchemy. When using pip, you can choose to install a specific version of sqlalchemy that is known to work correctly with CMS.

Assuming you have pip installed, you can do this:

sudo pip3 install -r requirements.txt
sudo python3 setup.py install

This command installs python dependencies globally. Note that on some distros, like Arch Linux, this might interfere with the system package manager. If you want to perform the installation in your home folder instead, then you can do this instead:

An alternative method to perform the installation is with a virtual environment, which is an isolated Python environment that you can put wherever you like and that can be activated/deactivated at will.

You will need to create a virtual environment somewhere in your filesystem. For example, let’s assume that you decided to create it under your home directory (as ~/cms_venv):

python3 -m venv ~/cms_venv

To activate it:

source ~/cms_venv/bin/activate

After the activation, the pip command will always be available (even if it was not available globally, e.g. because you did not install it). In general, every python command (python, pip) will refer to their corresponding virtual version. So, you can install python dependencies by issuing:

pip3 install -r requirements.txt
python3 setup.py install

Note

Once you finished using CMS, you can deactivate the virtual environment by issuing:

It is usually possible to install python dependencies using your Linux distribution’s package manager. However, keep in mind that the version of each package is controlled by the package mantainers and could be too new or too old for CMS. On Ubuntu, this is generally not the case since we try to build on the python packages that are available for the current LTS version.

It is usually possible to install python dependencies using your Linux distribution’s package manager. However, keep in mind that the version of each package is controlled by the package mantainers and could be too new or too old for CMS. This is especially true for Arch Linux, which is a bleeding edge distribution.

To install CMS python dependencies on Arch Linux (again: assuming you did not use the aforementioned AUR packages), you can issue:

Worker machines need to be carefully set up in order to ensure that evaluation results are valid and consistent. Just running the evaluations under isolate does not achieve this: for example, if the machine has an active swap partition, memory limit will not be honored.

Apart from validity, there are many possible tweaks to reduce the variability in resource usage of an evaluation.

As CMS develops, the database schema it uses to represent its data may be updated and new versions may introduce changes that are incompatible with older versions.

To preserve the data stored on the database you need to dump it on the filesystem using cmsDumpExporterbefore you update CMS (i.e. with the old version).

You can then update CMS and reset the database schema by running:

cmsDropDB
cmsInitDB

To load the previous data back into the database you can use cmsDumpImporter: it will adapt the data model automatically on-the-fly (you can use cmsDumpUpdater to store the updated version back on disk and speed up future imports).