Package Caching for Red Hat Ceph Storage on Ubuntu
About Package Caching
For Ceph clusters that are disconnected from the Internet, a caching server can be set up to provide the Red Hat Ceph Storage packages to nodes in the Ceph Storage Cluster. There are two scenarios of such a setup:
-
The caching server serves as a proxy to client hosts and the Red Hat Ceph Storage packages are downloaded from online repositories (see Caching Server with Online Repositories).
-
The Red Hat Ceph Storage packages are loaded to the caching server from the Red Hat Ceph Storage ISO image (see Caching Server with ISO Image).
This article provides instructions on using the Apt-Cacher-NG utility to set up both scenarios. In addition, this article describes how to configure client hosts to use the caching server (see Using the Caching Server).
NOTE:
With Red Hat Ceph Storage 1.3, you can use the Calamari administration host as the caching server because Apt-Cacher-NG uses a different TCP port than the Apache HTTP server. Similarly with Red Hat Ceph Storage 2, you can use the Red Hat Storage Console or Ansible administration host as the caching server. However, the following procedures assume that the caching server is on a different host than the administration host.
Caching Server with Online Repositories
In this scenario, the caching server serves as a caching proxy to client hosts and the Red Hat Ceph Storage packages are downloaded from online repositories.
-
On the caching server host, install the
apt-cacher-ngpackage:sudo apt-get install apt-cacher-ng -
If you have a firewall enabled on the caching server, open the TCP 3142 port:
sudo iptables -I INPUT 1 -i [iface] -p tcp -s [ip-address]/[netmask] --dport 3142 -j ACCEPTWhere [iface] specifies a network interface and [ip-address]/[netmask] the IP address and netmask.
Make the changes persistent:
sudo apt-get install iptables-persistent -
Edit the
acng.confconfiguration file located in the /etc/apt-cacher-ng/ directory. Add the following line to the file:BindAddress: 0.0.0.0To download the Ubuntu release files (
*.asc), add the following entry:PfilePattern:.*(\.deb|\.rpm|\.txt|\.dsc|\.tar\.gz|\.diff\.gz|\.diff\.bz2|\.udeb|\.diff/.*\.gz|\.asc|\.iso|changelog|\copyright)$Optionally, you can change or uncomment the following settings:
CacheDirLogDirPortVerboseLogPidFile
See
acng.conffor details. -
Restart Apt-Cacher NG:
a) For Ubuntu 14.04:
sudo /etc/init.d/apt-cacher-ng restartb) For Ubuntu 16.04:
sudo systemctl restart apt-cacher-ng
Caching Server with ISO Image
In this scenario, the Red Hat Ceph Storage packages are loaded to the server from an ISO image.
-
On the caching server node, install the
apt-cache-ngpackage:sudo apt-get install apt-cacher-ng -
If you have a firewall enabled on the caching server, open the TCP 3142 port:
sudo iptables -I INPUT 1 -i [iface] -p tcp -s [ip-address]/[netmask] --dport 3142 -j ACCEPTWhere [iface] specifies a network interface and [ip-address]/[netmask] the IP address and netmask.
Make the changes persistent:
sudo apt-get install iptables-persistent -
Download the Red Hat Ceph Storage ISO from https://access.redhat.com/articles/1554343.
-
Create a new directory in the
/mnt/directory to mount the ISO image to:sudo mkdir /mnt/[mount_directory]For example:
sudo mkdir /mnt/rhcs-iso -
Mount the Red Hat Ceph Storage ISO to the newly created directory:
sudo mount [ceph_ISO] /mnt/[mount_directory]For example:
sudo mount rhceph-1.3.1-ubuntu-x86_64-dvd.iso /mnt/rhcs-iso -
Create a subdirectory in the
/opt/directory for storing the ISO files:sudo mkdir /opt/[directory]For example:
sudo mkdir /opt/rhcs-1.3 -
Copy the ISO files to the directory in
/opt/:sudo cp -a /mnt/[mount_directory]/* /opt/[directory]For example:
sudo cp -a /mnt/rhcs-iso/* /opt/rhcs-1.3 -
Open the
acng.conffile located in the/etc/apt-cacher-ng/directory and modify it to point to the directory created in step 5. Uncomment the line starting with theLocalDirssetting and edit it as follows:LocalDirs: [name] [directory]Where [name] is the name of the cache and [directory] specifies the path to the directory with the ISO files. For example:
LocalDirs: rhcs-1.3 /opt/rhcs-1.3 -
Restart the
apt-cacher-ngservice:a) For Ubuntu 14.04:
sudo /etc/init.d/apt-cacher-ng restartb) For Ubuntu 16.04:
sudo systemctl restart apt-cacher-ng
Using the Caching Server
-
To download dependency packages from online Ubuntu repositories, edit the
/etc/apt/sources.listfile as follows on all Ceph cluster nodes:a) For Ubuntu 14.04:
deb http://[caching_server]:3142/archive.ubuntu.com/ubuntu trusty main restricted universeb) For Ubuntu 16.04:
deb http://[caching_server]:3142/archive.ubuntu.com/ubuntu xenial main restricted universeWhere [caching-server] specifies the host name of the caching server.
-
When following instructions listed in the This content is not included.Red Hat Ceph Storage 1.3 Installation Guide for Ubuntu, This content is not included.Red Hat Ceph Storage 2 Installation Guide for Ubuntu, or Red Hat Ceph Storage 3 Installation Guide for Ubuntu:
a) For a caching server with online repositories:
Add the caching server host name before any URL in the commands, for example “rhcs.download.redhat.com” or “https://www.redhat.com/security/fd431d51.txt". To use the HTTPS protocol, use the following format:
http://[caching_server]:3142/HTTPS///[URL]NOTE: When using Ansible to install or upgrade to Red Hat Ceph Storage 3 on Ubuntu, use the following parameter in the
/usr/share/ceph-ansible/all.ymlfile so that Ansible can automatically enable and access Ubuntu online repositories:ceph_rhcs_cdn_debian_repo: http://[caching_server]:3142/HTTPS///[user_name]:[password]@rhcs.download.redhat.comExample
To enable the Red Hat Ceph Storage 2 Tools repository, replace the following commands:
sudo bash -c 'umask 0077; echo deb https://[user_name]:[password]@rhcs.download.redhat.com/2.0-release/Tools $(lsb_release -sc) main | tee /etc/apt/sources.list.d/Tools.list' sudo bash -c 'wget -O - https://www.redhat.com/security/fd431d51.txt | apt-key add -'with these commands:
sudo bash -c 'umask 0077; echo deb http://[caching_server]:3142/HTTPS///[user_name]:[password]@rhcs.download.redhat.com/2.0-release/Tools $(lsb_release -sc) main | tee /etc/apt/sources.list.d/Tools.list' sudo bash -c 'wget -O - http://[caching_server]:3142/HTTPS///www.redhat.com/security/fd431d51.txt | apt-key add -'Replace [caching_server] with the host name of the caching server. Also, specify the user name and the password to be able to access the repository.
b) For a caching server with the ISO image:
-
Substitute the "rhcs.download.redhat.com" line with the caching server URL.
-
Replace the Red Hat security key ("https://www.redhat.com/security/fd431d51.txt") with the security key provided by the caching server depending on a type of the repository.
Example
To enable the Red Hat Ceph Storage 1.3 Installer repository, replace the following commands:
echo deb https://[user_name]:[password]@rhcs.download.redhat.com/ubuntu/1.3-updates/Installer $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/Installer.list' sudo bash -c 'wget -O - https://www.redhat.com/security/fd431d51.txt | apt-key add -'with these commands:
echo deb http://[caching_server]:3142/[name]/Installer $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/Installer.list sudo bash -c 'wget -O - http://[caching_server]:3141/[name]/Installer/release.asc | apt-key add -'Replace [caching_server] with the host name of the caching server and [name] with the name of the cache, for example
rhcs-1.3. -
Additional Resources
-
Content from www.unix-ag.uni-kl.de is not included.Apt-Cacher-NG User Manual
-
the apt-cacher-ng(8) manual page