さくらのVPS(CentOS6)にmoshを入れるメモ


話題のmoshをMacOSXとさくらのVPS(CentOS6)に入れるメモ。

# CentOS 6 に mosh をインストール

mosh が epel-testing リポジトリにあったのでそれを入れる。

```
$ sudo yum install mosh --enablerepo=epel-testing
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * epel: ftp.jaist.ac.jp
 * epel-testing: ftp.jaist.ac.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mosh.x86_64 0:1.1.1-1.el6 will be installed
--> Processing Dependency: perl-IO-Tty for package: mosh-1.1.1-1.el6.x86_64
--> Processing Dependency: perl(IO::Pty) for package: mosh-1.1.1-1.el6.x86_64
--> Processing Dependency: libprotobuf.so.6()(64bit) for package: mosh-1.1.1-1.el6.x86_64
--> Running transaction check
---> Package perl-IO-Tty.x86_64 0:1.08-4.el6 will be installed
---> Package protobuf.x86_64 0:2.3.0-7.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                      Arch                    Version                       Repository                     Size
========================================================================================================================
Installing:
 mosh                         x86_64                  1.1.1-1.el6                   epel-testing                  182 k
Installing for dependencies:
 perl-IO-Tty                  x86_64                  1.08-4.el6                    base                           40 k
 protobuf                     x86_64                  2.3.0-7.el6                   epel                          287 k

Transaction Summary
========================================================================================================================
Install       3 Package(s)

Total download size: 509 k
Installed size: 1.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): mosh-1.1.1-1.el6.x86_64.rpm                                                               | 182 kB     00:00     
(2/3): perl-IO-Tty-1.08-4.el6.x86_64.rpm                                                         |  40 kB     00:00     
(3/3): protobuf-2.3.0-7.el6.x86_64.rpm                                                           | 287 kB     00:00     
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   1.5 MB/s | 509 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : protobuf-2.3.0-7.el6.x86_64                                                                          1/3 
  Installing : perl-IO-Tty-1.08-4.el6.x86_64                                                                        2/3 
  Installing : mosh-1.1.1-1.el6.x86_64                                                                              3/3 

Installed:
  mosh.x86_64 0:1.1.1-1.el6                                                                                             

Dependency Installed:
  perl-IO-Tty.x86_64 0:1.08-4.el6                             protobuf.x86_64 0:2.3.0-7.el6                            

Complete!
```

UDP 60000:61000 ポート開放をする。

# MacOSX に mosh をインストール

```
$ sudo brew install mobile-shell
```

# mosh でつないでみる

```
$ mosh {サーバ}
```

sshのポート番号を22番ポートから変えている場合は、${HOME}/.ssh/config などで設定しておく必要があります。

## 参考
http://blog.glidenote.com/blog/2012/04/11/mosh-on-sakura-vps/
http://d.hatena.ne.jp/Kenji_s/20120411/mosh_on_sakura_vps