V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
simonliu
V2EX  ›  问与答

Centos Mosh 服务器端 安装笔记

  •  
  •   simonliu · 2016-10-14 18:09:49 +08:00 · 3747 次点击
    这是一个创建于 2954 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Mosh 是个好东西,能长时间保持 SSH 的连接不断掉。 今天折腾了一个韩国的 vps ( centos 6 ),可以免费试用一个月。它的源无法直接安装 mosh ,于是折腾了一下,做个笔记。

    cd /usr/local/data
    wget https://mosh.org/mosh-1.2.6.tar.gz
    tar -zxvf mosh-1.2.6.tar.gz
    cd mosh-1.2.6
    ./config
    make
    make install
    

    中间遇到几个问题

    configure: error: in `/usr/local/data/mosh-1.2.6':
    configure: error: no acceptable C compiler found in $PATH
    

    这个通过安装 gcc 解决

    yum install gcc
    
    checking for protoc... no
    configure: error: cannot find protoc, the Protocol Buffers compiler
    

    尝试

    yum install -y protobuf-devel
    已加载插件: fastestmirror
    设置安装进程
    Loading mirror speeds from cached hostfile
     * base: ftp.daumkakao.com
     * extras: ftp.daumkakao.com
     * updates: ftp.daumkakao.com
    No package protobuf-devel available.
    

    好吧

    cd..
    git clone https://github.com/google/protobuf.git
    cd protobuf
    ./autogen.sh
    

    然后提示

    ./autogen.sh: line 35: unzip: command not found
    

    只好

    yum -y install unzip
    

    然后再次运行 autogen.sh

     autoreconf -f -i -Wall,no-obsolete
    ./autogen.sh: line 48: autoreconf: command not found
    

    需要

    yum -y install autoconf
    

    然后还是

    Can't exec "automake": 没有那个文件或目录 at /usr/bin/autoreconf line 242.
    Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 242.
    Can't exec "aclocal": 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
    autoreconf: failed to run aclocal: 没有那个文件或目录
    

    于是

    yum -y install automake autoconf
    

    但是还

    + autoreconf -f -i -Wall,no-obsolete
    configure.ac:30: error: possibly undefined macro: AC_PROG_LIBTOOL
          If this token and others are legitimate, please use m4_pattern_allow.
          See the Autoconf documentation.
    autoreconf: /usr/bin/autoconf failed with exit status: 1
    

    我晕了,继续搜索,找到解决方案

    yum install -y libtool libsysfs-dev
    

    这下./autogen.sh 不报错了,但是./configure 报如下错误

    configure: error: in `/usr/local/data/protobuf':
    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details.
    

    于是

    yum -y install glibc-headers gcc-c++
    

    然后下面三个命令就都顺利了

    ./configure
    make
    make install
    

    回到 mosh-1.2.6 目录下./configure 遇到问题:

    configure: error: Unable to find zlib.
    

    于是

    yum install zlib-devel
    

    但是再次 configure 又有

    configure: error: OpenSSL crypto library not found
    
    yum install -y openssl-devel
    

    不过还是又有错误

    checking for protobuf... no
    configure: error: Package requirements (protobuf) were not met:
    
    No package 'protobuf' found
    
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.
    
    Alternatively, you may set the environment variables protobuf_CFLAGS
    and protobuf_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.
    

    解决办法,重新编译 protobuf

    cd ../protobuf
    ./configure – prefix=/usr – libdir=/usr/lib64
    make clean
    make && make install
    

    然后回到 mosh-1.2.6 目录下

    ./configure
    make && make install
    
    2 条回复    2017-03-30 17:07:36 +08:00
    sjqlwy
        1
    sjqlwy  
       2016-11-23 22:22:01 +08:00
    非常感谢!
    DevilHunterXX
        2
    DevilHunterXX  
       2017-03-30 17:07:36 +08:00
    遇到了同样的问题,同样的坑,感谢楼主的笔记帮助脱坑!

    整理如下:
    yum -y install unzip gcc automake autoconf libtool libsysfs-dev glibc-headers gcc-c++ zlib-devel openssl-devel

    git clone https://github.com/google/protobuf.git
    cd protobuf
    ./autogen.sh
    ./configure --prefix=/usr --libdir=/usr/lib64
    make clean
    make && make install


    git clone https://github.com/mobile-shell/mosh
    cd mosh
    ./autogen.sh
    ./configure
    make
    make install
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1042 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 19:50 · PVG 03:50 · LAX 11:50 · JFK 14:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.