Some Linux Tips




LINKS

Fedora For Newbies
awardspace.com "free webhost"
drivehq.com "free storage"
spideroak.com "free storage"
dnsexit dynamic dns server
freedns.afraid dynamic dns server
dns.he.net dynamic dns server




index   Previous   Next


Install the apt-utils, we will describe some of these tools.
First create the repo dirs, we suppose to create in the store:

mkdir -r /store/debian/main
mkdir -r /store/debian/dists


copy the all .deb packages to the main and run the command apt-ftparchive in the debian dir:

cd /store/debian
apt-ftparchive packages main | gzip >dists/Packages.gz


This will creat the Packages.gz in the dists dir, now add this repo to the /etc/apt/sources.list:

deb file:///store/debian dists/

The problem with the file:/// is, if you add the debian remote repos then the aptitude will use the local repo and will downlaod the same package again from the remote repo, to solve this problem use the AptPreferences.
Create a file with any name like "local" in the /etc/apt/preferences.d with these lines:

Package: *
Pin: origin
Pin-Priority: 700


Or can put the repo in local web server default hotsname root document dir or simply creat a semi link to that repos as:

cd /home/www/example.net/htdocs
ln -s /store/debian ./


Now add this repo to the apt sources.list:

deb http://localhost/debian dists/

For the update manager to use the local repo in the first priority, create a file with any name like local in the /etc/apt/preferences.d with these lines:

Package: *
Pin: origin localhost
Pin-Priority: 1000

Package: *
Pin: origin ftp2.jp.debian.org
Pin-Priority: 500

Package: *
Pin: origin security.debian.org
Pin-Priority: 500


Replace the remote repos name for your repo.
Run the apt-get update, to check the repos priority run the command :

apt-cache policy

If you want more complex local repos run the debarchiver in the debian dir with this parameters:

debarchiver -a -b -d /store/debian/dists --distinputcriteria -x -o --ignoredestcheck

This will create defferent dists dirs like sid, squeezy, testing, ... and within these dirs their components like main, cotrib, non-free To add these repos to the sources.list first write the deb means binary package then the url http://localhost/debian then with or without a forward slash after debian with a space write the dist name squeeze and then with sapces add their components like main contrib non-free:

deb http://lcoalhost/debian squeeze main contrib non-free

You use the above rules for the debian remote repos as well.
Another simple way is to use the dpkg-scanpackages, you don't need the dists dir for this run the dpkg-scanpackages in the debian dir:

dpkg-scanpackages main /dev/null | gzip -9c > main/Packages.gz

add this repo to the sources.list as:

deb file:///store/debian main/

To install a local package and resolve it's dependencies from the remote repos run the dpkg:

dpkg -i && aptitude -f package_name


To exclude a package from upgrade install the wajig with:

aptitude install wajig

then run the wajig to hold the packages:

# wajig hold package_name

To update again unhold the package with wajig unhold package_name.
To install the latest unstale packages, creat a file /etc/apt/preferences.d/unstable with these lines:

Package: *
Pin: release a=unstable
Pin-Priority: 900

Package: *
Pin: release a=testing
Pin-Priority: 800

Package: *
Pin: release o=Debian
Pin-Priority: -10


To find which package contain this file, run the apt-cache:

apt-cache search file_name
dpkg -S file_name