Skip to content

Build Instructions

Stefan Penner edited this page Mar 15, 2020 · 35 revisions

Most of this is noted in the main README. But here are some additional bits.

As of Mosh 1.2, Boost is no longer needed.

OSX

  • Should be in ports as "mosh" and homebrew as "mobile-shell"
  • Tested on Snow Leopard and Lion
  • clang++ works. (export CXX=clang++)
  • You may need a newer autoconf to build from master. But the tarballs are fine.

Manually: (adapt as needed)

brew install protobuf
brew install boost
brew install pkg-config
brew install automake

git clone https://github.com/mobile-shell/mosh.git
cd mosh
./autogen.sh
./configure
make
make install

Athena

You don't need to build here. It's in the mosh_project locker. --server='athrun mosh_project mosh-server'

Debian 6.0 Stable (squeeze)#

Nobody's packaged mosh for Debian stable yet. In lieu of doing so myself, here is the quick list of packages I found I needed to install before mosh would compile, and run:

apt-get install protobuf-compiler libprotobuf-dev libutempter-dev libboost-dev libio-pty-perl libssl-dev pkg-config autoconf

Notes:

  • libio-pty-perl is not needed for compilation/installation, just runtime
  • I installed all of the libboost-*1.42-dev pkgs as well, but I'm guessing libboost-dev is the minimum needed

Ubuntu

sudo apt-get install automake libtool g++ protobuf-compiler libprotobuf-dev libboost-dev libutempter-dev libncurses5-dev zlib1g-dev libio-pty-perl libssl-dev pkg-config

git clone https://github.com/keithw/mosh.git
cd mosh
./autogen.sh
./configure
make
make install

Notes:

  • libio-pty-perl is not needed for compilation/installation, just runtime
  • mosh-server and mosh-client will be in src/frontend/

CentOS

yum install -y protobuf-devel ncurses-devel zlib-devel openssl-devel
git clone https://github.com/mobile-shell/mosh.git
cd mosh
./autogen.sh
./configure
make
make install

Amazon Linux AMI

There are now packages in the EPEL repository for Amazon Linux AMI images. You can install with one command like this:

sudo yum --enablerepo=epel install -y mosh

(although, this is broken as of Amazon Linux version 2013.03)

---> Package mosh.x86_64 0:1.2.3-1.el6 will be installed
--> Processing Dependency: libprotobuf.so.6()(64bit) for package: mosh-1.2.3-1.el6.x86_64
--> Finished Dependency Resolution
Error: Package: mosh-1.2.3-1.el6.x86_64 (epel)
           Requires: libprotobuf.so.6()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Note that you'll also have to open up UDP ports 60000-61000. On EC2, you can do this through the AWS management console under EC2 > Security Groups.

OpenWrt

Mosh is currently not in OpenWrt packages, but can be easily built for your hardware with this Makefile.
Compiling a custom build of OpenWrt or even a single package requires some dependencies.
If you haven't compiled OpenWrt or its packages, follow https://openwrt.org/docs/guide-user/additional-software/beginners-build-guide

On Ubuntu 18.04 or later you could:

sudo apt install build-essential libncursesw5-dev python unzip
git clone https://github.com/openwrt/openwrt.git
cd openwrt

Download the Makefile into your feeds, symlink it and update feeds. See https://openwrt.org/docs/guide-developer/single.package

mkdir feeds/packages/net/mosh
wget -O feeds/packages/net/mosh/Makefile https://raw.githubusercontent.com/Strykar/openwrt_packages/master/mosh/Makefile
ln -s feeds/packages/net/mosh package/feeds/packages/mosh
./scripts/feeds update -a
./scripts/feeds install -a

Change to the tag/branch appropriate for the OpenWrt version you are currently running and ready your toolchain for cross compiling. View a list with git tag and git branch. For example:

git -b v18.06.5
make tools/install
make toolchain/install
make menuconfig

In the very least choose the appropriate...

Target System
Subtarget
Target Profile

..for your hardware, for example - x86-64 generic.

Next, navigate to Network and scroll down to select (Press M or Spacebar) mosh-client and mosh-server.
Exit, Save (to the default .config) and Exit to exit menuconfig.

make package/mosh/compile

Once the compile finishes, you can find the built packages for your selected hardware under bin/packages/$ARCH/packages/
Copy/SCP them over to your OpenWrt router and install them, for example
opkg install ./mosh-client_1.3.2-1_x86_64.ipk ./mosh-server_1.3.2-1_x86_64.ipk.
Accept UDP connections to ports 60000-60050 as required and mosh is ready to use.

Building into home directory

It's possible to build mosh (and all of its prereqs) into a custom prefix, like your home directory. This can be useful if you don't have root on your client/server. The following script will download mosh, tmux, and all the prereqs, and build them into a custom prefix:

https://gist.github.com/eminence/85961d47244a140fde89314837d0db0a