How to Install Serverspec in the Current Version on Ubuntu 14.04 LTS (Trusty)
If you google "serverspec install ubuntu", you find the information that a package called
ruby-serverspec in the standard package repository can be used to install Serverspec on an Ubuntu 14.04 LTS based system. Unfortunately, this package installs an outdated version of Serverspec. The next point is that if you try to install the newest version of Serverspec with gem (that's the way that it is described on the Serverspec homepage), you will get the following error message:
1~> sudo gem install serverspec 2ERROR: Error installing serverspec: 3net-ssh requires Ruby version >= 2.0.
The problem is, when you install Ruby with
sudo apt-get install ruby, the package manager installs Ruby in the version 1.9.1 . Therefore, the next sections explain how to install Ruby and Serverspec in the newest version on an Ubuntu 14.04 LTS based system. Let's start with Ruby that is required for Serverspec.
The cloud hosting service Brightbox provides Ruby package repositories for several Ubuntu versions and several Ruby version. I chose the repository for Ruby 2.3 packages, so the installation steps are:
1~> sudo apt-get install software-properties-common 2~> sudo apt-add-repository ppa:brightbox/ruby-ng 3~> sudo apt-get update 4~> sudo apt-get install ruby2.3 5~> ruby --version 6ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux-gnu]
Now, we can install Serverspec like it is explained on the Serverspec homepage. In my case, I had to install
1~> sudo gem install serverspec rake