Search Perform an advanced search query SOFTPEDIA
 
SOFTPEDIA
Updated one minute ago
HomeSubmit a program for being reviewedAdvertise on our websiteGet help on surfing our websitesSend us your feedbackGet information about our XML/RSS backend and how to use itBrowse the news archiveVisit our discussion forumVizitati forumul in limba romana



KLIP
  1. HOME
  2. SCIENCE
  3. TECHNOLOGY
  4. WEBMASTER
  5. SECURITY
  6. MICROSOFT
  7. LINUX
  8. APPLE
  9. GAMES
  10. TELECOMS
  11. REVIEWS
  12. LIFE & STYLE
  13. EDITORIALS
  14. INTERVIEWS
  15. RSS
Welcome!
Hello, Guest

Login if you have a Softpedia.com account.

Otherwise, register for one.

UBUNTU TIPS AND TRICKS

Create a LAN Repository with Apt-Cacher

- How to save bandwidth on a local network with multiple Ubuntu systems.

By: Mihai Marinof, Linux Editor

Every bit of software on a Linux system needs to be as up to date as possible. It's the best practice against hackers and other security related risks. Sometimes, updates also add functionality and improve the stability of programs. On Ubuntu systems, the update process is completed through APT (Advanced Packaging Tool), which is a package management system initially made for Debian Linux and later used by its derivatives as well. Once the update command has been executed, APT will download the latest version of the installed packages, from an official repository.

However, if you have a local network of computers running the same distribution, you'll need to think about setting a repository cache on your network so that once an updated package is downloaded from an official repository, all other machines will download it from a local server. This way, common packages won't be downloaded more than once from official repositories, the rest of the computers will download their updates at maximum speed (LAN) and your Internet bandwidth will be saved.

If this is your situation as well, here is what you'll need to do. First, you need to configure a local machine to act as a repository cache, while the rest of the local computers will use it as a repository.

Installing Apt-Cacher

- Run the following command on the local machine that will act as a repository cache:
CODE

sudo apt-get
install apt-cacher


- Ignore the error about not being able to start apt-cacher.

Configuring Apt-Cacher

- Open /etc/apt-cacher/apt-cacher.conf with your favorite text editor and set it according to your needs. Every directive is explained in detail so there's no need for me to explain them here.

- Activate Apt-Cacher: open /etc/default/apt-cacher with your favorite text editor and set AUTOSTART to 1. This will also start Apt-Cacher on each system boot.

- Restart Apt-Cacher:
CODE

sudo /etc/init.d/apt-cacher restart


Setting up the LAN clients

- You now have to edit the file /etc/apt/sources.list on every computer on the network so they will use the local repository-cache machine, not the Internet official repository. To do that, open the sources.list file and edit it to look like this:
CODE

#ubuntu main repository
deb http://10.10.0.1:3142/archive.ubuntu.com/ubuntu/ edgy main restricted
deb-src http://10.10.0.1:3142/archive.ubuntu.com/ubuntu/ edgy main restricted

#ubuntu updates repository
deb http://10.10.0.1:3142/archive.ubuntu.com/ubuntu/ edgy-updates main restricted
deb-src http://10.10.0.1:3142/archive.ubuntu.com/ubuntu/ edgy-updates main restricted

#ubuntu security updates repository
deb http://10.10.0.1:3142/security.ubuntu.com/ubuntu edgy-security main restricted
deb-src http://10.10.0.1:3142/security.ubuntu.com/ubuntu edgy-security main restricted


NOTE: The IP 10.10.0.1 is an EXAMPLE. Replace it with the correct IP address of the machine running apt-cacher. Moreover, if you have more entries in your source.list, you need to prefix each one with the local IP of the machine running apt-cacher and the specified port.

- More examples:
CODE

deb http://archive.ubuntu.com/ubuntu/ edgy universe
deb-src http://archive.ubuntu.com/ubuntu/ edgy universe


becomes:
CODE

deb http://10.10.0.109:3142/ro.archive.ubuntu.com/ubuntu/ edgy universe
deb-src http://10.10.0.109:3142/ro.archive.ubuntu.com/ubuntu/ edgy universe


- Now that everything is set, you need to resynchronize the package index files from their sources. To do this, run the command:
CODE

sudo apt-get update


Automatically update systems every day

- Create a file called auto-update.sh in /usr/bin:
CODE

sudo touch /usr/bin/auto-update.sh


- Change its permissions to root:
CODE

sudo chmod 700 /usr/bin/auto-update.sh
sudo chown root.root /usr/bin/auto-update.sh


- Open the file /usr/bin/auto-update.sh with your favorite directory and add the following code:
CODE

#!/bin/bash

touch /var/log/auto-update.log

apt-get clean > /dev/null
apt-get autoclean > /dev/null

apt-get update >> /var/log/auto-update.log

apt-get -y upgrade >> /var/log/auto-update.log

exit



- Execute the following command to edit the crontab for user root:
CODE

sudo crontab -e


- A text editor will be opened and you'll need to add the following line AT THE END so the script will be executed every day at 14:30:
CODE

30 14 * * * /usr/bin/auto_update.sh > /dev/null


Generating reports

- Set the generate_reports directive to 1 in /etc/apt-cacher/apt-cacher.conf.
- The report is generated once a day, but if you need it at a certain time, you can force it by running:
CODE

sudo /usr/share/apt-cacher/apt-cacher-report.pl

- Check out the reports at: http://local.machine.running.apt-cache:3142/report .

MORE RELATED ARTICLES: Manage Several Desktops with One Keyboard Automated Remote Back-ups with rdiff-backup Mounting Remote Directories through SSH Installing Lighttpd on Fedora and Ubuntu GNU Screen Tutorial Creating a Local Update Repository for FC6 Wolfenstein: Enemy Territory Server Setup How to Setup an Encrypted Filesystem Grant Root Privileges to Regular Users
 
Comments | Link here | Subscribe
Print | Send to friend
Today's News | Yesterday's News

Search:

1st February 2007, 10:23 GMT | Copyright (c) 2007 Softpedia | Contact:
Read by 5,043 user(s) | Rating: | 9 vote(s) so far | Cast your vote:
Create a LAN Repository with Apt-Cacher - USER OPINIONS




We are sorry, there are no opinions available for this article.






SHARE YOUR OPINION ABOUT Create a LAN Repository with Apt-Cacher

Since you are not logged on, your comments will have to be approved before being displayed.
Click here to login, or register.
Your Name:
Your Email:
Type in the result:
Your Opinion:
 


DO YOU WANT TO CONTACT US?  

If you have some comments or you want to send us some information you can send us an email directly to .
You can use the form below for the same purpose.
Your full name: (at least 3 characters)
Your email address: (at least 5 characters)
Message subject: (at least 5 characters)
Message text:
(at least 10 characters)
Type in the result:
 
 



© 2001 - 2008 Softpedia. All rights reserved.
Softpedia™ and Softpedia™ logo are registered trademarks of SoftNews NET SRL.
Copyright Information | Privacy Policy | Terms of Use | Contact Softpedia | Update your software | Archive