How to run hamachi ( VPN) as a service on Ubuntu (All) 32 bit and 64

Monday, July 13, 2009

This procedre will make hamachi start as a service without any interaction from the user on ubuntu 8.04, 8.10, 9.04, 32 and 64 bit versions.

Hamachi is a vpn solution that will not require any firewall port forwarding. I use this program to connect to my work computer from home and vice versa. I have been using it for a couple of years and I find that I could not live without it. Through many months of searching and testing I have created an easy way to get hamachi to run as a service in ubuntu. Normally you would have to run /sbin/tuncfg with sudo to get hamachi to run. If you are logged in to a remote location and you rebooted the remote machine, there was no way to log back in until someone ran “sudo /sbin/tuncfg”, and “hamachi start” from the keyboard of the remote machine.

I have been using a script that I found in the ubuntu forums that works perfectly. I have gone a step further and made another script to automate the process of installation. Below you will find two files that are needed to install hamachi from scratch. The first file is my script, and the second is a text file.

The first thing you will have to do is download both files posted below and save them to your home directory. On line #5 in the text file it reads

USER=username

You have to change 'username' to the user you are logged in as. Ie: drew

You will also have to edit line #9 in the script to reflect the username that you are logged in as.

Before running the script you must make it executable by typing

chmod +x autostarthamachi

You will need to run the script with sudo, so you can run the script by typing

sudo ./autostarthamachi

The script will download and install hamachi from sourceforge.net and install it as well as create the files needed to run hamachi as a service.

Now it is time to setup hamachi. First you will need to run

sudo tuncfg

And then run

hamachi-init

This will generate the keys for hamachi

Then you will need to start hamachi

hamachi start

Then run

hamachi login

to put the daemon online and to create an account.

hamachi join 

to join the network.

hamachi go-online 

to go online in the network.

hamachi list

to list network members and their status.

Once you have hamachi installed and running you can reboot your machine and check that hamachi is running and logged in by typing

hamachi list

If hamachi does not complain then everything was a success.

If you would like to try a very nice gui, I highly recommend 'hamachi-gui'


autostarthamachi

autostarthamachi64

hamachi