Setup an Alternate Arch Linux Package Repository

Setting up your own package repository is probably the easiest in Arch Linux compared to other Linux Distros. I’m going to jot down what I did for the Unity For Arch Linux Repository that I created. This is a generic set of instructions and will have to adapted for different environments.

  • Create all the packages that you want to host in the repository (*.pkg.tar.xz files). Lets assume that all the compiled pacakages are in the directory BUILD-DIR.
  • Create a directory structure for your packages.
  • 
    mkdir ~/repo-dir
    mkdir ~/repo-dir/x86_64
    mkdir ~/repo-dir/i686
    
  • Copy the *.pkg.tar.xz files in to appropriate directories.
    
    find BUILD-DIR -name *x86_64.pkg.tar.xz -exec cp '{}' ~/repo-dir/x86_64/ \;
    find BUILD-DIR -name *i686.pkg.tar.xz -exec cp '{}' ~/repo-dir/i686/ \;
    find BUILD-DIR -name *any.pkg.tar.xz -exec cp '{}' ~/repo-dir/x86_64/ \;
    find BUILD-DIR -name *any.pkg.tar.xz -exec cp '{}' ~/repo-dir/i686/ \;
    
  • Create the package database. Replace repo-name with whatever name you want
    
    pushd ~/repo-dir/x86_64/
    repo-add ./repo-name.db.tar.gz ./*.pkg.tar.xz
    popd
    pushd ~/repo-dir/i686/
    repo-add ./repo-name.db.tar.gz ./*.pkg.tar.xz
    popd
    
  • Tar up the packages.
    
    pushd ~/repo-dir/
    tar -cvzf ../packages.tar.gz .
    
  • Create a Domain/Sub-domain to host the packages. Lets say the domain is al.humbug.in.
  • Copy packages to your server and untar it inside the public folder of your domain/sub-domain
    
    scp packages.tar.gz pratik@al.humbug.in:~
    cd ~/al.humbug.in
    tar -zxvf ../packages.tar.gz
    
  • Add the respository to pacman.conf. Change repo-name to whatever you used earlier.
  • [repo-name]
    Server = http://al.humbug.in/$arch
    
  • We are done now, synchronize the package repository and install your packages and distribute it to others.
    
    sudo pacman -Syu
    sudo pacman -S <package name>
    

About Pratik Sinha

Linux Nerd, Socialist, Atheist, Adventuristic, Nature Lover, Geeky.

1 comment

Leave a Reply to unixbhaskar Cancel reply