Cannot install Varnish on CentOS 7

Solution 1:

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.)