Installation instructions

Start using packagecloud in minutes

Join thousands of developers using packagecloud to distribute software securely, consistently, and affordably.

Bash Scripts

deb

deb

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish51/script.deb.sh | sudo bash
#!/bin/bash

unknown_os ()
{
  echo "Unfortunately, your operating system distribution and version are not supported by this script."
  echo
  echo "You can override the OS detection by setting os= and dist= prior to running this script."
  echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
  echo
  echo "For example, to force Ubuntu Trusty: os=ubuntu dist=trusty ./script.sh"
  echo
  echo "Please email support@packagecloud.io and let us know if you run into any issues."
  exit 1
}

curl_check ()
{
  echo "Checking for curl..."
  if command -v curl > /dev/null; then
    echo "Detected curl..."
  else
    echo "Installing curl..."
    apt-get install -q -y curl
  fi
}

install_debian_keyring ()
{
  if [ "${os}" = "debian" ]; then
    echo "Installing debian-archive-keyring which is needed for installing "
    echo "apt-transport-https on many Debian systems."
    apt-get install -y debian-archive-keyring &> /dev/null
  fi
}


detect_os ()
{
  if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
    # some systems dont have lsb-release yet have the lsb_release binary and
    # vice-versa
    if [ -e /etc/lsb-release ]; then
      . /etc/lsb-release

      if [ "${ID}" = "raspbian" ]; then
        os=${ID}
        dist=`cut --delimiter='.' -f1 /etc/debian_version`
      else
        os=${DISTRIB_ID}
        dist=${DISTRIB_CODENAME}

        if [ -z "$dist" ]; then
          dist=${DISTRIB_RELEASE}
        fi
      fi

    elif [ `which lsb_release 2>/dev/null` ]; then
      dist=`lsb_release -c | cut -f2`
      os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`

    elif [ -e /etc/debian_version ]; then
      # some Debians have jessie/sid in their /etc/debian_version
      # while others have '6.0.7'
      os=`cat /etc/issue | head -1 | awk '{ print tolower($1) }'`
      if grep -q '/' /etc/debian_version; then
        dist=`cut --delimiter='/' -f1 /etc/debian_version`
      else
        dist=`cut --delimiter='.' -f1 /etc/debian_version`
      fi

    else
      unknown_os
    fi
  fi

  if [ -z "$dist" ]; then
    unknown_os
  fi

  # remove whitespace from OS and dist name
  os="${os// /}"
  dist="${dist// /}"

  echo "Detected operating system as $os/$dist."
}

main ()
{
  detect_os
  curl_check

  # Need to first run apt-get update so that apt-transport-https can be
  # installed
  echo -n "Running apt-get update... "
  apt-get update &> /dev/null
  echo "done."

  # Install the debian-archive-keyring package on debian systems so that
  # apt-transport-https can be installed next
  install_debian_keyring

  echo -n "Installing apt-transport-https... "
  apt-get install -y apt-transport-https &> /dev/null
  echo "done."


  gpg_key_url="https://packagecloud.io/varnishcache/varnish51/gpgkey"
  apt_config_url="https://packagecloud.io/install/repositories/varnishcache/varnish51/config_file.list?os=${os}&dist=${dist}&source=script"

  apt_source_path="/etc/apt/sources.list.d/varnishcache_varnish51.list"

  echo -n "Installing $apt_source_path..."

  # create an apt config file for this repository
  curl -sSf "${apt_config_url}" > $apt_source_path
  curl_exit_code=$?

  if [ "$curl_exit_code" = "22" ]; then
    echo
    echo
    echo -n "Unable to download repo config from: "
    echo "${apt_config_url}"
    echo
    echo "This usually happens if your operating system is not supported by "
    echo "packagecloud.io, or this script's OS detection failed."
    echo
    echo "You can override the OS detection by setting os= and dist= prior to running this script."
    echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
    echo
    echo "For example, to force Ubuntu Trusty: os=ubuntu dist=trusty ./script.sh"
    echo
    echo "If you are running a supported OS, please email support@packagecloud.io and report this."
    [ -e $apt_source_path ] && rm $apt_source_path
    exit 1
  elif [ "$curl_exit_code" = "35" -o "$curl_exit_code" = "60" ]; then
    echo "curl is unable to connect to packagecloud.io over TLS when running: "
    echo "    curl ${apt_config_url}"
    echo "This is usually due to one of two things:"
    echo
    echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
    echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
    echo
    echo "Contact support@packagecloud.io with information about your system for help."
    [ -e $apt_source_path ] && rm $apt_source_path
    exit 1
  elif [ "$curl_exit_code" -gt "0" ]; then
    echo
    echo "Unable to run: "
    echo "    curl ${apt_config_url}"
    echo
    echo "Double check your curl installation and try again."
    [ -e $apt_source_path ] && rm $apt_source_path
    exit 1
  else
    echo "done."
  fi

  echo -n "Importing packagecloud gpg key... "
  # import the gpg key
  curl -L "${gpg_key_url}" 2> /dev/null | apt-key add - &>/dev/null
  echo "done."

  echo -n "Running apt-get update... "
  # update apt on this system
  apt-get update &> /dev/null
  echo "done."

  echo
  echo "The repository is setup! You can now install packages."
}

main
rpm

rpm

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish51/script.rpm.sh | sudo bash
#!/bin/bash

unknown_os ()
{
  echo "Unfortunately, your operating system distribution and version are not supported by this script."
  echo
  echo "You can override the OS detection by setting os= and dist= prior to running this script."
  echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
  echo
  echo "For example, to force CentOS 6: os=el dist=6 ./script.sh"
  echo
  echo "Please email support@packagecloud.io and let us know if you run into any issues."
  exit 1
}

curl_check ()
{
  echo "Checking for curl..."
  if command -v curl > /dev/null; then
    echo "Detected curl..."
  else
    echo "Installing curl..."
    yum install -d0 -e0 -y curl
  fi
}


detect_os ()
{
  if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then
    if [ -e /etc/os-release ]; then
      . /etc/os-release
      os=${ID}
      if [ "${os}" = "poky" ]; then
        dist=`echo ${VERSION_ID}`
      elif [ "${os}" = "sles" ]; then
        dist=`echo ${VERSION_ID}`
      elif [ "${os}" = "opensuse" ]; then
        dist=`echo ${VERSION_ID}`
      else
        dist=`echo ${VERSION_ID} | awk -F '.' '{ print $1 }'`
      fi

    elif [ `which lsb_release 2>/dev/null` ]; then
      # get major version (e.g. '5' or '6')
      dist=`lsb_release -r | cut -f2 | awk -F '.' '{ print $1 }'`

      # get os (e.g. 'centos', 'redhatenterpriseserver', etc)
      os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'`

    elif [ -e /etc/oracle-release ]; then
      dist=`cut -f5 --delimiter=' ' /etc/oracle-release | awk -F '.' '{ print $1 }'`
      os='ol'

    elif [ -e /etc/fedora-release ]; then
      dist=`cut -f3 --delimiter=' ' /etc/fedora-release`
      os='fedora'

    elif [ -e /etc/redhat-release ]; then
      os_hint=`cat /etc/redhat-release  | awk '{ print tolower($1) }'`
      if [ "${os_hint}" = "centos" ]; then
        dist=`cat /etc/redhat-release | awk '{ print $3 }' | awk -F '.' '{ print $1 }'`
        os='centos'
      elif [ "${os_hint}" = "scientific" ]; then
        dist=`cat /etc/redhat-release | awk '{ print $4 }' | awk -F '.' '{ print $1 }'`
        os='scientific'
      else
        dist=`cat /etc/redhat-release  | awk '{ print tolower($7) }' | cut -f1 --delimiter='.'`
        os='redhatenterpriseserver'
      fi

    else
      aws=`grep -q Amazon /etc/issue`
      if [ "$?" = "0" ]; then
        dist='6'
        os='aws'
      else
        unknown_os
      fi
    fi
  fi

  if [[ ( -z "${os}" ) || ( -z "${dist}" ) ]]; then
    unknown_os
  fi

  # remove whitespace from OS and dist name
  os="${os// /}"
  dist="${dist// /}"

  echo "Detected operating system as ${os}/${dist}."
}

finalize_yum_repo ()
{
  echo "Installing pygpgme to verify GPG signatures..."
  yum install -y pygpgme --disablerepo='varnishcache_varnish51'
  pypgpme_check=`rpm -qa | grep -qw pygpgme`
  if [ "$?" != "0" ]; then
    echo
    echo "WARNING: "
    echo "The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system. "
    echo "To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this. "
    echo "More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F"
    echo

    # set the repo_gpgcheck option to 0
    sed -i'' 's/repo_gpgcheck=1/repo_gpgcheck=0/' /etc/yum.repos.d/varnishcache_varnish51.repo
  fi

  echo "Installing yum-utils..."
  yum install -y yum-utils --disablerepo='varnishcache_varnish51'
  yum_utils_check=`rpm -qa | grep -qw yum-utils`
  if [ "$?" != "0" ]; then
    echo
    echo "WARNING: "
    echo "The yum-utils package could not be installed. This means you may not be able to install source RPMs or use other yum features."
    echo
  fi

  echo "Generating yum cache for varnishcache_varnish51..."
  yum -q makecache -y --disablerepo='*' --enablerepo='varnishcache_varnish51'
}

finalize_zypper_repo ()
{
  zypper --gpg-auto-import-keys refresh varnishcache_varnish51
}

main ()
{
  detect_os
  curl_check


  yum_repo_config_url="https://packagecloud.io/install/repositories/varnishcache/varnish51/config_file.repo?os=${os}&dist=${dist}&source=script"

  if [ "${os}" = "sles" ] || [ "${os}" = "opensuse" ]; then
    yum_repo_path=/etc/zypp/repos.d/varnishcache_varnish51.repo
  else
    yum_repo_path=/etc/yum.repos.d/varnishcache_varnish51.repo
  fi

  echo "Downloading repository file: ${yum_repo_config_url}"

  curl -sSf "${yum_repo_config_url}" > $yum_repo_path
  curl_exit_code=$?

  if [ "$curl_exit_code" = "22" ]; then
    echo
    echo
    echo -n "Unable to download repo config from: "
    echo "${yum_repo_config_url}"
    echo
    echo "This usually happens if your operating system is not supported by "
    echo "packagecloud.io, or this script's OS detection failed."
    echo
    echo "You can override the OS detection by setting os= and dist= prior to running this script."
    echo "You can find a list of supported OSes and distributions on our website: https://packagecloud.io/docs#os_distro_version"
    echo
    echo "For example, to force CentOS 6: os=el dist=6 ./script.sh"
    echo
    echo "If you are running a supported OS, please email support@packagecloud.io and report this."
    [ -e $yum_repo_path ] && rm $yum_repo_path
    exit 1
  elif [ "$curl_exit_code" = "35" -o "$curl_exit_code" = "60" ]; then
    echo
    echo "curl is unable to connect to packagecloud.io over TLS when running: "
    echo "    curl ${yum_repo_config_url}"
    echo
    echo "This is usually due to one of two things:"
    echo
    echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)"
    echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version"
    echo
    echo "Contact support@packagecloud.io with information about your system for help."
    [ -e $yum_repo_path ] && rm $yum_repo_path
    exit 1
  elif [ "$curl_exit_code" -gt "0" ]; then
    echo
    echo "Unable to run: "
    echo "    curl ${yum_repo_config_url}"
    echo
    echo "Double check your curl installation and try again."
    [ -e $yum_repo_path ] && rm $yum_repo_path
    exit 1
  else
    echo "done."
  fi

  if [ "${os}" = "sles" ] || [ "${os}" = "opensuse" ]; then
    finalize_zypper_repo
  else
    finalize_yum_repo
  fi

  echo
  echo "The repository is setup! You can now install packages."
}

main
pip

python

Are you using virtualenv?

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish51/script.python.sh | bash
#!/bin/bash

curl_check ()
{
  echo "Checking for curl..."
  if command -v curl > /dev/null; then
    echo "Detected curl..."
  else
    echo "curl could not be found, please install curl and try again"
    exit 1
  fi
}


virtualenv_check ()
{
  if [ -z "$VIRTUAL_ENV" ]; then
    echo "Detected VirtualEnv: Please visit https://packagecloud.io/varnishcache/varnish51/install#virtualenv"
  fi
}

new_global_section ()
{
  echo "No pip.conf found, creating"
  mkdir -p "$HOME/.pip"
  pip_extra_url > $HOME/.pip/pip.conf
}

edit_global_section ()
{
  echo "pip.conf found, making a backup copy, and appending"
  cp $HOME/.pip/pip.conf $HOME/.pip/pip.conf.bak
  awk -v regex="$(escaped_pip_extra_url)" '{ gsub(/^\[global\]$/, regex); print }' $HOME/.pip/pip.conf.bak > $HOME/.pip/pip.conf
  echo "pip.conf appended, backup copy: $HOME/.pip/pip.conf.bak"
}

pip_check ()
{
  version=`pip --version`
  echo $version
}

abort_already_configured ()
{
  if [ -e "$HOME/.pip/pip.conf" ]; then
    if grep -q "varnishcache/varnish51" "$HOME/.pip/pip.conf"; then
      echo "Already configured pip for this repository, skipping"
      exit 0
    fi
  fi
}

pip_extra_url ()
{
  printf "[global]\nextra-index-url=https://packagecloud.io/varnishcache/varnish51/pypi/simple\n"
}

escaped_pip_extra_url ()
{
  printf "[global]\\\nextra-index-url=https://packagecloud.io/varnishcache/varnish51/pypi/simple"
}

edit_pip_config ()
{
  if [ -e "$HOME/.pip/pip.conf" ]; then
    edit_global_section
  else
    new_global_section
  fi
}

main ()
{
  abort_already_configured
  curl_check
  virtualenv_check
  pip_check


  edit_pip_config

  echo "The repository is setup! You can now install packages."
}

main
gem

gem

Are you using Bundler?

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish51/script.gem.sh | bash
#!/bin/bash

gem source --add https://packagecloud.io/varnishcache/varnish51/

Manual Installation

If you'd prefer to install your repo on your system manually, follow the instructions below. If you feel something is missing or just want more info, don't hesitate to get in touch.

deb

deb

In order to install a deb repo, first you need to install the GPG key that used to sign repository metadata. You do that using a utility called apt-key.

curl -L https://packagecloud.io/varnishcache/varnish51/gpgkey | sudo apt-key add -

Refresh your package cache by running

sudo apt-get update

If you are running Debian, install debian-archive-keyring so that official Debian repositories will be verified (Ubuntu users can skip this)

sudo apt-get install debian-archive-keyring

Install a package called apt-transport-https to make it possible for apt to fetch packages over https.

sudo apt-get install -y apt-transport-https

Create a file named /etc/apt/sources.list.d/varnishcache_varnish51.list that contains the repository configuration below.

Make sure to replace ubuntu and trusty in the config below with your Linux distribution and version:

deb https://packagecloud.io/varnishcache/varnish51/ubuntu/ trusty main
deb-src https://packagecloud.io/varnishcache/varnish51/ubuntu/ trusty main

Valid options for os and dist parameters can be found in our support OS list in the docs.

Run:

sudo apt-get update

to update your local APT cache.

You can now install packages from your repository.

rpm

rpm

Install pygpgme, a package which allows yum to handle gpg signatures, and a package called yum-utils which contains the tools you need for installing source RPMs.

sudo yum install pygpgme yum-utils

You may need to install the EPEL repository for your system to install these packages. If you do not install pygpgme, GPG verification will not work.

Create a file named /etc/yum.repos.d/varnishcache_varnish51.repo that contains the repository configuration below.

Make sure to replace el and 6 in the config below with your Linux distribution and version:

[varnishcache_varnish51]
name=varnishcache_varnish51
baseurl=https://packagecloud.io/varnishcache/varnish51/el/6/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/varnishcache/varnish51/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[varnishcache_varnish51-source]
name=varnishcache_varnish51-source
baseurl=https://packagecloud.io/varnishcache/varnish51/el/6/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/varnishcache/varnish51/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Valid options for os and dist parameters can be found in our supported OS list in the docs.

Update your local yum cache by running

sudo yum -q makecache -y --disablerepo='*' --enablerepo='varnishcache_varnish51'

You can now install packages from your repository.

zypper

zypper

Create a file named /etc/zypp/repos.d/varnishcache_varnish51.repo that contains the repository configuration below.

Make sure to replace el and 6 in the config below with your Linux distribution and version:

[varnishcache_varnish51]
name=varnishcache_varnish51
baseurl=https://packagecloud.io/varnishcache/varnish51/opensuse/13.2/$basearch
enabled=1
repo_gpgcheck=1
pkg_gpgcheck=0
gpgkey=https://packagecloud.io/varnishcache/varnish51/gpgkey
autorefresh=1
type=rpm-md

[varnishcache_varnish51-source]
name=varnishcache_varnish51-source
baseurl=https://packagecloud.io/varnishcache/varnish51/el/6/SRPMS
enabled=1
repo_gpgcheck=1
pkg_gpgcheck=0
gpgkey=https://packagecloud.io/varnishcache/varnish51/gpgkey
autorefresh=1
type=rpm-md

Valid options for os and dist parameters can be found in our supported OS list in the docs.

Update your local zypper cache by running

zypper --gpg-auto-import-keys refresh varnishcache_varnish51

You can now install packages from your repository.

rubygems

rubygems

Add the repository as a source

To install gems from this repository, you'll need to add the repository as a source.

gem source --add https://packagecloud.io/varnishcache/varnish51/

Using Bundler?

Add the repository to your Gemfile

To install gems from this repository, you'll need to add it as a source to your Gemfile.

Bundler 1.7.0 and above

In newer bundler versions, you can scope specific gems to a source, like so:

# Gemfile

# Note: It's recommended you add the official https://rubygems.org source, unless your
#       packagecloud repository can meet all of the dependency requirements in the Gemfile.

source "https://rubygems.org"
source "https://packagecloud.io/varnishcache/varnish51" do
  gem "my-gem"
  gem "another-gem"
end

Legacy versions of Bundler

Older versions of Bundler have several bugs around scoping gems to a single source using blocks, so you'll have to add the source globally at the top of the Gemfile.

# Gemfile

source "https://rubygems.org"
source "https://packagecloud.io/varnishcache/varnish51"
python

python

To install python packages from this repository, you'll need to add the repository as a source to pip.

Add the repository to pip

Add the repository to the [global] section in your ~/.pip/pip.conf

[global]
extra-index-url=https://packagecloud.io/varnishcache/varnish51/pypi/simple

Note: if you would like pip to use only this repository as a source, replace extra-index-url with index-url

VirtualEnv / requirements.txt

Add the repository to your VirtualEnv

Ensure you are running the latest version of pip inside your virtualenv:

my_virtualenv/bin/pip install --upgrade pip

Add this to the bottom of your requirements.txt

--extra-index-url=https://packagecloud.io/varnishcache/varnish51/pypi/simple

Note: if you would like pip to use only this repository as a source, replace extra-index-url with index-url

If you're looking for further clarification on anything, don't hesitate to get in touch!

Chef Cookbook

If you use chef to manage your infrastructure, you're in luck! We maintain a cookbook that makes it really easy to get up and running.

Using Berkshelf to manage your cookbooks? Depend on our cookbook like this:

cookbook "packagecloud"

If you're managing your cookbooks some other way, you can get our cookbook from supermarket.chef.io or github.

Once you have our cookbook installed, all you have to do to install this repo is add the following block to one of your recipes:

packagecloud_repo "varnishcache/varnish51" do
  type "deb" # or "rpm" or "gem"
end

The LWRP in our cookbook will determine what OS/Version you're on and setup the repository correctly for that particular node. It will also contact our installation API to issue a read token, and make sure our gpg key gets installed if necessary.

Puppet Module

If you use puppet to manage your infrastructure, you're in luck! We maintain a module that makes it really easy to get up and running.

You can get our module on Puppet Forge or on GitHub.

To get this repo installed, you just need to add the following to one of your manifests:

include packagecloud

packagecloud::repo { "varnishcache/varnish51":
  type => 'rpm',  # or "deb" or "gem"
}

The module will determine what OS/Version you're on and setup the repository correctly for that particular node. It will also contact our installation API to issue a read token, and make sure our gpg key gets installed if necessary.

Using Bundler and packagecloud

Add the repository to your Gemfile

To install gems from this repository, you'll need to add it as a source to your Gemfile.

Bundler 1.7.0 and above

In newer bundler versions, you can scope specific gems to a source, like so:

# Gemfile

# Note: It's recommended you add the official https://rubygems.org source, unless your
#       packagecloud repository can meet all of the dependency requirements in the Gemfile.

source "https://rubygems.org"
source "https://packagecloud.io/varnishcache/varnish51" do
  gem "my-gem"
  gem "another-gem"
end

Legacy versions of Bundler

Older versions of Bundler have several bugs around scoping gems to a single source using blocks, so you'll have to add the source globally at the top of the Gemfile.

# Gemfile

source "https://rubygems.org"
source "https://packagecloud.io/varnishcache/varnish51"

Using VirtualEnv and packagecloud

Add the repository to your VirtualEnv

Ensure you are running the latest version of pip inside your virtualenv:

my_virtualenv/bin/pip install --upgrade pip

Add this to the bottom of your requirements.txt

--extra-index-url=https://packagecloud.io/varnishcache/varnish51/pypi/simple

Note: if you would like pip to use only this repository as a source, replace extra-index-url with index-url

Using Maven with Packagecloud

Add the repository to Maven

Add this to the dependencyManagement section of your pom.xml

<repositories>
  <repository>
    <id>varnishcache-varnish51</id>
    <url>https://packagecloud.io/varnishcache/varnish51/maven2</url>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

Using Leiningen with Packagecloud

Add the repository to Leiningen

Add this entry to the top-level of your project.clj file

:repositories [["snapshots" "https://packagecloud.io/varnishcache/varnish51/maven2"]
               ["releases" "https://packagecloud.io/varnishcache/varnish51/maven2"]]

Using SBT with Packagecloud

Add the repository to SBT

For SNAPSHOT support (needs SBT 0.13.8 or above), create or append the following to a project/maven.sbt file in your project:

addMavenResolverPlugin

Then, add this entry anywhere in your build.sbt file:

resolvers += "varnishcache-varnish51" at "https://packagecloud.io/varnishcache/varnish51/maven2"