Difference between revisions of "Local repository"

From ArchWiki
Jump to: navigation, search
Line 4: Line 4:
 
This document outlines one way to share Arch Linux packages across a LAN. A better way to do this would be to create a [[Custom local repository with ABS and gensync]] and make the repository available across the LAN using NFS or FTP. This document should be edited to describe this process in detail. For the time being, the original HOWTO is left intact below:
 
This document outlines one way to share Arch Linux packages across a LAN. A better way to do this would be to create a [[Custom local repository with ABS and gensync]] and make the repository available across the LAN using NFS or FTP. This document should be edited to describe this process in detail. For the time being, the original HOWTO is left intact below:
  
<pre>
 
 
To share all your downloaded packages in your lan
 
To share all your downloaded packages in your lan
 
Pros  save bandwidth, diskspace and time.
 
Pros  save bandwidth, diskspace and time.
Line 18: Line 17:
  
  
1. serverside
+
== on the server side ==
 
on your server create an nfs share readwrite for all pc on your lan
 
on your server create an nfs share readwrite for all pc on your lan
  
 
If you run Arch Linux on the server you can
 
If you run Arch Linux on the server you can
pacman -S portmap
+
  pacman -S portmap
pacman -S nfs-utils
+
  pacman -S nfs-utils
  
 
edit /etc/exports
 
edit /etc/exports
 
add line
 
add line
/var/cache/pacman/pkg 192.168.14.0/255.255.255.0(rw,no_root_squash,sync)
+
  /var/cache/pacman/pkg
 +
  192.168.14.0/255.255.255.0 (rw,no_root_squash,sync)
 
add portmap, nfslock and nfsd to DAEMONS in /etc/rc.conf
 
add portmap, nfslock and nfsd to DAEMONS in /etc/rc.conf
  
run /etc/rc.d/portmap start
+
run the followings:
run  /etc/rc.d/nfslock start
+
  # /etc/rc.d/portmap start
run  /etc/rc.d/nfsd start
+
  # /etc/rc.d/nfslock start
to check the nfsshare run "exportfs" on server.
+
  # /etc/rc.d/nfsd start
 +
check the nfsshare run "exportfs" on server.
  
1.1 Check hosts.allow and hosts.deny
+
=== Check hosts.allow and hosts.deny===
  
 
to work (very simple):
 
to work (very simple):
Line 50: Line 51:
 
hosts.allow allow connection from local network 192.168.14.0/255.255.255.0
 
hosts.allow allow connection from local network 192.168.14.0/255.255.255.0
  
2. on all clients
+
== on all clients==
rename  /var/cache/pacman/pkg  to /var/cache/pacman/pkgorg
+
*rename  /var/cache/pacman/pkg  to /var/cache/pacman/pkgorg
create a new /var/cache/pacman/pkg and mount the nfs share there
+
*create a new /var/cache/pacman/pkg and mount the nfs share there
 
+
*run "mount -o rw,nolock 192.168.14.3:/var/cache/pacman/pkg /var/cache/pacman/pkg"
run "mount -o rw,nolock 192.168.14.3:/var/cache/pacman/pkg /var/cache/pacman/pkg"
+
*if the mount from command line does not work add this option "nfsvers=3"
#Comment # if the mount from command line does not work add this option "nfsvers=3"
+
or if you want it automount after the reboot,
or if you want it automount on client reboot
+
 
add this line in /etc/fstab
 
add this line in /etc/fstab
192.168.14.3:/var/cache/pacman/pkg /var/cache/pacman/pkg    nfs    rw,nolock
+
  192.168.14.3:/var/cache/pacman/pkg /var/cache/pacman/pkg    nfs    rw,nolock
#again if the mount does not work, try to add mount option nfsvers=3 to the fstab entry.
+
*again if the mount does not work, try to add mount option nfsvers=3 to the fstab entry.
run "mount -a"
+
*run "mount -a"
run "df" to check mount
+
*run "df" to check mount
 +
*move all your already fetched pkg from your clients
 +
  /var/cache/pacman/pkgorg to /var/cache/pacman/pkg
 +
*edit /etc/pacman.conf and add this lines directly after the line
  
move all your already fetched pkg from your clients
+
  {current}
/var/cache/pacman/pkgorg to /var/cache/pacman/pkg
+
  Server = file:///var/cache/pacman/pkg
  
edit /etc/pacman.conf and add this lines directly after the line
+
''' and after '''
 +
  {extra}
 +
  Server = file:///var/cache/pacman/pkg
  
{current}
+
I have skipped the step 3 because for me it works as i want already. I sync from each PC and all share the pacman cache.
Server = file:///var/cache/pacman/pkg
+
  
    '''''' and after ''''''
+
== To sync your local repository v.s. archlinux.org==
{extra}
+
*"alsync" connects, login, and update your packages database on the local nfsserver
Server = file:///var/cache/pacman/pkg
+
  pacman -S openssl
 +
  pacman -S wget
  
#Comment # I have skipped the step 3 because for me it works as i want already. I sync from each PC and all share the pacman cache.
 
  
3. To sync your local repository v.s. archlinux.org
+
*create a file called /bin/alsync and put in this lines
"alsync" connects, login, and update your packages database on the local nfsserver
+
  cd /var/cache/pacman/pkg
pacman -S openssl
+
  wget -N ftp://ftp.archlinux.org/current/'''.db.'''
pacman -S wget
+
  wget -N ftp://ftp.archlinux.org/extra/'''.db.'''
  
 +
*chmod 777 /bin/alsync
  
create a file called /bin/alsync and put in this lines
 
''''''''''''''' content of alsync '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
cd /var/cache/pacman/pkg
 
wget -N ftp://ftp.archlinux.org/current/'''.db.'''
 
wget -N ftp://ftp.archlinux.org/extra/'''.db.'''
 
''''''''''''''''''''''''''' end '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''*
 
 
chmod 777 /bin/alsync
 
 
copy this file to your clients
 
copy this file to your clients
  
 +
*to try run as root on first client
 +
  alsync
 +
  pacman -Sy
 +
  pacman -S new-pkgname
  
to try run as root on first client
+
*move to next client and run
alsync
+
  pacman -Sy
pacman -Sy
+
  pacman -S new-pkgname
pacman -S new-pkgname
+
 
+
move to next client and run
+
pacman -Sy
+
pacman -S new-pkgname
+
</pre>
+

Revision as of 07:51, 15 November 2008


This document outlines one way to share Arch Linux packages across a LAN. A better way to do this would be to create a Custom local repository with ABS and gensync and make the repository available across the LAN using NFS or FTP. This document should be edited to describe this process in detail. For the time being, the original HOWTO is left intact below:

To share all your downloaded packages in your lan Pros save bandwidth, diskspace and time. "pacman -Sy" will sync against our local repository "pacman -S pkgname" try to download and install pkg from localserver if pkg not exist it download from the next server in the list /etc/pacman.conf and save pkg on localserver. "alsync" will update localserver db against ftp.archlinux.org

ex. for my network serverip=192.168.14.3 network=192.168.14.0/255.255.255.0 adjust to yours


on the server side

on your server create an nfs share readwrite for all pc on your lan

If you run Arch Linux on the server you can

 pacman -S portmap
 pacman -S nfs-utils

edit /etc/exports add line

 /var/cache/pacman/pkg
 192.168.14.0/255.255.255.0 (rw,no_root_squash,sync)

add portmap, nfslock and nfsd to DAEMONS in /etc/rc.conf

run the followings:

 # /etc/rc.d/portmap start
 # /etc/rc.d/nfslock start
 # /etc/rc.d/nfsd start

check the nfsshare run "exportfs" on server.

Check hosts.allow and hosts.deny

to work (very simple):

hosts.deny ALL: ALL: DENY

hosts.allow ALL: 192.168.14.

Explanation:

hosts.deny deny all connection that doesnt exist on hosts.allow. hosts.allow allow connection from local network 192.168.14.0/255.255.255.0

on all clients

  • rename /var/cache/pacman/pkg to /var/cache/pacman/pkgorg
  • create a new /var/cache/pacman/pkg and mount the nfs share there
  • run "mount -o rw,nolock 192.168.14.3:/var/cache/pacman/pkg /var/cache/pacman/pkg"
  • if the mount from command line does not work add this option "nfsvers=3"

or if you want it automount after the reboot, add this line in /etc/fstab

 192.168.14.3:/var/cache/pacman/pkg /var/cache/pacman/pkg    nfs    rw,nolock
  • again if the mount does not work, try to add mount option nfsvers=3 to the fstab entry.
  • run "mount -a"
  • run "df" to check mount
  • move all your already fetched pkg from your clients
 /var/cache/pacman/pkgorg to /var/cache/pacman/pkg
  • edit /etc/pacman.conf and add this lines directly after the line
 {current}
 Server = file:///var/cache/pacman/pkg

and after

 {extra}
 Server = file:///var/cache/pacman/pkg

I have skipped the step 3 because for me it works as i want already. I sync from each PC and all share the pacman cache.

To sync your local repository v.s. archlinux.org

  • "alsync" connects, login, and update your packages database on the local nfsserver
 pacman -S openssl
 pacman -S wget


  • create a file called /bin/alsync and put in this lines
 cd /var/cache/pacman/pkg
 wget -N ftp://ftp.archlinux.org/current/.db.
 wget -N ftp://ftp.archlinux.org/extra/.db.
  • chmod 777 /bin/alsync

copy this file to your clients

  • to try run as root on first client
 alsync
 pacman -Sy
 pacman -S new-pkgname
  • move to next client and run
 pacman -Sy
 pacman -S new-pkgname