Activities

September 2014
M T W T F S S
« Aug   Oct »
1234567
891011121314
15161718192021
22232425262728
2930  

How do setup Ubuntu local repository or Setting up Ubuntu cache repository

Prior to publish the Ubuntu desktops clones to all users, I need to setup a Ubuntu local repository to minimize the new package installation time as well as Internet bandwidth by setting up a local cache repository.

Earlier in our CentOS distribution, we uses a local repository and update it according the new package releases from Redhat network. So I want to use the same mechanism here for Ubuntu systems too.

Here we go,

1. Install apt-cacher package.

Server side installation

root@rc-151:~# apt-get install apt-cacher
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were auto

During the installation, you will see the screen as shown below. Choose the option “daemon” to start this service on the system boot time.

apt-cache-1

a, Ensure that “AUTOSTART=1” set on /etc/default/apt-cacher file.

b. This is the main configuration file (/etc/apt-cacher/apt-cacher.conf) in which control the Ubuntu package cache related settings.

I would recommend you to change the default cache location (cache_dir = /var/cache/apt-cacher)to some other mounted location as it may grow rapidly based on your future package installation. So you must need more Gig storage for this area.

2. Install Apache webserver

root@admin-desktop:# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 92 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]

3. Start APT-Cache service

root@rc-151:~# /etc/init.d/apt-cacher start
Starting Apt-Cacher: apt-cacher.
root@rc-151:~# netstat -nlp | grep ":3142"
tcp6       0      0 :::3142                 :::*                    LISTEN      20048/perl
root@rc-151:~#

Client side settings

You need to create a file (/etc/apt/apt.conf.d/001-apt-proxy.conf) on each user desktop and add the Ubuntu cache server IP using the following syntax. Ensure that you can reach the Ubuntu cache server using telnet command.

Acquire::http::Proxy “http://192.168.0.113:3142”;.

root@rc-151:~# cat /etc/apt/apt.conf.d/001-apt-proxy.conf
Acquire::http::Proxy "http://192.168.0.113:3142";
root@rc-151:~#
root@rc-151:~# telnet 192.168.0.113 3142
Trying 192.168.0.113...
Connected to 192.168.0.113.
Escape character is '^]'.
^C^]
telnet> quit
Connection cl

Now it’s the time for your Cache settings . Now I’m going to install Gftp ( ftp client tool) on my Ubuntu desktop.

root@rc-151:~# apt-get install gftp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  esound-common libaudiofile1 libesd0 libopenal-data libopenal1 libsvga1
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  gftp-common gftp-gtk gftp-text
The following NEW packages will be installed:
  gftp gftp-common gftp-gtk gftp-text
0 upgraded, 4 newly installed, 0 to remove and 109 not upgraded.
Need to get 636 kB of archives.
After this operation, 4,035 kB of additional disk space will be used.
Do you want to continue? [Y/n]

You can see that this package is download from Internet this time.

apt-cache-2

Now I’m going to uninstall and install it again.

[root@rc-151:~# apt-get remove gftp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  esound-common gftp-common gftp-gtk gftp-text libaudiofile1 libesd0
  libopenal-data libopenal1 libsvga1
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  gftp
0 upgraded, 0 newly installed, 1 to remove and 109 not upgraded.
After this operation, 33.8 kB disk space will be freed.
Do you want to continue? [Y/n]

apt-cache-3

You also check the volume of cache whether it is growing up and find the files downloaded in it.

root@test-desktop:/home/test# du -sh /var/cache/apt-cacher/
472M    /var/cache/apt-cacher/
root@test-desktop:/home/test# ls  /var/cache/apt-cacher/packages/*

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>