Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: apt-cacher-ng howto

  1. #1

    apt-cacher-ng howto

    This is how I set up apt-cacher-ng. I decided to write this out so I can remember how I did it, & because some other tutorials I tried to use had mistakes. It saves you from having to download the same package from repositories on different machines on a lan.

    First install the package:
    sudo apt-get install apt-cacher-ng
    Then, if you need it, more documentation is available in your browser @:
    file:///usr/share/doc/apt-cacher-ng/html/index.html

    You'll need the server to have a static IP address on your lan. Mine's 192.168.1.100

    Setup the Server:
    Make a file: /etc/apt/apt.conf.d/02proxy
    Put the following line in it:
    Acquire::http { Proxy "http://localhost:3142"; };
    Go to:
    http://localhost:3142/acng-report.html
    You should see: Apt-Cacher NG maintenance page for ~Your Desktop's Name Here~

    Setup the Client:
    sudo gedit /etc/apt/apt-conf.d/02proxy
    Put the following line in it:
    Acquire::http { Proxy "http://192.168.1.100:3142"; };

    Now you should be able to download a package on the server, & once then clients will be able to get it from there.

    If you want to import packages you downloaded prior to installing apt-cacher-ng so that they'll also be available, use sudo nautilus to copy everything in /var/cache/apt/archives to /var/cache/apt-cacher-ng/_import (you'll have to make _import)
    Then run:
    chown -R /var/cache/apt-cacher-ng /var/cache/apt-cacher-ng/_import
    Go to:
    http://localhost:3142/acng-report.html & click on the import button at the bottom of the page.
    You need to configure the server and one client before doing the import. See above for instructions.
    Run "apt-get update" on client(s) once to teach ACNG about remote locations of (volatile) index files.

    Somehow this isn't perfect. I updated the server's packages, then a client's. The client downloaded some packages from the server, but not all. Anyway, I'm happy enough for now.
    Last edited by alanwalterthomas; December 9th, 2009 at 09:46 PM. Reason: typo

  2. #2

    Re: apt-cacher-ng howto

    Now I've turned off the server & found out my laptop isn't smart enough to try going to the Internet if the server doesn't respond.
    I'd like to be able to travel with the laptop & download software/receive updates without having to get rid of the 02proxy file, then remember to put it back.

    How can I teach the computer to first look for the files on the server & if they're not found, look online?

    It would be even better if I could then have the laptop send it's downloaded packages to the central cache. Is there a better way to do that than manually importing?

  3. #3
    Join Date
    Jul 2007
    Beans
    14

    Re: apt-cacher-ng howto

    There seems to be a bug in your instructions. The path to the files should be: /etc/apt/apt.conf.d/02proxy instead of what you have listed.

    Also, I have a question: is there a way to limit the access to the maintenance page? It seems that there's nothing stopping random people from running the expiration process and slowing down the system.

  4. #4
    Join Date
    Aug 2006
    Beans
    86

    Re: apt-cacher-ng howto

    I'm already running apt-cacher, not apt-cacher-ng. I have tried using the apt-cacher-cleanup.pl script to remove packages from hardy. However, because the Package files still exist in my archive, the script will not clean these. Apparently there is a distkill.pl in apt-cacher-ng that would be useful. Is there any way to either

    1. move gracefully to apt-cacher-ng from apt-cacher (i. e. simple symbolic links between package directories) so that I can use distkill.pl

    or

    2. use distkill.pl from apt-cacher-ng within apt-cacher?

    Art Edwards
    Last edited by nardis_Miles1; January 16th, 2010 at 09:18 PM. Reason: misspelled move

  5. #5

    Re: apt-cacher-ng howto

    To save a bit of work, I made this script

    #!/bin/sh
    #This should start apt-cacher-ng
    apt-cacher-ng
    exit 0

    & wrote /path/to/this/script in /etc/rc.local
    Now apt-cacher-ng starts automatically.

    I think you're right about my mistake. Edit apt.d to apt.conf.d

    I still haven't found out anything re my questions & sorry, I don't know how to answer the others.

  6. #6
    Join Date
    Aug 2006
    Beans
    86

    Re: apt-cacher-ng howto

    If apt-cacher is similar to apt-cacher, it does this automatically. That is, apt-cacher first looks in the local cache. If it doesn't find the package, it downloads the package from a repository found in /etc/apt/sources.list and caches it simulaneously.

  7. #7
    Join Date
    Aug 2006
    Beans
    86

    Re: apt-cacher-ng howto

    I have just finished switching from apt-cacher to apt-cacher-ng.

    This is accomplised easily by:

    1. moving /var/cache/apt-cacher/packages to your home directory (//home/me)
    2. removing apt-cacher
    3. installing apt-cacher-ng
    4. executing
    mkdir /var/apt-cacher-ng/_import
    sudo mv /home/me/packages/*.deb /var/apt-cacher-ng/_import
    6. starting apt-cacher-ng (sudo /etc/init.d/apt-cacher-ng start) if it is not already started during installation
    7. pointing a browser to

    http://localhost:3143/acng-report.html

    where 3143 is my chosen port (3142 is default)

    8. clicking on Start Import button at the bottom of the page.

    It's important to note that _import is the expected name of the directory. It appears to be hard wired on the apt-cacher management web- page

    I would like to point out that the file 02proxy under /etc/apt/apt.conf.d is only required if you are using a proxy. I don't, so it was unnecessary. In fact, keeping 02proxy prevented the server from using its own apt-cacher cache. Also, I was unable to start apt-cacher-ng while apt-cacher was installed, even though I had changed the port from 3142. After removal of apt-cacher, apt-cacher-ng started and seems to work perfectly. The import was also completely successful.
    Last edited by nardis_Miles1; January 16th, 2010 at 09:21 PM. Reason: Misspelling of to (top) and added information about 02proxy file

  8. #8
    Join Date
    Aug 2006
    Beans
    233

    Re: apt-cacher-ng howto

    I've seen several people moving from apt-cacher to apt-cacher-ng, and the claim that apt-cacher is no longer supported. Is this true?

    I want to move my apt-cacher server from one machine to another, and I'm wondering if the directions for doing so are similar to your directions for switching from apt-cacher to apt-cacher-ng?

    Also,
    Quote Originally Posted by alanwalterthomas View Post
    Setup the Client:
    sudo gedit /etc/apt/apt-conf.d/02proxy
    Put the following line in it:
    Acquire::http { Proxy "http://192.168.1.100:3142"; };
    Is this what's done in apt-cacher-ng on the clients instead of editing the /ect/apt/sources.list file to use your local URLs for the repository?

    It seemes somewhat FreeBSD-needlessly-complicated to me. But maybe that's just cause I'm used to the apt-cacher way.
    Last edited by davidshere; February 9th, 2010 at 09:33 PM.

  9. #9
    Join Date
    Aug 2008
    Beans
    Hidden!

    Re: apt-cacher-ng howto

    I can't answer your question on migration since I started with -ng. But what I can say is that I tried setting up a proxy (as you quoted) and it didn't work for me - I had to edit the URLs in sources.list.

    If it worked I'd say setting a proxy is much simpler - you only have one place to change instead of having to copy it into every new repository / ppa you add.

  10. #10
    Join Date
    Aug 2006
    Beans
    233

    Re: apt-cacher-ng howto

    Quote Originally Posted by nardis_Miles1 View Post
    4. executing
    mkdir /var/apt-cacher-ng/_import
    sudo mv /home/me/packages/*.deb /var/apt-cacher-ng/_import
    On my system, the path to apt-cacher-ng is
    Code:
    /var/cache/apt-cacher-ng

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •