Skip to content

Instantly share code, notes, and snippets.

@daniilyar
Last active September 28, 2021 10:33
Show Gist options
  • Save daniilyar/a2e7a63e87f02ba3955926178df14ec6 to your computer and use it in GitHub Desktop.
Save daniilyar/a2e7a63e87f02ba3955926178df14ec6 to your computer and use it in GitHub Desktop.
How to install BOINC and start calculating for Rosetta@home (Ubuntu 18)
# Before you start: register at Rosetta website (http://boinc.bakerlab.org/rosetta/join.php) and remember your registration email and password
sudo -i
# install dependencies:
apt -qqy update && apt install -y --auto-remove libsm6 libxext6 libnotify-bin libcurl3 && apt -qqy clean
# Install BOINC:
cd /opt
wget -q https://boinc.berkeley.edu/dl/boinc_7.4.22_x86_64-pc-linux-gnu.sh -O boinc.sh
chmod ugo+x boinc.sh && ./boinc.sh # Will print 'use /opt/BOINC/run_manager to start BOINC'
cd BOINC
# Symlink the boinccmd tool to /usr/local/bin to make it available in PATH:
ln -sf /opt/BOINC/boinccmd /usr/local/bin/boinccmd
# Add to Systemd as a service:
cat <<EOT > /etc/systemd/system/boinc.service
[Unit]
Description=BOINC Daemon
[Service]
User=root
Nice=19
ExecStart=/bin/bash -c 'cd /opt/BOINC/ && ./run_client'
[Install]
WantedBy=multi-user.target
EOT
chmod 644 /etc/systemd/system/boinc.service
# Start the client via systemd:
service boinc start
# Check that BOINC is running and didn't exit with error:
service boinc status
# Enable service for auto-start on boot:
sudo systemctl enable boinc
# [optional] How to get the account key:
# Register on https://boinc.bakerlab.org/join.php and use your registered email and password in the command below:
# ACCOUNT_KEY=`boinccmd --lookup_account http://boinc.bakerlab.org/rosetta '<email>' '<password>' | tail -n 1 | awk '{print $3}'` # e.g. ee2ae59487ffc6942133d6b5e7936bc4
# echo "Account key: $ACCOUNT_KEY"
# Attach the project to boinc suing the $ACCOUNT_KEY:
`cd /opt/BOINC && boinccmd --project_attach "http://boinc.bakerlab.org/rosetta" "<ACCOUNT_KEY>"`
# View the BOINC logs in syslog:
tail -f /var/log/syslog
# To detach the project, use: `cd /opt/BOINC && boinccmd --project "http://boinc.bakerlab.org/rosetta" detach`
See more at https://gist.github.com/ceralena/8295224
@daniilyar
Copy link
Author

daniilyar commented Apr 19, 2020

Instructions with Docker:

# Start Boinc rosetta container with 30% CPU limit:
docker rm -f boinc && docker run -d --cpu-quota 30000 -it --name boinc --net=host --restart=always --pid=host -v ${HOME}/boinc:/var/lib/boinc daniilyar/boinc

# [If you are executing Boinc container for the first time] Get the account key:
ACCOUNT_KEY=`docker exec -it boinc boinccmd --host 127.0.0.1 --passwd 123 --lookup_account http://boinc.bakerlab.org/rosetta '<email>' '<password>' | tail -n 1 | awk '{print $3}`
# It will print you a token

# [If you are executing Boinc container for the first time] Attach to Rosetta project and start calculating:
docker exec -it boinc boinccmd --host 127.0.0.1 --passwd 123 --project_attach "http://boinc.bakerlab.org/rosetta" "${ACCOUNT_KEY}"

After you reboot your PC or Docker or container (or recreate the container using thee first command above), it will continue calculating properly

@daniilyar
Copy link
Author

@joncrlsn
Copy link

Thank you daniilyar. This is just what I have been looking for. Your ACCOUNT_KEY line has a missing single-quote at the end of the awk statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment