ElectricSheep Server Setup

Software

This guide was written using:
Sheep Server 2.5 (electricsheep-server-2.5.tar.gz)
Fedora Core 1
Apache 2.0.48
Perl 5.8.3

User Setup

Create a user sheep belonging to apache group:
useradd sheep -g apache
chmod 770 /home/sheep
passwd sheep
Change to user sheep:
su - sheep
Change umask so that apache group will have access to everything:
echo "umask 0002" >> .bashrc

Sheep Server Setup

This is all done as sheep user.

Files

I untarred the server code in the sheep directory. This created a directory called "v2.5" containing the following files:
v2.5/cgi/.htaccess
v2.5/cgi/config.pl.eg
v2.5/cgi/COPYING
v2.5/cgi/finish.pl
v2.5/cgi/apophysis.cgi
v2.5/cgi/frame.cgi
v2.5/cgi/get.cgi
v2.5/cgi/global.pl
v2.5/cgi/best.cgi
v2.5/cgi/index.html
v2.5/cgi/dead.cgi
v2.5/cgi/login.cgi
v2.5/cgi/logout.cgi
v2.5/cgi/node.cgi
v2.5/cgi/put.cgi
v2.5/cgi/queue.pl
v2.5/cgi/reset.cgi
v2.5/cgi/reset.pl
v2.5/cgi/set.cgi
v2.5/cgi/status.cgi
v2.5/cgi/submit.cgi
v2.5/cgi/vote.cgi
v2.5/cgi/daily.pl
v2.5/html/anon-edge.jpg
v2.5/html/anon-face.jpg
v2.5/html/anon-icon.jpg
v2.5/html/busy-icon.jpg
v2.5/html/home.jpg
v2.5/html/index.html
v2.5/html/status.jpg
v2.5/html/status.png
v2.5/html/style.css
v2.5/run/lock
v2.5/run/generation
v2.5/run/anim_params.template
v2.5/run/draft_params.template
v2.5/run/hirez_draft_params.template
v2.5/run/hirez_params.template
v2.5/run/index.html
v2.5/run/vib.anim_params.template
v2.5/run/vib.draft_params.template
v2.5/src/pnmmultipaste.c
Change into the v2.5 directory. Everything from now on will assume we are in the v2.5 directory.
All the .pl and .cgi files in cgi directory need to be executable (chmod +x cgi/*.pl cgi/*.cgi).

Make directories

The tar file doesn't contain several empty directories that must exist so you'll have to create them manually:
mkdir bin
mkdir gen
mkdir gen/log
mkdir run/tmp

Create and modify cgi/config.pl

Copy the example config file to config.pl:
cp cgi/config.pl.eg cgi/config.pl
Edit config file to match your server:
if (1) {
  $outgoing_url_prefix = "http://servername.co.uk/sheep/v2.5/gen";
  ...
Edit config file to return true: (i get an error (config.pl did not return a true value at global.pl line 37. Compilation failed in require at status.cgi line 20.) when i try perl status.cgi and adding the following line at the very end of the file fixes that):
return 1;
(Now would also be a good time to change the admin_name and admin_password.)

Edit cgi/global.cgi

$root_url = "http://servername.co.uk";
$root_dir = "/home/sheep/v$version";
...
$tmp_dir = "$run_dir/tmp";

Fix Bug!

There's a bug which (still!) mangles the first and last values for finished loops and edges. Here's a fix:
Add
my ($state, $time, $size, $rating, $first, $last, $type);
to top of list_sheep_to_file() in cgi/global.pl.

Compile pnmmultipaste

The pnmmultipaste command needs compiling.
cd src
make pnmmulitpaste
cd ..
cp src/pnmmulitpaste bin

Other programs

These should all be copied to /home/sheep/v2.5/bin:
dot (from graphviz)
pick-flame (from electricsheep)
pnmmultipaste (from electricsheep)
(whirlgif optional?)
These should exist on the system and be somewhere where the Apache webserver can find them (/usr/bin):
cjpeg
djpeg
giftopnm
mpeg2enc (from mjpegtools)
pnmcat
pnmcut
pnmscale
ppmmix
ppmquant
ppmtogif
ppmtoy4m

Apache Configuration

This all needs to be done as root.

Add cgi directory to PERLLIB for Apache

Apache needs to have global.pl and config.pl in its Perl include path in order to be able to pick them up. So in /etc/init.d/httpd you need to add:
start() {
  PERLLIB=/home/sheep/v2.5/cgi:$PERLLIB
...

Remove .htaccess file

I can't get the web server to work with the supplied .htaccess file.
mv ~sheep/v2.5/cgi/.htaccess ~sheep/v2.5/cgi/htaccess.safe

Create /etc/httpd/conf.d/sheep.conf

This file will be included automatically when starting Apache and keeps all the sheep specific configuration together.
Alias /sheep/v2.5/cgi/list.cgi "/home/sheep/v2.5/cgi/list.cgi.txt"
ScriptAlias /sheep/v2.5/cgi/ "/home/sheep/v2.5/cgi/"
Alias /sheep/v2.5/ "/home/sheep/v2.5/"

<Directory "/home/sheep/v2.5/cgi">
  AllowOverride All
  Order allow,deny
  Allow from all
<Directory>

Optionally Turn On Script Debugging

In /etc/httpd/conf/httpd.conf add the following line anywhere AFTER the LoadModule cgi_module modules/mod_cgi.so line:
ScriptLog logs/script_log

Restart Apache

service httpd restart

Initialising Sheep Server

Admin setup

Login as administrator:
http://servername.co.uk/sheep/v2.5/cgi/login.cgi
Choose admin link in menu bar.
Click "Reset Server" button.
Choose admin link in menu bar.
Click "Random Rotation" button.

Testing

Try accessing the following URL in a browser. This is the URL that a sheep client would use when requesting a new frame to render:
http://server.co.uk/sheep/v2.5/cgi/get.cgi?nick=test&version=LNX_2.5&zip

Problems and Hints

Odd things that i had trouble with whilst doing the above but which are probably outside the scope of this document.

Problem: You see the sourcecode of status.cgi

Your apache configuration isn't right. I had my Alias line above the ScriptAlias line at first and that stopped anything in cgi being recognised as executable.

Problem: My icons are corrupted

My icons in the html directory were all corrupted and looked dreadful, probably a problem with DOS line endings. Just download the correct images from electricsheep.org or replace them with your own images.

Problem: Can't compile dot

I had to add #include <unistd.h> to dotneato/common/timing.c after getting the following compile errors.
timing.c: In function `elapsed_sec':
timing.c:49: warning: implicit declaration of function `sysconf'
timing.c:49: error: `_SC_CLK_TCK' undeclared (first use in this function)
I also had troubles with missing tcl libraries but that was for part of graphviz i wasn't interested in so i used make -i and make -i install to get it to ignore errors.

20041031 acd 1.0 First Release
20041209 acd 1.1 Updated for release of electricsheep-server-2.5.tar.gz