SKM IT World

Just another blog about IT


Leave a comment

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:


~> sudo gem install serverspec
ERROR:  Error installing serverspec:
net-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.

Ruby Installation

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:


~> sudo apt-get install software-properties-common
~> sudo apt-add-repository ppa:brightbox/ruby-ng
~> sudo apt-get update
~> sudo apt-get install ruby2.3
~> ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux-gnu]

Serverspec Installation

Now, we can install Serverspec like it is explained on the Serverspec homepage. In my case, I had to install rake separately.

~> sudo gem install serverspec rake

Links

  1. Serverspec Homepage
  2. Brightbox Ruby package repositories for Ubuntu documentation


1 Comment

How To Debug Groovy Script From Shell

Groovy is a scripting language, so it is possible to run Groovy code without compiling to Java byte code. The necessary condition is that Groovy is installed on your machine. Then, running a Groovy script in a shell looks like the following line.


~>groovy TestScript.groovy

Now, something is wrong with the script, only on a special environment. So you want to debug your Groovy script from the shell. Fortunately, it works for Groovy just like for Java. You only have to export the Java options for debugging.


~>export JAVA_OPTS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y"

Now, we can debug our script running from the shell with our favorite IDE.


~>groovy TestScript.groovy
Listening for transport dt_socket at address: 4000


Leave a comment

Git Resources for Beginner

In this post I’d like to share resources that help me learning and understanding Git.

Links

Do you have some more resources that you can recommend? Let me know it and write a comment.


2 Comments

Set up a Proxy P2 Repository with Nexus OOS

Assumption

I assume Nexus OOS in version 2.1.2 is installed. You can find a good tutorial in Sonatype’s Nexus book Repository Management with Nexus (Chapter 3: Installing and Running Nexus).

Preparation

For the set up of a proy P2 repository three Nexus plugins are needed:

  • Nexus Capability Plugin (It is contained  in the basic Nexus installation)
  • Nexus P2 Bridge Plugin 2.0.5 (Download)
  • Nexus P2 Repository Plugin 2.2  (Download)

It is important that you download the artifacts ending with -bundle.zip. Unzip both plugins in the directory $NEXUS_HOME/../sonatype-work/nexus/plugin-repository of your Nexus instance. Restart your Nexus instance. Then follow the instruction for creating a proxy P2 repository in the Sonatype Nexus book.

Troubleshooting

After I had created two proxy P2 Repositories, Nexus ran unstable. It restarted every night, automatically. A post in Nexus Mailing List advised me to increasing the heap space to 1024MB for a stable run with proxies P2 Repository:

  1. Open the config file $NEXUS_HOME/nexus/bin/jsw/conf/wrapper.conf.
  2. Edit the property wrapper.java.maxmemory.

Increasing the heap space to 1024MV solves my problem.

Links