Summary
This article provides instructions to create a local repository for DSE installation packages that leverage apt and yum installation methods to ease upgrade and installation pain on servers that do not have external access to enable package installation downloads.
Scenario
In many cases DSE nodes, especially the servers they reside on, don't have external access to the internet. This scenario makes installing and upgrading DSE a challenge when using package installs.
Other Methods
This article does not cover methods that don't require setting up a local repository. For example, other methods use apt get to download, not install, packages from a machine that has access to the internet and then download or copy those packages to each node/server manually.
For example, these commands get the packages, but then require that you copy all these files to each respective node/server which can be laborious and time consuming:
sudo apt-get -d install
Downloads the given package and all missing dependencies to the /var/cache/apt/archives system packages directorysudo apt-get install <package_name> --download-only
Creating a local repository
A time-saving alternative is to create a local repository within your organization that holds these install packages and then leverages the apt or yum installation mechanisms.
The following steps relate productity to:
Set up an APT repository
1. Begin by installing the required packages.
$ sudo apt install -y apt-mirror
2. Create the directory structure to store the repo’s packages.
$ sudo mkdir -p /var/www/apt-mirror
3. Configure /etc/apt/mirror.list. This example synced only what I needed, which is from Ubuntu’s main and universe repos and Singapore’s local mirror (for example, sg.archive.ubuntu.com). For your setup, add other repos to taste. As an example, I’ve included the repo for PostgreSQL.
############# config ##################
#
set base_path /var/www/apt-mirror
set nthreads 20
set _tilde 0
#
############# end config ##############
deb https://debian.datastax.com/enterprise/ stable main
4. Download the Datastax repository key (gpg key):
$ curl -L https://debian.datastax.com/debian/repo_key | sudo apt-key add -
5. (Optional) If a proxy separates the repo from the Internet, add the following lines to the /etc/wgetrc.apt-mirror configuration file. The apt-mirror tool relies on wget to download packages, which in turn reads from this config file.
https_proxy = http://<your_proxy_server>:80/
http_proxy = http://<your_proxy_server>:80/
use_proxy = on
Set up a YUM repository
1. To begin, install the required packages:
$ sudo apt install -y epel-release createrepo yum-utils
2. Create the directory structure to serve the mirrored packages.
$ cd /var/www/yum-mirror
$ sudo mkdir -p datastax/x86_64/
3. (Optional) If a proxy separates the repo from the Internet, add this configuration entry to /etc/yum/yum.conf
. Otherwise, the yum.conf config file usually works out of the box.
proxy=http://<your_proxy_server>:80/
4. Create the configuration file /etc/yum/repos.d/dse.repo
. This config file tells reposync
to sync the mentioned repos. Modify baseurl
to sync from a repo close to you.
[datastax]
name=DataStax Repo for DataStax Enterprise
baseurl=https://rpm.datastax.com/enterprise/
enabled=1
gpgcheck=0
5. If signature verification (gpgcheck=1
) is enabled, import the DataStax Enterprise repository key:
sudo rpm --import https://rpm.datastax.com/rpm/repo_key
6. (Optional) To add more repos, follow the instructions from the previous step, but change the filename of the config files and the config statements. This example also syncs the EPEL repo, since the config file was added to /etc/yum/repos.d/epel.repo
. gpgcheck=0
because EPEL has many packages with missing GPG keys. Enabling gpgcheck
downloads and deletes the offending packages immediately at each sync. It’s ok to download these files to the repo. What’s important is that the clients enable gpgcheck
.
[epel]
name=Extra Packages for Enterprise Linux 7
baseurl=https://dl.fedoraproject.org/pub/epel/7/x86_64/
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7