3.1 KiB
Vic020
Linux FAQs with Answers--How to install autossh on Linux
Question: I would like to install autossh on [insert your Linux distro]. How can I do that?
autossh is an open-source tool that allows you to monitor an SSH session and restart it automatically should it gets disconnected or stops forwarding traffic. autossh assumes that passwordless SSH login for a destination host is already setup, so that it can restart a broken SSH session without user's involvement.
autossh comes in handy when you want to set up reverse SSH tunnels or mount remote folders over SSH. Essentially in any situation where persistent SSH sessions are required, autossh can be useful.
Here is how to install autossh on various Linux distributions.
Install Autossh on Debian or Ubuntu
autossh is available in base repositories of Debian based systems, so installation is easy.
$ sudo apt-get install autossh
Install Autossh on Fedora
Fedora repositories also carry autossh package. So simply use yum command.
$ sudo yum install autossh
Install Autossh on CentOS or RHEL
For CentOS/RHEL 6 or earlier, enable Repoforge repository first, and then use yum command.
$ sudo yum install autossh
For CentOS/RHEL 7, autossh is no longer available in Repoforge repository. You will need to build it from the source (explained below).
Install Autossh on Arch Linux
$ sudo pacman -S autossh
Compile Autossh from the Source on Debian or Ubuntu
If you would like to try the latest version of autossh, you can build it from the source as follows.
$ sudo apt-get install gcc make
$ wget http://www.harding.motd.ca/autossh/autossh-1.4e.tgz
$ tar -xf autossh-1.4e.tgz
$ cd autossh-1.4e
$ ./configure
$ make
$ sudo make install
Compile Autossh from the Source on CentOS, Fedora or RHEL
On CentOS/RHEL 7, autossh is not available as a pre-built package. So you'll need to compile it from the source as follows.
$ sudo yum install wget gcc make
$ wget http://www.harding.motd.ca/autossh/autossh-1.4e.tgz
$ tar -xf autossh-1.4e.tgz
$ cd autossh-1.4e
$ ./configure
$ make
$ sudo make install