Oddly, there isn’t a lot of information on installing Varnish 3 on CentOS 7. There’s well-written instructions on the official site for CentOS 5/6, but for 7, it seems like you’re stuck with Varnish 4 (from the epel-release repository), especially if you’ve searched around and found forum threads like this one.
I did some digging, though, and it turns out that there actually are packages for CentOS 7 – there just isn’t any documentation on how to install them. I played around a little and found something that worked, though. So far, I haven’t experienced any problems installing via the following:
yum install gcc rpm -i https://repo.varnish-cache.org/redhat/varnish-3.0/el7/x86_64/varnish/varnish-libs-3.0.6-1.el7.centos.x86_64.rpm rpm -i https://repo.varnish-cache.org/redhat/varnish-3.0/el7/x86_64/varnish/varnish-libs-devel-3.0.6-1.el7.centos.x86_64.rpm rpm -i https://repo.varnish-cache.org/redhat/varnish-3.0/el7/x86_64/varnish/varnish-3.0.6-1.el7.centos.x86_64.rpm
You do need to install the packages in this order, as Varnish depends on having gcc and the libraries in place.
You may need to adjust the config and point the pidfile to varnishd.pid instead of varnish.pid in /etc/rc.d/init.d/varnish. If you do, remember to run systemctl daemon-reload and kill all active processes before starting the service again.
UPDATE: From the comments, Sergey Postument recommends setting up an independent yum repo with the following configuration:
[varnish-3.0] name=Varnish 3.0 for Enterprise Linux baseurl=https://repo.varnish-cache.org/redhat/varnish-3.0/el7/$basearch enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-VARNISH
…and lrkwz recommends installing using
yum –enablerepo=varnish-3.0 –disablerepo=epel install varnish