tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A real long winded beginners guide to getting emacs and multi-hop tramp


From: Seoras Ray
Subject: A real long winded beginners guide to getting emacs and multi-hop tramp working on windows
Date: Thu, 05 Aug 2004 23:53:54 -0400
User-agent: Opera M2/7.53 (Win32, build 3850)

Hi,

I don't know if this will be of any use to anyone but since I spent a couple of days figuring it out I thought I would post it and hope it might be of use to someone else in the same situation.

My goal was to run emacs under windows and work on files stored on a freebsd box behind a private lan. The only way to get to this server was to tunnel through a public firewalled server and then hop to the private server.

The basic steps were:

* Install procompiled copy of emacs from cvs source (comes with tramp 2.0.39)
* Install plink
* Create 'plink' multi-hop method
* Download tramp 2.0.43 source code
- 2.0.43 fixes as issue with invalid number of arguments, byte code...<garbage>... error when doing multi-hops
* Install MinGW and Msys compiler tools
* Compile tramp 2.0.43 code
* Add tramp-chunksize variable


In Detail:

* Getting emacs and tramp for windows

- Download the precompiled binary version taken from the cvs source. Since it is a new version of emacs it comes with tramp preinstalled: http://crasseux.com/emacs/. Using the link for 'Emacs CVS compiled for Windows' from July 9th 2004

- I copied the emacs folder into my 'c:/program files' folder and ran the emacs/bin/addpm.exe file to create the registry settings and the start menu shortcut

- I then added a string key to the registry (I did this for the local machine, it's prob better to do it per user): HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs\HOME. This key is used for storing your ~ folder, or home directory. Emacs will look in here first for your .emacs file etc.

- I made the new HOME key value, 'C:/Documents and Settings/<my username>'


* Getting Putty and associated tools

- Get the plink program from the Putty site: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

  - I downloaded :

    * Plink
    * PuTTYgen (this is not required, but I use it for my example)

  - I created a 'putty' folder under 'c:/program files'


* Next I wanted to make sure that plink was in the path so that it could be run from anywhere

- Under XP, you change the path settings in the System applet of the control panel, under 'advanced' and 'enviroment variables'

- Add the following path entry to your PATH variable, 'c:/program files/putty'

- Now you can run 'plink' from anywhere under a DOS window (and thus tramp can find it)


* Now with those settings on their own it is possible to run tramp and connect to a remote server using the default 'plink' method.

  - i.e. open file: /<user>@<server>:~/file.pl


* Now for my example I needed to be able to get to this server and then get to another one behind it, thus requiring the use of a multi-hop. Unfortuantly there is no default 'plink' method for a multi-hop so I had to create a simple one. I added the following to my .emacs file (under C:/Documents and Settings/<my username>:

  - (require 'tramp)
      (add-to-list
        'tramp-multi-connection-function-alist
        '("myserver" tramp-multi-connect-rlogin "plink -ssh -l %u %h %n"))

- NOTE: to simplify multi-hop connections I used an ssh private key for connecting to the primary server, however in practise this is not a good idea, since it leaves an open door into the private lan from your workstation out in the pubic and rather more hackable. Anwayz, putty doesn't like standard ssh2 keys but you can use the PuTTYgen program to open them and export them to .ppk files that plink can use. Then you can modify the tramp multi-hop 'plink' method to something like:

'("myserver" tramp-multi-connect-rlogin "plink -ssh -l %u -i C:/Documents and Settings/<server>_key.ppk %h %n"))

- I was confused at first and was using the 'myserver' method for both hops in the connection, however remember that once you connect to the intial server using 'plink' after that you are running commands on the newly connected server, so you can use ssh, telnet etc etc.


* At this point I ran into a road block. When using a multi-hop command such as:

  - /multi:myserver:<user>@<server1>:ssh:<user>@<server2>:

I would get errors about 'invalid number of arguments method user host... byte code.. <gibberish characters>...'

  - Turns out this was fixed in the tramp 2.0.43 release


* Getting tramp 2.0.43 installed on windows

- I used the instructions on the page I downloaded emacs from to compile the tramp 2.0.43 source code on my windows box. Bascially you need to do the following:

    - Download MinGW from http://www.mingw.org/download.shtml

      * I used, MinGW-3.1.0-1.exe

    - Download MSYS from http://www.mingw.org/download.shtml

      * I used, MSYS-1.0.11.exe

- Install both packages, MinGW first, then MSYS. The default is to C:/mingw and C:/msys (make sure you point the MSYS install to the MinGW install as part of the MSYS installation process)

    - Rename the 'c:/mingw/bin/mingw32-make.exe' file to just 'make.exe'.

    - Update your system paths so the tools are available under DOS

* I added the following paths to my PATH variable: 'C:/msys/1.0/bin;C:/mingw/bin'

- Update your system path so that your emacs install is available under DOS. This is required to compile the tramp lisp scripts

* I added the following path to my PATH variable: 'c:/program files/emacs/bin'

- After all the additions the PATH vairables was looking like '...c:/program files/putty;C:/msys/1.0/bin;C:/mingw/bin;c:/program files/emacs/bin'

- Download the tramp 2.0.43 source code from the tramp website, http://savannah.nongnu.org/download/tramp/

      * tramp-2.0.43.tar.gz

- Extract it to a nice new folder (WinRAR makes this nice and easy, http://www.rarlab.com/download.htm)

- Open a command prompt (use the 'run' option on the start menu and use 'cmd' if you are on XP/2000, otherwise, 'command')

    - Browse to the tramp source code folder

- Use 'sh configure' to run the configure program and create the make file

- It seems that texi2dvi is broken in this MSYS install but it isn't required to get tramp running.

    - Use 'make' to actually compile tramp

    - You can ignore the warnings and what not, mostly path errors.

- Now simply copy all the .el and new .elc files from the 'lisp' folder in the tramp source code folder over to your emacs lisp folder:

      * copy to - c:/program files/emacs/lisp/net


* You can test to see what version of tramp you are running by using the 'tramp-version' fuction under emacs.


* One final issue I came across was my target freeBSD server had issues with chunk sizes (this is a common prob it seems). This problem manifests itself with the inability for tramp to send large strings to the server and during a normal tramp session appears at the section when it tries to copy the perl encode/decode functions. My issue manifested itself with emacs simply hanging at this point.

  - To solve the issue I added the following to my .emacs file:

    (setq tramp-chunksize 250)

* note that most people suggest a value of 500 but that didn't work for me whereas 250 did. go figure :)



That's it! At least that is what it took me to get it set up knowing nothing really about tramp, list or emacs. If there is an easier way out there I would love to hear about it!

The final result is that now I can open the nice windows emacs gui on my windows box at home and through a simple multi-hop command browse and edit files on any number of private servers sitting on a private lan behind a firewalled public server, which is just really cool :)

Seoras.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]