Cannot install Varnish on CentOS 7

jnbdz asked:

I am trying to install Varnish 4 on CentOS 7.

I first added these rpm:

sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/jemalloc-3.6.0-1.el6.x86_64.rpm
sudo rpm -iUvh http://195.220.108.108/linux/centos/7.0.1406/extras/x86_64/Packages/epel-release-7-2.noarch.rpm

yum install varnish

But I get this:

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.team-cymru.org
 * epel: mirror.steadfast.net
 * extras: mirror.team-cymru.org
 * updates: mirror.team-cymru.org
Resolving Dependencies
--> Running transaction check
---> Package varnish.x86_64 0:4.0.2-1.el6 will be installed
--> Processing Dependency: varnish-libs = 4.0.2-1.el6 for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvarnishapi.so.1(LIBVARNISHAPI_1.3)(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvarnishapi.so.1(LIBVARNISHAPI_1.2)(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvarnishapi.so.1(LIBVARNISHAPI_1.0)(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvarnishapi.so.1(LIBVARNISHAPI_1.1)(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvarnishapi.so.1()(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libpcre.so.0()(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvcc.so()(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvarnishcompat.so()(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvarnish.so()(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Processing Dependency: libvgz.so()(64bit) for package: varnish-4.0.2-1.el6.x86_64
--> Running transaction check
---> Package varnish.x86_64 0:4.0.2-1.el6 will be installed
--> Processing Dependency: libpcre.so.0()(64bit) for package: varnish-4.0.2-1.el6.x86_64
---> Package varnish-libs.x86_64 0:4.0.2-1.el6 will be installed
--> Processing Dependency: libpcre.so.0()(64bit) for package: varnish-libs-4.0.2-1.el6.x86_64
--> Finished Dependency Resolution
Error: Package: varnish-libs-4.0.2-1.el6.x86_64 (varnish-4.0)
           Requires: libpcre.so.0()(64bit)
           Available: varnish-4.0.0-0.20131129tp1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-4.0.0-0.20140328beta1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-4.0.0-1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-libs-4.0.0-0.20131129tp1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-libs-4.0.0-0.20140328beta1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-libs-4.0.0-1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-4.0.1-1.el6.x86_64 (varnish-4.0)
               Not found
           Available: varnish-4.0.1-2.el7.x86_64 (epel)
               Not found
           Installing: varnish-4.0.2-1.el6.x86_64 (varnish-4.0)
               Not found
           Available: varnish-libs-4.0.1-1.el6.x86_64 (varnish-4.0)
               Not found
           Available: varnish-libs-4.0.1-2.el7.x86_64 (epel)
               Not found
           Installing: varnish-libs-4.0.2-1.el6.x86_64 (varnish-4.0)
               Not found
Error: Package: varnish-4.0.2-1.el6.x86_64 (varnish-4.0)
           Requires: libpcre.so.0()(64bit)
           Available: varnish-4.0.0-0.20131129tp1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-4.0.0-0.20140328beta1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-4.0.0-1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-libs-4.0.0-0.20131129tp1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-libs-4.0.0-0.20140328beta1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-libs-4.0.0-1.el6.x86_64 (varnish-4.0)
               libpcre.so.0()(64bit)
           Available: varnish-4.0.1-1.el6.x86_64 (varnish-4.0)
               Not found
           Available: varnish-4.0.1-2.el7.x86_64 (epel)
               Not found
           Installing: varnish-4.0.2-1.el6.x86_64 (varnish-4.0)
               Not found
           Available: varnish-libs-4.0.1-1.el6.x86_64 (varnish-4.0)
               Not found
           Available: varnish-libs-4.0.1-2.el7.x86_64 (epel)
               Not found
           Installing: varnish-libs-4.0.2-1.el6.x86_64 (varnish-4.0)
               Not found
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

My answer:


I don’t know whose instructions you were following, but either the instructions were wrong, or they were the wrong instructions.

On a clean CentOS 7 system you can install Varnish 4 simply by:

yum install epel-release
yum install varnish

Since your system is no longer clean, you will have to clean it up first. In particular:

  1. You installed the jemalloc package from EL6. You need to replace this with the one for EL7. Since you already have the EPEL repo installed, it should be sufficient to do:

    yum update jemalloc
    

    Otherwise just remove and reinstall it.

    rpm --nodeps -e jemalloc
    yum install jemalloc
    
  2. You installed a repository named varnish-4.0 from somewhere (probably the Varnish Community) but you failed to mention this. You need to remove this, as (a) it’s only intended for EL6, and (b) EPEL already ships Varnish 4.

    rpm --nodeps -e $(rpm -qf /etc/yum.repos.d/varnish*.repo)
    
  3. Finally your system should be clean and you can install Varnish.

    yum install varnish
    

A final note: EPEL Varnish will trail upstream Varnish point releases due to EPEL’s enterprise QA requirements. If tracking point releases is important to you, you may wish to participate in the QA process for this package in EPEL. This usually involves building or installing a test package and then voting it up or down based on whether it works or not. (For instance, at the time of this writing, Varnish 4.0.2 is the latest upstream, and it needs 3 more upvotes to be promoted to stable in EPEL.)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.