Knowledgebase

How to Create Your Own Debian Mirror Proxy Using Apt-Cache Print

  • 0

Introduction

Apt-Cache can be used to cache downloaded Debian/Ubuntu packages without the need for additional server configuration, and is very useful for those who have more than two servers.

Requirements

  • Debian or Ubuntu
  • 10 Minutes time

Installation

Apt-Cache is available in the default Debian/Ubuntu repositories and be installed via apt-get as follows:

apt-get install apt-cacher

Configuration

Apt-Cache accepts all requests by default; as such, we would need to customize its configuration file, /etc/apt-cacher/apt-cacher.conf as follows:

allowed_hosts = <YOUR_SERVER_IP_OR_NETWORK> <YOUR_LAN> <CAN BE * FOR ANY>
daemon_port = <THE_DAEMON_PORT>

To block specific hosts, you can use the denied_hosts directive:

denied_hosts = <BLOCKED_IP>

To apply our changes, we have to restart the daemon as follows:

service apt-cacher restart

Usage

You can now use your Apt-Cacher by editing the /etc/apt/sources.list file on your server. This is how it would look like on Debian Jessie:

deb http://<INSTANCE_IP>:<DAEMON_PORT>/http.us.debian.org/debian/ jessie main
deb-src http://<INSTANCE_IP>:<DAEMON_PORT>/http.us.debian.org/debian/ jessie main

deb http://<INSTANCE_IP>:<DAEMON_PORT>/security.debian.org/ jessie/updates main
deb-src http://<INSTANCE_IP>:<DAEMON_PORT>/security.debian.org/ jessie/updates main

deb http://<INSTANCE_IP>:<DAEMON_PORT>/http.us.debian.org/debian/ jessie-updates main
deb-src http://<INSTANCE_IP>:<DAEMON_PORT>/http.us.debian.org/debian/ jessie-updates main

This concludes out tutorial. Thank you for reading.

Introduction Apt-Cache can be used to cache downloaded Debian/Ubuntu packages without the need for additional server configuration, and is very useful for those who have more than two servers. Requirements Debian or Ubuntu 10 Minutes time Installation Apt-Cache is available in the default Debian/Ubuntu repositories and be installed via apt-get as follows: apt-get install apt-cacher Configuration Apt-Cache accepts all requests by default; as such, we would need to customize its configuration file, /etc/apt-cacher/apt-cacher.conf as follows: allowed_hosts = daemon_port = To block specific hosts, you can use the denied_hosts directive: denied_hosts = To apply our changes, we have to restart the daemon as follows: service apt-cacher restart Usage You can now use your Apt-Cacher by editing the /etc/apt/sources.list file on your server. This is how it would look like on Debian Jessie: deb http://:/http.us.debian.org/debian/ jessie main deb-src http://:/http.us.debian.org/debian/ jessie main deb http://:/security.debian.org/ jessie/updates main deb-src http://:/security.debian.org/ jessie/updates main deb http://:/http.us.debian.org/debian/ jessie-updates main deb-src http://:/http.us.debian.org/debian/ jessie-updates main This concludes out tutorial. Thank you for reading.

Was this answer helpful?
Back

Powered by WHMCompleteSolution