I needed to document the process I used to get a private Debian package repository with some custom applications. Here is the process I went through. You can find some reference links under my previous articles “Debian” heading.
Basic steps to building setting up your personnel project to build Debian packages.
- Get most recent software version for your project (git pull, etc..)
- Rename project folder to include a default project number. For example $mv myProject myProject-1.0
- In project directory run dh_make. This will create a debian diectory with all the necessary files to build a deb package.
- Now would be a good time to edit your debian/control file and make any changes needed.
- If you project is a simple copy operation (say a php web application being installed onto an existing apache server) you will want to do the following:
- Create and edit a new file under debian/ named myProject.install (replace myProject with the name of your project.)
- Edit the file to specify the where you want the files copied to. The format of the should be something like this (notice you can use wildcards:)
- Make sure you debian/rules file looks something like this:
- Now, you should be able to build your package (and the changes & dsc files) by running dpkg-buildpackage. The resulting packages will be in the directory one level up.
Hosting your own git repository can vary in complexity depending on which software you use to actually build the repository. The easiest one I found to setup was mini-dinstall. Start by installing mini-dinstall and apache2 via apt. Apache is configured to start a basic server (all that we need) with the web page files hosted in /var/www. Just clean out the www directory, add the mini-dinstall folders after the install:
rm -rf /var/www/*
mkdir -p /var/www/mini-dinstall/incoming
You will also need to create a configuration file for mini-dinstall to use when creating the package repository supporting files. Create/edit the file /etc/mini-dinstall.conf with something like the following:
archivedir = /var/www
verify_sigs = false
architectures = amd64
archive_style = simple-subdir
generate_release = true
mail_on_success = false
release_codename = myreponame
release_description = My Repo Name Hosting
release_label = myrepo
release_origin = myrepo
At this point mini-dinstall could be configured to run in server mode and watch for incoming packages, but using the utility below I have mine configured to run in batch mode every time I put new files on the hosted server. This will cause mini-dinstall to create a debian package repository structure that can be accessed directly via apt. Just add something like the following to your /etc/sources.list
deb http://yourserver.com unstable/abd64/
There is a really nice utility called dput that can be used for deploying software packages (and change files) to a hosting server. The easiest way to get started is to install dput and then setup a configuration file. Create a file in your home directory called .dput.cf (or globally in /etc/dput.cf) and add a deployment location like this:
fqdn = debian.myserverurl.com
method = scp
incoming = /var/www/mini-dinstall/incoming
login = root
post_upload_command = ssh email@example.com mini-dinstall -b
That last line creates the repository using mini-dinstall mentioned above in section “hosting”. This is particularly useful if you already share public keys with the remote system via ssh. One you have set it up you can do deployment by typing:
dput -u myservername myproject.change
Where myproject.change is the file created above in “Building”.