Wednesday, October 26, 2011

Apt Repository


BitBucket has the ability to host static sites. Although Mercurial is better suited for text files than binary debs, BitBucket does make a reasonable apt-repository host for a small collection of packages.

  1. First, create a BitBucket account for your repository. I recommend a separate account from the one you use for source code development. I created an account with username fimero to host artifacts for the fimero project.
  2. Create a repository named {username} so in this case
  3. Clone this repository to your local machine hg clone{username}/{username}
  4. Add an index.html file to this project, commit and push.

Now you can confirm that things work by pointing your browser to

Apt Repository

Next, install reprepro to set up your apt repository.

$ sudo apt-get install reprepro

Our objective is to have a repository with the following configuration

deb fimero main

To create this, cd into your local copy of your repository and create a folder called ubuntu/conf and create a file called distributions.

You are now ready to deploy a package.

$ reprepro -b ${PACKAGE_FOLDER} -V -P 1 -S main includedeb fimero ${debpackage}

Here ${PACKAGE_FOLDER} is your {username} folder and ${debpackage} is the deb file you want to deploy.

The final step is to push these changes to BitBucket.

$ hg commit
$ hg push

If you've added the deb entry from above in your /etc/apt/sources.list, you'll be able to install your newly deployed package on all of your machines.

No comments: