Difference between revisions of "Local repository"

From ArchWiki
Jump to: navigation, search
(Local repository HOWTO)
m (updated to pacman -Syu)
(32 intermediate revisions by 20 users not shown)
Line 1: Line 1:
[[Category:Package Management]]
+
[[Category:Package management]]
==== Local repository HOWTO====
+
[[es:Local repository]]
 +
[[ru:Local repository HOW-TO]]
 +
{{Expansion}}
 +
{{Merge|pacman Tips}}
 +
 
 
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>
+
== Introduction ==
To share all your downloaded packages in your lan
+
Sharing all of your downloaded packages to your LAN can save bandwidth, diskspace, and time.
Pros  save bandwith, diskspace and time.
+
pacman -Syu
"pacman -Sy"  will sync against our local repository
+
Will sync against our local repository;
"pacman -S pkgname" try to download and install pkg from localserver if pkg not exist it download
+
pacman -S pkgname  
from the next server in the list /etc/pacman.conf and save pkg on localserver.
+
Will try to download and install a package from localserver. If the package does not exist it will download it from the next server in the list /etc/pacman.conf and save the package on localserver;
"alsync" will update localserver db against ftp.archlinux.org
+
alsync
 
+
Will update localserver database 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
 
 
 
 
 
1. serverside
 
on your server create an nfs share readwrite for all pc on your lan
 
 
 
if you run archlinux 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 /etc/rc.d/portmap start
+
In example: for my network
run /etc/rc.d/nfslock start
+
  serverip=192.168.14.3
run  /etc/rc.d/nfsd start
+
  network=192.168.14.0/255.255.255.0
to check the nfsshare run "exportfs" on server.
+
Adjust to your needs.
  
1.1 Check hosts.allow and hosts.deny
+
== On the Server Side ==
 +
Create an NFS share on the server hosting the packages.
  
to work (very simple):
+
For detailed help on setting up an NFS server please see [[ NFS ]]
  
hosts.deny
+
* Add this line to /etc/exports:
ALL: ALL: DENY
+
/var/cache/pacman/pkg 192.168.14.0/24(rw,no_subtree_check,nohide)
  
hosts.allow
+
* If you modify /etc/exports while the server is running, you must re-export them for changes to take effect:
ALL: 192.168.14.
+
# exportfs -ra
  
Explanation:  
+
== 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:
  
hosts.deny deny all connection that doesnt exist on hosts.allow.
+
  {current}
hosts.allow allow connection from local network 192.168.14.0/255.255.255.0
+
  Server = file:///var/cache/pacman/pkg
  
2. on all clients
+
''' and after '''
rename  /var/cache/pacman/pkg  to /var/cache/pacman/pkgorg
+
  {extra}
create a new /var/cache/pacman/pkg and mount the nfs share there
+
  Server = file:///var/cache/pacman/pkg
  
run "mount -o rw,nolock 192.168.14.3:/var/cache/pacman/pkg /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.
or if you want it automount on client reboot
 
add this line in /etc/fstab
 
192.168.14.3:/var/cache/pacman/pkg /var/cache/pacman/pkg    nfs    rw,nolock
 
run "mount -a"
 
run "df" to check mount
 
  
move all your already fetched pkg from your clients
+
== To sync your local repository against archlinux.org==
/var/cache/pacman/pkgorg to /var/cache/pacman/pkg
+
*"alsync" connects, logs in, and updates your packages database on the local nfs server
 +
  pacman -S openssl
 +
  pacman -S wget
  
edit /etc/pacman.conf and add this lines directly after the line
 
  
{current}
+
*create a file called /bin/alsync and add these lines
Server = file:///var/cache/pacman/pkg
+
  cd /var/cache/pacman/pkg
 +
  wget -N ftp://ftp.archlinux.org/current/'''.db.'''
 +
  wget -N ftp://ftp.archlinux.org/extra/'''.db.'''
  
    '''''' and after ''''''
+
*chmod 777 /bin/alsync
{extra}
 
Server = file:///var/cache/pacman/pkg
 
  
 
3. to sync your local repository v.s. archlinux
 
"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
 
''''''''''''''' 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
  
 +
*Attempt to run as root on the first client
 +
  alsync
 +
  pacman -Syu
 +
  pacman -S new-pkgname
  
to try run as root on first client
+
*Then move to the next client and run
alsync
+
  pacman -Syu
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 06:09, 29 June 2013

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Local repository#)

Merge-arrows-2.pngThis article or section is a candidate for merging with pacman Tips.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Local repository#)

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:

Introduction

Sharing all of your downloaded packages to your LAN can save bandwidth, diskspace, and time.

pacman -Syu

Will sync against our local repository;

pacman -S pkgname 

Will try to download and install a package from localserver. If the package does not exist it will download it from the next server in the list /etc/pacman.conf and save the package on localserver;

alsync

Will update localserver database against ftp.archlinux.org.

In example: for my network

serverip=192.168.14.3
network=192.168.14.0/255.255.255.0

Adjust to your needs.

On the Server Side

Create an NFS share on the server hosting the packages.

For detailed help on setting up an NFS server please see NFS

  • Add this line to /etc/exports:
/var/cache/pacman/pkg 192.168.14.0/24(rw,no_subtree_check,nohide)
  • If you modify /etc/exports while the server is running, you must re-export them for changes to take effect:
# exportfs -ra

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 against archlinux.org

  • "alsync" connects, logs in, and updates your packages database on the local nfs server
 pacman -S openssl
 pacman -S wget


  • create a file called /bin/alsync and add these 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

  • Attempt to run as root on the first client
 alsync
 pacman -Syu
 pacman -S new-pkgname
  • Then move to the next client and run
 pacman -Syu
 pacman -S new-pkgname