Friday, February 18, 2011

Crashplan headless

I've previously mentioned my desire to get headless backups working with Crashplan. However, it wasn't quite right. So, I spent some more time this morning trying to get it working simply and well.

Before I start, here are the references to the work completed:

Install the Java virtual machine - don't use openJRE
sudo apt-get install sun-java6-jre
Accept the licence
Goto the crashplan download site and find out the URL of the latest version

Get the crashplan archive, extract it and change directory
wget http://download.crashplan.com/installs/linux/install/CrashPlan/CrashPlan_3.0.2_Linux.tgz
tar -zxvf CrashPlan_3.0.2_Linux.tgz
cd CrashPlan-install
Install Crashplan as root (if you want access to all directories)
sudo -s
./install.sh
Complete the install process
  • Read the EULA
  • Hit q to exit the EULA and then agree to it
  • Accept the default locations for the binaries, backups and scripts
Finish off the remote install process
  • Remove the downloaded files
  • Firewall: open up port 4243 on the remote machine

Setup the local machine

To administrate the remote machine, we will be port forwarding via ssh 4200 to 4243 and then using the desktop GUI.

Copy and paste the following script into crashplan/bin/CrashPlanRemote (which is usually in /usr/local/ on Ubuntu).
#!/bin/bash

# Do we have the appropriate input?
if [ -z "$1" ]; then
echo usage: $0 remote-server
exit
fi

# fill in your stuff here:
USER=jeremy
SERVER=$1

# dont change anything down here
ssh -fnNTL 4200:localhost:4243 ${USER}@${SERVER}
PID=$!

# get CrashPlan folder
SCRIPT=$(ls -l $0 | awk '{ print $NF }')
SCRIPTDIR=$(dirname $SCRIPT)
TARGETDIR="$SCRIPTDIR/.."
cd ${TARGETDIR}

#change CrashPlan config to use the tunnel
sed 's/#servicePort=4200/servicePort=4200/g' ${TARGETDIR}/conf/ui.properties > /tmp/CrashPlan-ui.properties
cp /tmp/CrashPlan-ui.properties ${TARGETDIR}/conf/ui.properties
rm /tmp/CrashPlan-ui.properties

#CrashPlan start script - begin
. ${TARGETDIR}/install.vars
. ${TARGETDIR}/bin/run.conf
${JAVACOMMON} ${GUI_JAVA_OPTS} -classpath "./lib/com.backup42.desktop.jar:./lang:./skin" com.backup42.desktop.CPDesktop > ${TARGETDIR}/log/ui_output.log 2 > ${TARGETDIR}/log/ui_error.log
#CrashPlan start script - end

#change CrashPlan config back to default
sed 's/servicePort=4200/#servicePort=4200/g' ${TARGETDIR}/conf/ui.properties > /tmp/CrashPlan-ui.properties
cp /tmp/CrashPlan-ui.properties ${TARGETDIR}/conf/ui.properties
rm /tmp/CrashPlan-ui.properties

#kill (every 4200) tunnel
CMD="ps -eo pid,args | grep 'ssh -fnNTL 4200:localhost:4243' | grep -v 'grep' | cut -c1-6"
PID=`eval $CMD`
kill -9 $PID
Now create a link from somewhere in your path, so that you can run it with the command CrashPlanRemote
chmod +x /usr/local/crashplan/bin/CrashPlanRemote
sudo ln -s /usr/local/crashplan/bin/CrashPlanRemote /usr/local/bin/CrashPlanRemote
And that should be it!
  • CrashPlanRemove server.name.here
NB. it's best to have setup passwordless login to the remote server
  • /etc/hosts: add a line with the IP address and full.domain.name
  • ssh-copy-id -i ~/.ssh/id_rsa.pub full.domain.name

2 comments:

Evert said...

Just curious: Is your install still working after the upgrade to 3.2/3.2.1? I'm having major problems, but it's hard to pinpoint the exact cause...

I have a 1511+

Evert

Unknown said...

I'm not sure I've used either of the more recent versions on headless machines.

I certainly use 3.2.1 on my Ubuntu Precise (beta2) laptop, but I'm not entirely sure what versions are running on my other servers.

What seems to be the problem? Incomplete backups or inability to connect?