Setting up an ëApt-Cache' Server Using ëApt-Cacher-NG' in Ubuntu 14.04 Server


Use Apt-Cacher-NG to configure an Apt-Cache server in Ubuntu 14.04 Server by following these instructions. First, install the Apt-Cacher-NG package via the terminal. The configuration file should then be modified to include the cache directory and approved networks. Restart the service to make the changes effective. The Apt-Cache server's IP address should then be included to the sources.to set up clients to use it, list file. So that the cache can be applied, update the package listings on the clients. The Apt-Cacher-NG server can store and offer package updates with this configuration, which reduces bandwidth usage and speeds up the setting up of new packages on several devices.

Methods Used

  • Manual Installation and Configuration

  • Docker Container

Manual Installation and Configuration

To install manually and setup an Apt-Cache server using Apt-Cacher-NG on Ubuntu 14.04 Server, use the terminal to install the Apt-Cacher-NG package. The configuration file (/etc/apt-cacher-ng/acng.conf) should then be updated to include the authorised networks and cache directory. To apply the adjustments, restart the service. Then, the sources should include the IP address of the Apt-Cacher-NG server.list file on the client PCs to set up the computers. Finally, modify the package listings on the clients in order to start employing the cache. This approach allows for efficient management of the installation process and allows for customization of the server parameters to optimum caching in a given network environment. By employing an Apt-Cache server, package installations can be streamlined, bandwidth usage can be reduced, and system performance can be increased.

Algorithm

  • Obtaining the Apt-Cacher-NG package first  Download the Apt-Cacher-NG package using a package manager (such as apt-get).

sudo apt-get update
sudo apt-get install apt-cacher-ng
  • Config file alterations

  • Open the setup file (/etc/apt-cacher-ng/acng.conf) in a text editor.

  • To describe which clients can access the server, define the authorised networks.

  • Define the cache directory, where the package files will be stored.

sudo nano /etc/apt-cacher-ng/acng.conf
  • To make the changes to the settings file effective, restart the Apt-Cacher-NG service.

sudo service apt-cacher-ng restart
  • Configure the client computers. Change the sources.each client computer's list of files.

  • Revisit the references.list file with the Apt-Cacher-NG server's IP address.

  • This tells the client to use the cache server to refresh packages.

sudo nano /etc/apt/sources.list

The next line should now be present in the sources.list file on every client's machine:

deb http://<apt-cacher-ng-server-ip>:3142/archive.ubuntu.com/ubuntu trusty main

"apt-cacher-ng-server-ip>" should be replaced with the Apt-Cacher-NG server's IP address.

  • modify the client package lists  On each client computer, use the package management modify command (such as apt-get update).

  • By obtaining the package listings from the Apt-Cacher-NG server, this fills the cache.

sudo apt-get update
  • Complete − Users can now download and update packages using the Apt-Cache server that was setup.

Docker Container

Apt-Cache may be installed with Apt-Cacher-NG in Ubuntu 14.04 Server using a Docker container. Known as a Docker container, a programme and its dependencies are bundled in a compact, isolated environment. Apt-Cacher-NG The necessary setup can be built into containers using either pre-made or custom Docker images. Start the container and open the required ports to launch the Apt-Cacher-NG server. Client machines can then utilise the IP address of the Apt-Cacher-NG container in their sources.File list. By changing their package lists, the clients can utilise the cache stored in the Docker container, which optimises package installations and consumes less bandwidth.

Algorithm

  • Install the Apt-Cacher-NG package using a package manager (such as apt-get or yum).

sudo apt-get install apt-cacher-ng
  • Modify the configuration file (/etc/apt-cacher-ng/acng.conf)'s authorised networks, cache directory, and other settings.

sudo nano /etc/apt-cacher-ng/acng.conf
  • Restart the Apt-Cacher-NG service to take effect from the changes.

sudo service apt-cacher-ng restart
  • Set-Up the Apt-Cacher-NG server on user PCs by configuring them to do so after adding the server's IP address to the sources.list file.

sudo nano /etc/apt/sources.list
  • Modify "server_ip" to the Apt-Cacher-NG server's IP address.

deb http://<server_ip>:3142/archive.ubuntu.com/ubuntu/ trusty main restricted
  • Modify the package listings on the clients to start using the cache.

sudo apt-get update
  • You may flexibly control and keep track of the Apt-Cacher-NG server using its web interface (http://:3142/acng-report.html).

  • Use 'apt-get update' and 'apt-get upgrade' on the server machine to ad-hoc update the Apt-Cacher-NG server.

sudo apt-get update
sudo apt-get upgrade
  • Keep an eye on the disc usage and clean it as necessary to stop the cache from expanding out of hand.

sudo apt-get autoclean

Conclusion

In conclusion, setting up an Apt-Cache server and installing Apt-Cacher-NG on Ubuntu 14.04 Server provides a useful package management option. By following the instructions for either the manual installation and configuration technique or by utilising Docker containers, users can build up a dependable Apt-Cache server. These methods provide you the flexibility to change the arrangement to meet certain demands. Clients can benefit from the Apt-Cache server's lower bandwidth use and quicker package installations by using the cached packages. Whether you decide for manual configuration or Docker containers, implementing an Apt-Cache server in Ubuntu 14.04 Server optimises package management and significantly increases system speed. Because it saves time and resources, the ability to cache package updates is essential for efficiently managing a large number of devices.

Updated on: 03-Aug-2023

180 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements