Skip to content

Folding @ Home : Installation – Configuration – Automation : Ubuntu / Debian | RHEL / FC

Please consider downloading the latest version of folding instead.

Automated script available here.

Before I dive into my tutorial and tell you how to setup your machine for running the Folding @ Home process I’ll take just a minute and introduce those of you unaware to what the project is.

The project is a distributed computing effort put together by Stanford University to help research protein folding and, based on that research, help in medical research for conditions such as: Alzheimer’s Disease, Huntington’s Disease, Osteogenesis Imperfecta, Parkinson’s Disease, etc. Basically, you can use your machines idle processes to help in medical research. Not a bad way to put your computer to good use!

Now to the good stuff. How do I set this up? Well there is a simple way that allows you to simply run the research application when you remember. It’ll save it’s data to your home folder (clutter things up just a bit) and stop when you stop it. This is the way I ran the program for quite a while but I found it to be a little bothersome to have to manually deal with it all the time. There were a few fixes that I found to help move it behind the scenes, but recently I really started looking into a long-term solution, which is the basis for this tutorial.

Overview:

  1. This tutorial will create a dedicated system user on your machine to run the process and store the data. Data will be stored in a subfolder of /var/ (can be changed, if you prefer).
  2. This system user will not be assigned a login, password or shell for security reasons.
  3. I will outline installation, setup and automation of starting, stopping and checking status of the application.
  4. The application will be handled with an init service for automagically starting at boot and allowing you to stop or start the service on demand.

A few notes on the tutorial syntax. Lines prefixed with the ’sudo’ command are specific for Ubuntu / Debian based machines. If you’d like to run this setup on a RHEL / FC based machine simply ’su -’ to root to run those commands. Also, near the end I have labeled [Ubuntu / Debian] or [RHEL / FC] for the distribution specific commands.

First on the list is to create a dedicated user to run this process. This is done for a few reasons. For one, some people have concerns that the Folding @ Home process may not be completely secure. While there have been no reported security vulnerabilities in its history, it is a valid concern and one that is addressed here. The Folding @ Home process runs ‘work units’ on your machine and reports back to the main servers at Stanford. One of the best ways to ensure security during this communication is to create a limited system user to handle the work. Even if the service was somehow compromised the affected user would have no access to anything, therefore effectively stopping the threat.

sudo useradd -d /var/folding -r folding

The syntax of this, if you’re not familiar tells the new system user, folding, to use /var/folding as its home folder as opposed to the standard /home/ area.

Second (unless I can figure out the right syntax for the above command), you’ll need to manually create the folder.

sudo mkdir /var/folding

After the folder is created you will also want to make sure that it is owned strictly by the new user.

sudo chown folding.folding /var/folding

Now that you have the user set up, the home folder created and ownerships set properly you will want to download the ‘finstall’ script. This is a third party script that helps automate the whole process. In my testing it has been really solid and can be used on Linux, WINE, BSD or OS X based machines (w00t!).

With this next command we’ll pull down an installer script that will set everything up for us. You’ll want to be in your newly created /var/folding at this point (cd /var/folding/)

sudo wget -c http://www.vendomar.ee/~ivo/finstall

Once this download has finished you’ll need to add the execute permission on the file. This is done simply with:

sudo chmod +x finstall

Ok, now we’re about half way there.

Now we’re ready to run finstall but remembering that we want it installed, owned and run by our new user we’ll want to install it as them first. We’ll need to temporarily switch to that user now.

sudo -i

su - folding

This will land you in a limited shell, if it can even be considered a shell, but you can still run the installer. Use the following command to launch the installer and follow the prompts.

/bin/bash ./finstall

Now, as I mentioned, this installer is very comprehensive and will ask you quite a bit to get things setup initially. It will download the actual Folding @ Home program, allow you to verify the checksum (it’s always nice to verify that we’re installing what we think we’re installing!), and also add a FAQ where you can find out more information.

The questions that it might ask you are as follows, and appended with my suggested answers. (Depending on your system you may not see all / each question listed here.)

Do you want to read finstall FAQ (yes/no?): n (I've read it a few times now, this one is up to you)

Is this the correct MD5SUM value of FAH504-Linux.exe (yes/no?): y (double check if you like here.)

Do you want to use any of these 3rd party FAH utilities (y/n)?: y

Do you want to use automatic MachineID changing (y/n)?: y

Do you want to use it for this client and for all remaining configureless clients as well (y/n)?: y

It will also ask you for a name. The name is optional, or you can use an alias / name of your choice. You can use this page to see if the name is available. The only reason the name might be important is if you want to compare your finished work units vs a friend.

It will also ask you for a (optional) team to join. Might I suggest you join the Ubuntu Folding @ Home Team? Show your Ubuntu pride and save the world with the rest of the Ubuntu crew. To join the Ubuntu Folding @ Home Team use the number 45104.

After the questions about the name and team it prompts for a few more options. The defaults are safely used here.

Ok, once this installer finishes asking you how to set things up you’re *almost* there! Just a few more quick commands and we’re ready to set-and-forget.

You can now type ‘exit’ and ‘exit’ to leave the prompt you are in as the new folding user. The only thing left to do is create the startup script and make sure it runs as the new user.

sudo cp foldingathome/folding /etc/init.d/

sudo update-rc.d folding defaults [Ubuntu / Debian]

chkconfig folding on [RHEL/FC]

sudo chmod 4775 foldingathome/folding

Ok. You’re ready to go now. There is a copy of the start / stop script in your init folder. The update (or chkconfig) has set this script to automagically start on multi-user runlevels and SUID permissions have been set on the script so that it will *always* run as, and with permissions of, your new limited system user.

To go ahead and start the service type:

sudo /etc/init.d/folding start [Ubuntu / Debian]

service folding start [RHEL/FC]

To stop the service type:

sudo /etc/init.d/folding stop [Ubuntu / Debian]

service folding stop [RHEL/FC]

Remember, this will now auto-start at boot so you can safely just ignore it from here on out. No more config, manually starting, remembering to start the service, etc. You’re done.

update: A few people have been wondering how to remove this after it has been installed. This can be done in just a few commands:

sudo /etc/init.d/folding stop [Ubuntu / Debian]

service folding stop [RHEL/FC]

sudo rm /etc/init.d/folding

sudo update-rc.d folding remove [Ubuntu / Debian]

service folding off [RHEL/FC]

sudo userdel -r folding

sudo rm -rf /var/folding

done.

sources: Folding @ Home, Ubuntu F@H Community Docs, Finstall Script, FAH Wiki.

If this site has been useful, please consider participating in the Fundraiser.

Other Points of Interest

  • No Related Post