Feel Linux in Windows And Stay Connected With Linux Via Mosh
Fact: There is no Mosh client for windows.
Cheer up!! But there is a workaround. Let me walk you through how to setup your own mosh client for windows. I request you to spend few minutes on “Mosh – A brief introduction” – at least on the ‘how to install’ & ‘usage’ part of it before proceeding further.
Now, those who had went through that already, here is a little brush up.
Mosh is a command line utility like SSH with only difference being, your connection can be resumed, after switching networks, dis-connectivity issues, sleep/wake up of computer. You need not do a thing and your connection will be automatically resumed. It won’t prompt for username/password. It just resumes magically even after changing ip address of one of the connected host. But How? – “Mosh- A brief introduction” has answers for all these queries.
My office laptop has windows 7 installed and I use putty/kitty to connect to Linux servers. I guess most of us are using linux via putty/kitty (which I basically hate though). So, as we know, putty/kitty allows to login linux host through ssh. But, now we all know that there is a much efficient SSH called “Mosh”, we feel the need to have a mosh client for windows, from which we would be able to login to Linux servers using Mosh, thus enjoying the non-stop connectivity.
Unfortunately, Putty is yet to incorporate Mosh into it and as of now, there is no mosh client for windows. So, what can we do? We can make use of the very interesting Cygwin. Those who are not aware of Cygwin, here is a small intro.
Cygwin is a
- a collection of tools which provide a Linux look and feel environment for Windows.
– a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality.
For more information about Cygwin visit here.
Easy step by step configuration to achieve Mosh connectivity from Windows to Linux
1) Download Cygwin
2) Double-click and “Run” to begin the installation.
3) Click “Next -> Install from Internet -> Next”
4) Choose the Root directory where you want it to be installed and choose “All Users” or “Just Me” based on your wish and then “Next”
5) Next. Choose “Local Package Directory” i.e) where the the file will be downloaded and Click “Next”
6) Choose your type of Internet Connection and click “Next”. In most of the cases, it will be “Direct Connection”.
7) Choose a download site and click “Next”. Note that the setup file you initially downloaded is to initiate setup, whereas now you need to choose a download site from where all required packages will be downloaded.
8) Setup.bz2 will be downloaded and parsed, taking you to a screen, where you can choose additional packages you want.
9) Choose to install the packages related to following parameters
- c++ /*to install c++ compiler (gcc-g++) , which if not chosen, protobuf and thus Mosh cannot be installed */
- make /* required to make install mosh source code later */
- boost /* C++ libraries */
- libncurses /* A terminal handling library */
- pkg-config /* provide the necessary details for compiling and linking a program to a library */
- perl /* other dependencies */
- openssh / * Mosh initiates connection using ssh. Hence openssh is required */
- zlib, openssl /* compression libraries and SSL/TLS + cryptography library */
Note that you need to type the name in search box, which will list the packages related to that and you need to choose relevant ones and click on “default” , hence it will get changed to install.
And finally click “Next”.
10) Installation will take a while. Finally check “Create icon on Desktop” and “Add icon to Start Menu” (for your convenience) and click “Finish”
Pretty much done. Get ready to feel linux in windows now. Few more steps to achieve non-stop connectivity to linux machines from windows.
Click and open Cygwin Terminal.
Below is a screenshot of my Cygwin Terminal
To be noted:
$ pwd command gives output “/home/gokkanna”.
Now where this “/home/gokkanna” is located? It’s located in my installation directory,
which is C:\cygwin64
Two things to install, before you can get your hands on mosh
1) Installing Protocol Buffer (Dependency for Mosh)
From Cygwin terminal:
$ wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2 --no-check-certificate $ tar jxf protobuf-2.5.0.tar.bz2 $ cd protobuf-2.5.0 $ ./configure $ make $ make install
2) Installing Mosh
From Cygwin terminal:
$ wget http://mosh.mit.edu/mosh-1.2.4.tar.gz $ tar zxvf mosh-1.2.4.tar.gz $ cd mosh-1.2.4 $ ./configure CPPFLAGS=”-I/usr/include/ncurses” PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ $ make $ make install
At a later point of time, whenever something fails due to some dependent packages, feel free to run the setup again, choosing the same installation directory, and search for the dependent package alone and proceed as mentioned earlier.
Now, you can open as many as Cygwin terminal you want and type
$ mosh user@ip_addr
And stay connected to any number of linux machines for eternity ;)
Note that the other linux machine to which you are connecting through Mosh, should also have Mosh installed. It is very easy to install in linux machine. Refer “Mosh – A brief Introduction” for any details regarding Mosh.
Now that you have installed Cygwin, you shall integrate an option into Putty/Kitty and use that to login linux machine via Mosh, which is not discussed here. You shall check out the following link for that.
Thanks for reading. Cheers!
P.S: Cygwin occupies a considerable disk space (near about 2 GB) and around 3 MB of RAM which would account around 7 to 9 MB with other essential services for it. But, totally worth it.