>Internal LAN, Package Distribution Quick Howto

>This guide simply mashes up two other guides, with just the parts needed to create simple packages and them to your own repository, all on the local network (no PPAs).

First you need to make packages (a more complete guide below [1]). My packages are very simple as I am using them just to distribute files around the local network. Let’s pretend you want to include a simple bash backup script in a package.
Make a package

  1. Make a folder mycompany-backup
  2. Make two new folders in it: DEBIAN and opt
    NOTE:
    pretend mycompany-backup is the / directory of whatever system you install it on, so everything in opt would go to /opt when installed, etc.
  3. Make a new text file under DEBIAN called control
  4. Add Some text to the file:

    Package: mycompany-backup
    Version: 0.1
    Section: mycompany
    Priority: optional
    Architecture: i386 or amd64 or all (however all sadly doesn’t work with the next part of this guide)
    Essential: no
    Installed-Size: 10
    Maintainer: My Name

 

  • Add your content (in my case a backup script) to opt/backup.sh. Mine just backs up Documents to a place on our server. (NOTE: This isn’t a complete backup solution as there is no automation)

    #/bin/sh
    SAMIAM=`whoami`
    sleep 60

 

gvfs-mount mount smb://$SAMIAM@server/$SAMIAM #User must have saved password for share

rsync -rv /home/$SAMIAM/Documents “/home/$SAMIAM/.gvfs/$SAMIAM on server/BACKUP” –log-file=”/home/$SAMIAM/.gvfs/$SAMIAM on server/BACKUP/latest”

  • Go one directory above where mycompany-backup is.
  • Run the command dpkg -b mycompany-backup/ mycompany.deb and you should have a new .deb file.

I got most of this from:
[1] An IBM developerworks page that no longer exists.

Distribute the Package in your own company repository

  1. You need to already be running a simple web server (or not, you could just install apache)
  2. Make a new directory on the server called apt (likely /var/www/apt)
  3. Make two new folders in it: conf and incoming
  4. Make a new file in conf called distributions – like this
    Origin: Your Name
    Label: Something here as well
    Suite: karmic
    Codename: karmic
    Architectures: amd64 source (all would be ideal here but it doesn’t work)
    Components: mycompany
    Description: Your description
  5. Oh right, install reprepro
  6. Add your deb to incoming
  7. Then while in the apt directory, run sudo reprepro includedeb karmic incoming/mycompany.deb

Then just add the line to your other computers:
deb http://mycompanysServerOrIPAddress/apt karmic mycompany

Update apt, and then install the mycompany package like any normal package.

Again this website provided a great starting point for me, and has many more details.
[2] http://www.debian-administration.org/articles/286

Mostly did this for my own documentation, hope it was helpful for you as well.

If anyone wants to figure out why the “all” architecture doesn’t work with reprepro it could be very helpful in making actually correct packages. The one in this example really should be all and not amd64.

Leave a Reply

Your email address will not be published. Required fields are marked *