Saturday, April 23, 2016

How to Compile OPENSSH from Sources in the Respository on Ubuntu 16.04 LTS

In this post, I will describe how to check out the most recent openssh sources from the git repository and compile.

First, let's install necessary packages,
$ sudo apt-get install -y git autoconf libssl-dev zlib1g-dev

To clone from the git repository,
$ git clone git://anongit.mindrot.org/openssh.git

Next, go into the directory and read the instruction.
$ cd openssh
$ less INSTALL

Now that you are familiar with the instruction, let's go on. Create the configure file
$ autoreconf

Create the build directory and enter
$ mkdir build && cd build

Configure
$ ../configure

Make
$ make -j 2

Here, I am utilizing two cores, so the number 2 after -j option, but if you have an quad-core processor, you may want to use -j 4 option instead.

That's it. Let's verify that it is successful.
$./ssh -V
$ ssh -V

The two should output different!

3 comments:

  1. This was helpful, but I'm trying to find correct instructions for building something which matches the distribution, as a reference point before I start modifying. The output ssh executable from following this post has a file size of 2,810,544, the size of the distribution ssh executable is 727,920.

    ReplyDelete
    Replies
    1. Make install must remove the debugging information, after that this build is size 707,272. Much closer to expected, but still doesn't match the distribution.

      Delete
    2. Which distribution version are you trying to build? You will need to check out the corresponding source code. Try the following in the openssh directory
      $ git branch
      $ git checkout V_x_y
      and compile again.

      Delete