Basically, what this howto is intended to do is to teach you how to get hamachi to run as a service.
Why would you want to run Hamachi? Once installed on your CentOS 4.5/5.X system and installed on a workstation (perhaps a laptop) you can access your server remotely via VPN for http or ssh administrative tasks. You can also use the private network to connect softphones and even set up DUNDi trunking over this VPN.
For client installation see this link.
Installing hamachi as a linux system service is quite simple. You first follow the regular steps of installation of hamachi.
- Download the file from http://files.hamachi.cc/linux/hamach...-20-lnx.tar.gz and then execute the following command (see http://files.hamachi.cc/linux/ for other options):
Code:
# tar -zxvf hamachi-0.9.9.9-20-lnx.tar.gz(Note: You do not have to do these next 3 commands, it's just a good idea to keep your hard drive organized)
Code:
# mkdir /usr/src/hamachi
# mv hamachi-0.9.9.9-20-lnx /usr/src/hamachi
# cd /usr/src/hamachi/hamachi-0.9.9.9-20-lnxOnce done with this, you need to do your standard hamachi installation command:
Code:
# make installOnce installed, you need to first run the program "tuncfg". (Note: tuncfg is a program which makes the hamachi network adapter and must always be running while hamachi is running in order for hamachi to work)
Code:
# tuncfg
Now to get hamachi running as a system service and make your setup scripts:
First and foremost, you need to put your hamachi
configurations in a global directory as opposed to your home directory.
hamachi-init creates scripts in your home directory in a folder called
.hamachi by default, but we are going to specify the configuration
directory of /etc/hamachi. (note also that hamachi itself can be run under a non-privileged user. tuncfg, however, needs to be run as root).
Code:
# hamachi-init -f -c /etc/hamachi
# hamachi -c /etc/hamachi start
# hamachi -c /etc/hamachi login
# hamachi -c /etc/hamachi create network password
NOTE: Start thinking about how telephony might use a VPN when naming.
Next:
# hamachi -c /etc/hamachi set-nick nickname
# hamachi -c /etc/hamachi go-online network
Once done with this, we will need to make a hamachi runtime script.
Use your favorite text editor to make a file called hamachi-start.
Code:
# nano /usr/bin/hamachi-start
This file will be a shell script. For those who aren't well versed in
linux, just copy exactly what I tell you to and it should work
perfectly fine. If you feel like modifying it any, feel free -- it will
still work. The most important thing is, start tuncfg, then start hamachi.
Here is the contents of hamachi-start:
Code:
#!/bin/sh
hamachi_start() {
echo "Starting hamachi..."
/sbin/tuncfg
/usr/bin/hamachi -c /etc/hamachi start
}
hamachi_stop() {
echo "Stopping hamachi..."
killall tuncfg
/usr/bin/hamachi -c /etc/hamachi stop
}
hamachi_restart() {
hamachi_stop
sleep 1
hamachi_start
}
case "$1" in
'start')
hamachi_start
;;
'stop')
hamachi_stop
;;
'restart')
hamachi_restart
;;
*)
hamachi_start
esac
Not done yet, now you need to chmod it to give it executable permissions:
Code:
# chmod a+x /usr/bin/hamachi-start
To add Hamachi as a startup item you manually edit /etc/rc.local -- be sure to back this up before poking around in there though.
Code:
# cp /etc/rc.local ~/rc.local.bak
Then edit it (Again, use your favorite text editor instead of nano. If nano doesn't work, you can always try pico)
Code:
# nano /etc/rc.local
At the very bottom of this file, add the following lines:
Code:
if [ -x /usr/bin/hamachi-start ]; then
. /usr/bin/hamachi-start
fi
Crtl-x and Crtl-y then press enter and viola! You have Hamachi as a service when you restart.
SOME ADDITIONAL NOTES:
I found the easiest way to manage a Hamachi
network is to use the free Windows version (Better still to purchase a
full version) and create all networks from that workstation.
We want to use a global configuration file... So, you need to always
specify the file's location. Therefore, instead of "hamachi join
network password" and so on, the commands will look like this:
Code:
# hamachi -c /etc/hamachi set-nick nickname
# hamachi -c /etc/hamachi login
# hamachi -c /etc/hamachi create network password
# hamachi -c /etc/hamachi join network password
# hamachi -c /etc/hamachi go-online network
# hamachi -c /etc/hamachi list
# hamachi -c /etc/hamachi go-offline my-net
- Printer-friendly version
- Login or register to post comments



setting up hamachi
super!!!!!
worked first time
I have been using hamachi for years and had installed it on my debian servers and windoze "servers"but i had not gotten to the freepbx server.
Glad to hear another Hamachi success
You can use it with DUNDi too.
Can't automatically start Hamacho service
Hamachi is working perfect, but I'm facing problem with hamachi-start script.
I followed the exact code of hamachi-start but I'm getting the following error when I test it by . /usr/bin/hamachi-start start and even when I restart the server: I'm using CentOS 5.2
'command not foundart : line 2:
' /usr/bin/hamachi-start: line 9: syntax error near unexpected token '{
' /usr/bin/hamachi-start: line 9: 'hamachi_stop() {
and Hamachi is not automatically started, I have to manually start it by tuncfg and hamachi -c /etc/hamachi start
Any help.
I might delete the
I might delete the hamachi-start and recreate it.
Does this allow for blog
Does this allow for blog hosting? Maybe I'll try it. If it's cheap enough, I can take the risk. If it doesn't give me what I need, it won't hurt as much.
Thanks for the guide, it
Thanks for the guide, it certainly helped my overcome some difficulties I was having. I’m hoping to be able to use a Clickbooth affiliate network program with hamachi or at the very least some website building tools.
^^^ SPAM ^^^^ SPAM ^^^^ SPAM
^^^ SPAM ^^^^ SPAM ^^^^ SPAM ^^^^
Hamachi and openfiler
Thank you so much for this fast and easy explanation.
It worked perfectly on openfiler 2.3 although I first had issues because I tried to install the -pentium version first. Didn't work.
For the lnx version I had to download upx and unpack the hamachi executable. But it now works like a charm.
Were looking for answering
Were looking for answering services that have managed servers with freepbx and have support plans.