sudo apt install build-essential texlive-latex-base openjdk-8-jdk-headless fp-compiler \
postgresql postgresql-contrib postgresql-client python3 python3-dev python3-pip \
cppreference-doc-en-html cgroup-lite wget curl llvm make tk-dev xz-utils zip \
libbz2-dev libcap-dev libcups2-dev libffi-dev libncursesw5-dev libpq-dev \
libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libxmlsec1-dev libyaml-dev liblzma-dev zlib1g-dev
curl https://pyenv.run | bash
git clone --recursive https://github.com/ioi-2022/cms.git
In order to run CMS, there are some preparation steps to run (like installing the sandbox, compiling localization files, creating the
cmsuser group, and so on).
sudo python3 prerequisites.py install
Installing CMS and its Python dependencies
We'll install CMS in a virtual environment created by
pyenv install 3.8.16
pyenv virtualenv 3.8.16 cms
pyenv local cms
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
python setup.py install
We also need to fix
2to3 -wWn --no-diffs ~/.pyenv/versions/cms/lib/python3.8/site-packages/Cryptodome
Configure the DB
We first need to start PostgreSQL:
sudo service postgresql start
The next thing to do is to create the user and the database. You need to log in as the
postgres user first:
sudo su - postgres
Then, to create the user (which does not need to be a superuser, nor be able to create databases nor roles) and the database, run the following commands:
createuser --username=postgres --pwprompt cmsuser
createdb --username=postgres --owner=cmsuser cmsdb
psql --username=postgres --dbname=cmsdb --command='ALTER SCHEMA public OWNER TO cmsuser'
psql --username=postgres --dbname=cmsdb --command='GRANT SELECT ON pg_largeobject TO cmsuser'
The last two lines are required to give the PostgreSQL user some privileges which it does not have by default, despite being the database owner.
exit to log out.
/usr/local/etc/cms.conf and change the connection string given in
database. This means to change username, password, and database with the ones you chose before.
Finally, you have to create the database schema for CMS:
Run WSLHostPatcher to make WSL2 listen for incoming connection on any interfaces (by default it only listens on localhost).
You need to create an admin user. This only needs to be done once:
cmsAddAdmin -p PASSWORD USERNAME
Log in to the admin interface and create some contests. Now we can start all CMS services: