3

I use phing as a deployment tool on CentOS and I'd like to use the SshTask, which required libssh2 to be installed.

I tried "pecl install ssh2" but that asks me for a libssh2 prefix [/usr?]

I noticed that this means I need to install libssh2 first, but yum does not have that package. So my question is: what is the best way to install libssh2 on Centos and then install the pecl extension?

5

to install libssh2 on centos follow the next steps:

  1. download libssh2 from the official website (look for in google - i don't have reputation and can't post but 1 link)

  2. extract it somewhere, then open a terminal and go in the folder where you extracted it and type these commands

    ./configure
    
    make
    
    make install
    

ALSO

you can install the rpmforge repos from DAG from here:

http://dag.wieers.com/rpm/packages/rpmforge-release/

(check your version, if you're on i386 you'll probably have to get the "Red Hat EL 5 - i386" one)

then do a

yum install libssh2
| improve this answer | |
  • thanks, perfect info. Now when I'm installing "pecl install ssh2" it asks "libssh2 prefix? [/usr]". Is that ok, or should it be "/usr/lib/libssh2.so.1"? [user@centos deployment]# rpm -ql libssh2 /usr/lib/libssh2.so.1 – solsol Jun 2 '10 at 21:48
  • no matter what I type there, it says: configure: error: The required libssh2 library was not found. You can obtain that package from sourceforge.net/projects/libssh2 ERROR: `/tmp/pear/download/ssh2-0.11.0/configure --with-ssh2=/usr/lib/libssh2.so.1' failed – solsol Jun 2 '10 at 21:49
  • 1
    solved: it needed this: yum install libssh2-devel – solsol Jun 2 '10 at 21:56
  • except for new errors: running: make /tmp/pear/download/ssh2-0.11.0/ssh2.c:1104: warning: passing argument 4 of 'add_assoc_stringl_ex' discards qualifiers from pointer target type /tmp/pear/download/ssh2-0.11.0/ssh2.c:1105: warning: passing argument 4 of 'add_assoc_stringl_ex' discards qualifiers from pointer target type make: *** [ssh2.lo] Error 1 ERROR: `make' failed – solsol Jun 2 '10 at 21:58
2

You need libssh2-devel not just libssh2. Here's a little shorter version

yum install libssh2-devel
pecl install ssh2-0.12
| improve this answer | |
  • No package libssh2-devel available. when trying to install libssh2-devel – vladkras Jan 8 '16 at 14:04
  • @vladkras which version of CentOS/RHEL and which repositories do you have installed (EPEL? Remi? etc)? – Eric Kigathi Jan 12 '16 at 8:18
  • I have CentOS 6 and remi repo, check my answer for more info – vladkras Jan 12 '16 at 14:11
  • 2
    If you have "remi" repository, it provides php-pecl-ssh2, no need to build anything. – Remi Collet Jan 12 '16 at 14:57
0

Effort to install libssh2-devel using yum failed with error No package libssh2-devel available. (remi repo)

I downloaded it from PECL website and installed via

# pecl install -f packagename.tgz

All other packages and dependencies were downloaded from rpmfind.net and installed like this

# rpm -ivh packagename.rpm
| improve this answer | |
0

This is what I did.

wget https://libssh2.org/download/libssh2-1.7.0.tar.gz
tar zxvf libssh2-1.7.0.tar.gz
cd libssh2-1.7.0
./configure
make
sudo make install
sudo yum install libssh2 libssh2-devel
sudo pecl install ssh2-0.13
| improve this answer | |
-1
  1. Install it using yum:

    $ sudo yum install libssh2-devel-1.8.0-3.el7.x86_64.rpm

    As a result:

    Installed:   libssh2-devel.x86_64 0:1.8.0-3.el7
    
    Dependency Installed:   keyutils-libs-devel.x86_64 0:1.5.8-3.el7
       krb5-devel.x86_64 0:1.15.1-37.el7_7.2
       libcom_err-devel.x86_64 0:1.42.9-16.el7
       libkadm5.x86_64 0:1.15.1-37.el7_7.2
       libselinux-devel.x86_64 0:2.5-14.1.el7
       libsepol-devel.x86_64 0:2.5-10.el7
       libverto-devel.x86_64 0:0.2.5-4.el7
       openssl-devel.x86_64 1:1.0.2k-19.0.1.el7
       pcre-devel.x86_64 0:8.32-17.el7
       zlib-devel.x86_64 0:1.2.7-18.el7
    

    And now, trying to install ssh2 could be resulted in error:

    # pecl install ssh2
    downloading ssh2-0.13.tgz ...
    Starting to download ssh2-0.13.tgz (28,984 bytes)
    .........done: 28,984 bytes
    6 source files, building
    running: phpize
    Can't find PHP headers in /usr/include/php
    The php-devel package is required for use of this command.
    ERROR: `phpize' failed
    

    If it happened, try to install php-devel package from remi repository.

  2. Installing remi repository (for RHEL7 like system):

    $ sudo rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

  3. Enabling remi repository by editing remi.repo file:

    $ sudo vi /etc/yum.repos.d/remi.repo

    changing enabled=0 to enabled=1 in [remi]'s section if you're using php 5.4

    To see what php version you're using, you could use the command:

    $ sudo yum info php

  4. Installing php-devel package:

    $ sudo yum install php-devel

  5. Installing ssh2:

    $ sudo pecl install ssh2

Additionaly:
Note: Use it only for testing purposes, not for production. Because of using packages not from official sources could cause issues in the future.

Download libssh2-devel package version you need from rpmfind.net, copying link address of file needed and pasting it after wget:

wget https://rpmfind.net/linux/centos/7.7.1908/os/x86_64/Packages/libssh2-devel-1.8.0-3.el7.x86_64.rpm

(be cautious before using packages from not official resources)

| improve this answer | |
  • 1
    Installing random RPMs from random places on the Internet is a great way to brick your system. – womble Sep 30 '19 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.