How to change the directory of the apt-cacher-ng downloaded packages

| | 1 min read

As you have configured the apt-cacher-ng server, Now you have to change the directory where the packages will be downloaded. This is to ensure that you will provide a directory which has large space to store files or packages. To change the current directory to a new directory you have to the following steps.

To change the path you have to edit the following configuration file

  sudo nano /etc/apt-cacher-ng/acng.conf  

Now change the value of CacheDir and also create a folder with owner ng-cacher-ng:ng-cacher-ng and the permissions for this folder as 2755. For this

  sudo chown -R apt-cacher-ng:apt-cacher-ng   /path/to/the/cachedirectory
sudo chmod -R 2755 /path/to/the/cachedirectory  

To import already downloaded packages, We have to create a folder inside the cachedirectory and copy all the contents from /var/cache/apt/archieves to /path/to/cachedirectory

  sudo cp /var/cache/apt/archieves* /path/to/cachedirectory  

Now you can open a browser and type this address on the address bar

  http://your_server_ip:3142/acng-report.html  

And click the “Start import” button on this page.

Hope this Helps.