Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'ImprAppController::load_scripts' was given in /home/content/50/6390250/html/wp-includes/plugin.php on line 405

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'ImprAppController::load_styles' was given in /home/content/50/6390250/html/wp-includes/plugin.php on line 405
RSS
 

Archive for November, 2010

Hosting That Repository

08 Nov

Collection of file boxes symbolizing .deb packages
Several weeks back I wrote about setting up a local repository for .deb packages. Well we’re growing and adding machines, so it was time to move that local repository to a centralized location.

It shouldn’t be hard, but it did have a few more steps than I hoped. The essence was around building the repository through a framework, and for that, a number of posts led me to reprepro.

According to its man page and sparse documentation, reprepro is “a tool to handle local repositories of debian packages,” which sounded exactly like what I wanted.

The steps were fairly straightforward, albeit with one gotcha that took me about an hour to puzzle through.

Build the package

The first step is an obvious prerequisite. However, one step missing from what I described in Building Custom .deb Packages and Chroots was the requirement to specify Section (e.g. Main, non-free, etc.) and Priority sections. Without this, reprepro will give the cryptic (though, in retrospect, obvious) error “No section given.” (Maybe if the ‘s’ was capitalized I wouldn’t have assumed this was based on the reprepro config file, instead of the package itself). Oh well.

Create a repository

Joseph Ruscio explains this part pretty well; in essence, you:

  1. Generate the PGP key: gpg --gen-key should get you pretty much all you need here. If you want the repository to be owned by another user, you’ll have to sudo into that account and ensure that user has a ~username directory (which system accounts will not, by default)
  2. Create the repository control files: At the minimum, reprepro will need a subdirectory called conf underneath wherever your repository will live. Inside that dir, create a file distributions that contains the reprepro setup. Here’s mine, to diff against the other online examples:
    Origin: http://myhostname.path.com
    Label: Edge Apt Repository
    Codename: es
    Architectures: i386 amd64
    Components: non-free
    Description: A generic description.
    SignWith: yes
    

    Details of the various settings are in the man page; I think these are the only mandatory ones.

  3. Create an options file: If you want to save yourself some command-line time, you can create a conf/options file like so:
    verbose
    ask-passphrase
    basedir .
    
  4. Run reprepro: The command is simple:
    reprepro includedeb [codename] [path to .deb file]
  5. Make the repository available over http: The various articles linked above show how to set up a virtual host or path pointing to your new repository. For security purposes you should hide the conf and db directories from the public, and depending on how broadly you’re allowing distribution, play with your webserver’s permissions to restrict by IP, domain, or password. Basically, you just need to make sure that apt on your client machine (where you’re installing to) can browse the directory you’ve created above.
  6. Edit /etc/apt/sources.list on the client machine(s): You’ll simply add a row to point to this new directory, the codename you specified, and the source you specified in the package (e.g. non-free). Here’s mine:
    deb http://myhostname.edgesentinel.com/
  7. apt-get update



And that’s it!
Happy distributing.

/m

 
No Comments

Posted in sysadmin

 
 
Info about our use of ads