特殊:Badtitle/NS100:LocalAptGetRepository
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/LocalAptGetRepository }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/af | • {{#if: UbuntuHelp:LocalAptGetRepository|Afrikaans| [[::LocalAptGetRepository/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ar | • {{#if: UbuntuHelp:LocalAptGetRepository|العربية| [[::LocalAptGetRepository/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/az | • {{#if: UbuntuHelp:LocalAptGetRepository|azərbaycanca| [[::LocalAptGetRepository/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/bcc | • {{#if: UbuntuHelp:LocalAptGetRepository|جهلسری بلوچی| [[::LocalAptGetRepository/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/bg | • {{#if: UbuntuHelp:LocalAptGetRepository|български| [[::LocalAptGetRepository/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/br | • {{#if: UbuntuHelp:LocalAptGetRepository|brezhoneg| [[::LocalAptGetRepository/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ca | • {{#if: UbuntuHelp:LocalAptGetRepository|català| [[::LocalAptGetRepository/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/cs | • {{#if: UbuntuHelp:LocalAptGetRepository|čeština| [[::LocalAptGetRepository/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/de | • {{#if: UbuntuHelp:LocalAptGetRepository|Deutsch| [[::LocalAptGetRepository/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/el | • {{#if: UbuntuHelp:LocalAptGetRepository|Ελληνικά| [[::LocalAptGetRepository/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/es | • {{#if: UbuntuHelp:LocalAptGetRepository|español| [[::LocalAptGetRepository/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/fa | • {{#if: UbuntuHelp:LocalAptGetRepository|فارسی| [[::LocalAptGetRepository/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/fi | • {{#if: UbuntuHelp:LocalAptGetRepository|suomi| [[::LocalAptGetRepository/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/fr | • {{#if: UbuntuHelp:LocalAptGetRepository|français| [[::LocalAptGetRepository/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/gu | • {{#if: UbuntuHelp:LocalAptGetRepository|ગુજરાતી| [[::LocalAptGetRepository/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/he | • {{#if: UbuntuHelp:LocalAptGetRepository|עברית| [[::LocalAptGetRepository/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/hu | • {{#if: UbuntuHelp:LocalAptGetRepository|magyar| [[::LocalAptGetRepository/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/id | • {{#if: UbuntuHelp:LocalAptGetRepository|Bahasa Indonesia| [[::LocalAptGetRepository/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/it | • {{#if: UbuntuHelp:LocalAptGetRepository|italiano| [[::LocalAptGetRepository/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ja | • {{#if: UbuntuHelp:LocalAptGetRepository|日本語| [[::LocalAptGetRepository/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ko | • {{#if: UbuntuHelp:LocalAptGetRepository|한국어| [[::LocalAptGetRepository/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ksh | • {{#if: UbuntuHelp:LocalAptGetRepository|Ripoarisch| [[::LocalAptGetRepository/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/mr | • {{#if: UbuntuHelp:LocalAptGetRepository|मराठी| [[::LocalAptGetRepository/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ms | • {{#if: UbuntuHelp:LocalAptGetRepository|Bahasa Melayu| [[::LocalAptGetRepository/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/nl | • {{#if: UbuntuHelp:LocalAptGetRepository|Nederlands| [[::LocalAptGetRepository/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/no | • {{#if: UbuntuHelp:LocalAptGetRepository|norsk| [[::LocalAptGetRepository/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/oc | • {{#if: UbuntuHelp:LocalAptGetRepository|occitan| [[::LocalAptGetRepository/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/pl | • {{#if: UbuntuHelp:LocalAptGetRepository|polski| [[::LocalAptGetRepository/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/pt | • {{#if: UbuntuHelp:LocalAptGetRepository|português| [[::LocalAptGetRepository/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ro | • {{#if: UbuntuHelp:LocalAptGetRepository|română| [[::LocalAptGetRepository/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/ru | • {{#if: UbuntuHelp:LocalAptGetRepository|русский| [[::LocalAptGetRepository/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/si | • {{#if: UbuntuHelp:LocalAptGetRepository|සිංහල| [[::LocalAptGetRepository/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/sq | • {{#if: UbuntuHelp:LocalAptGetRepository|shqip| [[::LocalAptGetRepository/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/sr | • {{#if: UbuntuHelp:LocalAptGetRepository|српски / srpski| [[::LocalAptGetRepository/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/sv | • {{#if: UbuntuHelp:LocalAptGetRepository|svenska| [[::LocalAptGetRepository/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/th | • {{#if: UbuntuHelp:LocalAptGetRepository|ไทย| [[::LocalAptGetRepository/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/tr | • {{#if: UbuntuHelp:LocalAptGetRepository|Türkçe| [[::LocalAptGetRepository/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/vi | • {{#if: UbuntuHelp:LocalAptGetRepository|Tiếng Việt| [[::LocalAptGetRepository/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/yue | • {{#if: UbuntuHelp:LocalAptGetRepository|粵語| [[::LocalAptGetRepository/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/zh | • {{#if: UbuntuHelp:LocalAptGetRepository|中文| [[::LocalAptGetRepository/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/zh-hans | • {{#if: UbuntuHelp:LocalAptGetRepository|中文(简体)| [[::LocalAptGetRepository/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LocalAptGetRepository | UbuntuHelp:LocalAptGetRepository | {{#if: | :}}LocalAptGetRepository}}/zh-hant | • {{#if: UbuntuHelp:LocalAptGetRepository|中文(繁體)| [[::LocalAptGetRepository/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:LocalAptGetRepository|:LocalAptGetRepository|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :LocalAptGetRepository/zh | | {{#ifexist: LocalAptGetRepository/zh | | {{#ifeq: {{#titleparts:LocalAptGetRepository|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:LocalAptGetRepository|1|-1|}} | zh | | }}
Why a local package repository
If you are packaging software for Debian Linux or (K)Ubuntu sometimes you need not only one package, but you have to provide a dependency like a library or whatever. When those dependencies are not in the official repositories, the only way to fulfill those dependencies is to put your package inside the repository. But what, if you don't have the permission to upload to main/universe/multiverse? So, inject your packages to your pbuilder enviroment via a local apt-get repository. In this document I will describe how to setup a local apt-get repository, how to upload it to your root server via rsync and how to change your pbuilders sources.list. You might wish to also check out LocalAptGetRepositoriesTrivial for a slightly easier way to make a local repository.
Requirements
You need to install the following packages:
- pbuilder
- dput
- mini-dinstall
- rsync
Installation
The installation of pbuilder is described at PbuilderHowto, so I won't repeat it here. The other tools you can install with:
$ sudo apt-get install dput mini-dinstall rsync
Configuration
Well, you need to configure the dput and mini-dinstall tools. I will show you how my configuration looks so you can adjust it for your needs.
dput
- Create $HOME/.dput.cf with the following content:
[local] fqdn = localhost method = local incoming = ~/archive/mini-dinstall/incoming allow_unsigned_uploads = 1 post_upload_command = mini-dinstall --batch
- Create the required directories
$ mkdir -p $HOME/archive/mini-dinstall/incoming
mini-dinstall
Ok, this is something which needs some extra explanation, but first the setup:
- Create $HOME/.mini-dinstall.conf with the following content:
[DEFAULT] architectures = all, i386 archivedir = /home/shermann/archive use_dnotify = 0 verify_sigs = 0 extra_keyrings = /home/shermann/.gnupg/pubring.gpg mail_on_success = 0 archive_style = flat poll_time = 40 mail_log_level = NONE generate_release = 1 release_description = shermanns ubuntu packages [hoary] [breezy]
Explanation:
- the DEFAULT group sets
everything which is default to all repositories. If you gpg pubkey is inside the Ubuntu/Debian pub-keyring, you need to verify_sigs = 1
, for me te extra_keyrings weren't working. I have to figure out why, but later :)
- hoary and breezy Groups
describing the two repositories, one for hoary and one for the next ubuntu generation breezy. When you upload the packages, you have to be sure, what distribution it is. For example if you set in your <app>-version/debian/changelog as distribution "hoary" the package will be moved into the hoary distribution.
Ready to Upload ?
Now, after configuring the required tools we're ready to upload the packages. Let's say, that we build packages for Ubuntu Breezy and they are laying in `$HOME/myPackages/` you should see after a `ls -la` the following listing:
-rw-r--r-- 1 user group 340 2005-04-12 12:42 qinx_1.4-0ubuntu1.dsc -rw-r--r-- 1 user group 765 2005-04-12 12:44 qinx_1.4-0ubuntu1_i386.changes -rw-r--r-- 1 user group 206702 2005-04-12 12:44 qinx_1.4-0ubuntu1_i386.deb -rw-r--r-- 1 user group 916 2005-04-12 12:40 qinx_1.4-0ubuntu1_source.changes -rw-r--r-- 1 user group 663497 2005-04-12 12:42 qinx_1.4-0ubuntu1.tar.gz
Now, we want to upload this source and binary package to our local repository. This package has as distribution "breezy", so it will be uploaded to the "breezy" repository. Do the following:
$ dput local qinx_1.4-0ubuntu1_i386.changes
Well, if everything went fine, you will find in `$HOME/archive/breezy/` this:
-rw-r--r-- 1 user group 2150 2005-04-13 13:17 Packages -rw-r--r-- 1 user group 774 2005-04-13 13:17 Packages.gz -rw-r--r-- 1 user group 340 2005-04-13 13:17 qinx_1.4-0ubuntu1.dsc -rw------- 1 user group 765 2005-04-13 13:17 qinx_1.4-0ubuntu1_i386.changes -rw-r--r-- 1 user group 206702 2005-04-13 13:17 qinx_1.4-0ubuntu1_i386.deb -rw-r--r-- 1 user group 663497 2005-04-13 13:17 qinx_1.4-0ubuntu1.tar.gz -rw-r--r-- 1 user group 689 2005-04-13 13:17 Release -rw-r--r-- 1 user group 868 2005-04-13 13:17 Sources -rw-r--r-- 1 user group 425 2005-04-13 13:17 Sources.gz
Is it? If not, go back to the beginning and try again :)
Changing your systems apt-get sources.list
Now you're ready to change your local systems apt-get sources list to let it know about your local package repository. Do this:
$ sudo vi /etc/apt/sources.list
and add the following lines to it (please replace $HOME with the correct pathname to your home):
deb file:///$HOME/archive breezy/ deb-src file:///$HOME/archive breezy/
After adding these two lines, update your local apt cache:
$ sudo apt-get update
You should see, how apt is reading your local repository. If this is working, let's do the change for your pbuilder enviroment
Adjusting Pbuilder to use your repository
Well, if you followed the PbuilderHowto you should have a directory like `/etc/pbuilder/apt.config/`. In this directory there is also a copy of the old `sources.list` of your system. You have to know now, pbuilder is working in a `chroot` enviroment, so it doesn't know anything about your $HOME directory. It means you have to setup a remote repository for your packages.
If you have your own server
I'm in the position to have a Root-Server (ok, it's running with Gentoo, but what the hell ;)) and I'm running an Apache webserver so I setup a virtualhost for my own package repository. Say, my remote repository is in the directory `/var/www/ubuntu.linux-server.org/htdocs/archive/` and I have write permissions on this directory, I have to synchronize now my local repository with the remote one. If you know the magics of rsync now, it will be easy to do this, without having a rsync daemon running. SSH + rsync are good buddies :) Ok, time to sync local with remote, try this:
$ cd $HOME/archive $ rsync -azrptL --progress --delete-after -e "ssh" breezy user@host:/var/www/ubuntu.linux-server.org/htdocs/archive/
That's it for syncing. Easy, isn't it?
On the other hand, if you don't have access to your own server, but want to use shared hosting for your remote repo, there is a guide on Setting up your own Ubuntu repository on Dreamhost, which should be applicable, no matter what hosting service you're using. ok, now you have your own remote package repository. It's time to adjust the pbuilder enviroment.
Changes to the pbuilder enviroment
Ok, `vi` the `/etc/pbuilder/apt.config/sources.list`
$ sudo vi /etc/pbuilder/apt.config/sources.list
and add these two lines (replace <url to repository> with your URL)
deb http://<url to repository>/ breezy/ deb-src http://<url to repository>/ breezy/
save it and now update the pbuilder:
$ sudo pbuilder update --distribution breezy --override-config
You should see, how apt-get is updating inside the pbuilders enviroment its cache.
Finally
Yeah, you did it. Now you can build your new packages with your self-made dependencies. Have fun. If anything is not clear, please leave a comment with the comment function on this page.