Senin, 21 Desember 2009

Install Hamachi on Ubuntu 9.04

  1. To being we must install the ‘tun’ module to enable IP Tunneling support for the Linux kernel. Most do not have this setup by default.
  2. $ sudo modprobe tun
  3. Open the modules file and add ‘tun’ to the list
  4. $ sudo nano /etc/modules
  5. Your file should look similar to the example below.
  6. # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.

    lp
    rtc
    tun
  7. Save the file and exit out of nano (Ctrl-O to save & Ctrl-X to exit), lets move on and verify that a tunneling node has been created. (*If you have compiled your own kernel you likely need to recompile it with IP Tunneling support if you receive an error with modprobe. This is not covered in this guide. And if you are unsure, you most likely did not compile yourself and you would definitely remember doing so.)
  8. $ ls /dev/net/tun
  9. You should recieve a response like the example below
  10. /dev/net/tun
  11. If you received something along the lines of “No Such File or Directory” you may need to manually create the node in step 6. If you received the same response as I did, jump to step 7.
    $ sudo mkdir /dev/net
    $ sudo mknod /dev/net/tun c 10 200

    Jump back to Step 4 and you should now receive the correct response.

  12. With our IP Tunnel node created, it is time to install Hamachi itself. First download the latest version. As of writing this guide, the latest version is 0.9.9.9-20
  13. $ wget http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz

    Expected output below

    --2009-07-31 20:28:25--  http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz
    Resolving files.hamachi.cc... 69.25.20.50
    Connecting to files.hamachi.cc|69.25.20.50|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 344866 (337K) [text/plain]
    Saving to: `hamachi-0.9.9.9-20-lnx.tar.gz'

    100%[====================================================================>] 344,866 448K/s in 0.8s

    2009-07-31 20:28:26 (448 KB/s) - `hamachi-0.9.9.9-20-lnx.tar.gz' saved [344866/344866]
  14. Extract our newly downloaded archive
  15. $ tar zxvf hamachi-0.9.9.9-20-lnx.tar.gz

    Expected output below

    hamachi-0.9.9.9-20-lnx/
    hamachi-0.9.9.9-20-lnx/Makefile
    hamachi-0.9.9.9-20-lnx/LICENSE
    hamachi-0.9.9.9-20-lnx/README
    hamachi-0.9.9.9-20-lnx/LICENSE.tuncfg
    hamachi-0.9.9.9-20-lnx/LICENSE.openssh
    hamachi-0.9.9.9-20-lnx/LICENSE.openssl
    hamachi-0.9.9.9-20-lnx/hamachi
    hamachi-0.9.9.9-20-lnx/tuncfg/
    hamachi-0.9.9.9-20-lnx/tuncfg/Makefile
    hamachi-0.9.9.9-20-lnx/tuncfg/tuncfg.c
    hamachi-0.9.9.9-20-lnx/tuncfg/tuncfg
    hamachi-0.9.9.9-20-lnx/CHANGES
  16. Navigate into the extracted directory
  17. $ cd hamachi-0.9.9.9-20-lnx/
  18. Start the installation
  19. $ sudo make install

    Expected output below

    Copying hamachi into /usr/bin ..
    Creating hamachi-init symlink ..
    Compiling tuncfg ..
    Copying tuncfg into /sbin ..

    Hamachi is installed. See README for what to do next.
  20. Run the tunnel
  21. $ sudo tuncfg
  22. This should complete the install, we will now configure the user permission in order for it to run correctly. Create a ‘hamachi’ user group
  23. $ sudo groupadd hamachi
  24. Add youself as a user to the ‘hamachi’ group. Be sure to replace your user name where appropriate.
  25. $ sudo gpasswd -a YOURUSERNAME hamachi
  26. Add the root user to the ‘hamachi’ group
  27. $ sudo gpasswd -a root hamachi
  28. Set the correct permissions for the tuncfg socket
  29. $ sudo chmod 760 /var/run/tuncfg.sock
  30. Change the ownership of the socket file
  31. $ sudo chgrp hamachi /var/run/tuncfg.sock
  32. That should do it for the permissions, Now onto setting Hamachi up & configuring it to start as a system service.
  33. $ sudo hamachi-init -c /etc/hamachi

    Expected output

    Initializing Hamachi configuration (/etc/hamachi). Please wait ..

    generating 2048-bit RSA keypair .. ok
    making /etc/hamachi directory .. ok
    saving /etc/hamachi/client.pub .. ok
    saving /etc/hamachi/client.pri .. ok
    saving /etc/hamachi/state .. ok

    Authentication information has been created. Hamachi can now be started with
    'hamachi start' command and then brought online with 'hamachi login'.
  34. Start hamachi
  35. $ sudo hamachi -c /etc/hamachi start

    Expected output

    Starting Hamachi hamachi-lnx-0.9.9.9-20 .. ok
  36. Set your computer’s nickname
  37. $ sudo hamachi -c /etc/hamachi set-nick "COMPUTERNICKNAME"
  38. Login to the Hamachi network
  39. $ sudo hamachi -c /etc/hamachi login
  40. To join an existing network (optional) “NETWORKNAME” and “PASSKEY” should be replaced with your network name and network password
  41. $ sudo hamachi -c /etc/hamachi join NETWORKNAME PASSKEY
  42. To create a new network (optional) “NETWORKNAME” and “PASSKEY” should be replaced with your network name and network password
  43. $ sudo hamachi -c /etc/hamachi create NETWORKNAME PASSKEY
  44. If you joined an existing network you must tell hamachi to then “go-online”. Be sure to replace NETWORKNAME with your relevant network name.
  45. $ sudo hamachi -c /etc/hamachi go-online NETWORKNAME
  46. Check your hamachi status to verify everything is as it should be
  47. $ sudo hamachi -c /etc/hamachi

    Expected output

    Hamachi, a zero-config virtual private networking utility, ver 0.9.9.9-20

    version : hamachi-lnx-0.9.9.9-20
    pid : 5472
    status : logged in
    nickname : JauntyVM

Tidak ada komentar: