Programming/Coding

The Pains of Installing TMUX on a Shared Server

I kept getting disconnected from my server while I was working and it was really frustrating me when I’d have to reconnect with ssh, “cd” back into the directory I was working in, and then open all of my VIM buffers after cleaning up all of their confused “.swp” files. Yea, a huge pain in the ass.

Anyway, what I ended up doing is deciding that I really need to get used to using GNU Screen. I’ve used it a couple times before at work, but never got used to it. That’s when I remember that a coworker of mine told me that if I haven’t gotten used to using Screen, that I should try out “tmux” instead. I got excited that I’d be on the cutting edge…

Well, I have a shared hosting setup through site5 (I don’t have the money for a VPS), so naturally when I typed in “tmux” into my ssh terminal session, nothing happened. Wonderful, I was going to have to manually install it without root access.

After numerous pains of running into dependency problems, libraries not being found, and crazy amounts of Google searches later…. I have “tmux” running. :)

Here’s what I did to make it all happen:

cd ~
mkdir local
mkdir temp
mv tmux-1.5.tar.gz temp
mv libevent-2.0.12-stable.tar.gz temp
cd temp
tar xvfz tmux-1.5.tar.gz
tar xvfz libevent-2.0.12-stable.tar.gz
cd libevent-2.0.12-stable
./configure --prefix=$HOME/local
make
make install
cd ../tmux-1.5
DIR="$HOME/local"
./configure CFLAGS="-I$DIR/include" LDFLAGS="-L$DIR/lib"
make
cp tmux ~/local/bin
export PATH=$HOME/local/bin:$PATH
export LD_LIBRARY_PATH="$HOME/local/lib"

tmux


Woot! It works! Of course, though, you’ll want to add the “export” commands to your “~/.bashrc” file so that you they’re done on login.

Ok, so my terminal might be 10,000 lines more full… but I’ve cleaned up the crap and given you the working results.

I doubt anyone will run into the exact same problems as I did, as it all depends on the setup of your server and what dependencies you already have. Also, this isn’t the best way of going about installing unix tools normally, but I didn’t have root or su capabilities. Anyway, I’m leaving this here in case anyone does run into a similar problem… or at least for archival purposes (I’m not going to remember how to do this, haha).

Hope this helps!

  • http://sixohthree.com/ Adam Backstrom

    –prefix!

    • http://about.me/tnsuarez Rican7

      ooo… good catch.
      Thank you sir

  • Craig Laparo

    Here’s a bash script version that downloads the files instead of moving them to temp. It also appends the export commands to ~/.bashrc Of course, you’ll have to update the script to get the new versions of tmux and libevent.

    #!/bin/bash
    cd ~
    mkdir local
    mkdir temp
    cd temp
    wget http://iweb.dl.sourceforge.net/project/tmux/tmux/tmux-1.5/tmux-1.5.tar.gz
    wget https://github.com/downloads/libevent/libevent/libevent-2.0.14-stable.tar.gz –no-check-certificate
    tar xvfz tmux*
    tar xvfz libevent*
    cd libevent*
    ./configure –prefix=$HOME/local && make && make install
    cd ../tmux*
    DIR=”$HOME/local”
    ./configure CFLAGS=”-I$DIR/include” LDFLAGS=”-L$DIR/lib” && make && cp tmux ~/local/bin
    export PATH=$HOME/local/bin:$PATH
    export LD_LIBRARY_PATH=”$HOME/local/lib”
    echo ‘export PATH=$HOME/local/bin:$PATH’ >> ~/.bashrc
    echo ‘export LD_LIBRARY_PATH=”$HOME/local/lib”‘ >> ~/.bashrc
    cd ~
    rm -rf temp
    tmux

    • Jason Charney

      Put the exported variables in .bash_profile not .bashrc

      Also, libevents and tmux both have had upgrades. So be sure to check their websites for the newest stables.

      Outside of that it work. I’ll share my version of the script on my website later.

  • MBS

    >> Thank you!! <<

    Just got into tmux (saw the book over at Pragmatic Programmers) & this was helpful for installing it locally (same situation as you – I'm on a shared server [Dreamhost]).

    This worked perfectly, thanks for documenting every step of what you did, you saved me a lot of time & trouble.

    • http://about.me/tnsuarez Rican7

      Absolutely! :D
      I’m glad I could help.
      I figured I’d post this and it would help someone (or me later, when I would forget how to do it again).

      Anyway, thanks for letting me know in the comments. :)

      • Hier

        This worked for me as well so you can rest assured that you have made the world a better place.

  • http://twitter.com/amackera Anson MacKeracher

    Thanks! very useful.

  • Charlotte

    I was able to create the makefile but to compile it, I needed to add LIBEVENT_LIBS=”-L$DIR/lib -levent” to the configure line. Apparently, tmux only works with recent versions of libevent and if and older version of libevent-dev is already installed, there can be problems.

    • http://about.me/tnsuarez Rican7

      Yea, that makes sense. Good call. :)