特殊:Badtitle/NS100:Repositories/Personal:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
(未显示同一用户的5个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/Repositories/Personal}} | {{From|https://help.ubuntu.com/community/Repositories/Personal}} | ||
{{Languages|UbuntuHelp:Repositories/Personal}} | {{Languages|UbuntuHelp:Repositories/Personal}} | ||
General information: [[UbuntuHelp:Repositories/Ubuntu|Repositories in Ubuntu]] | |||
== Introduction == | == Introduction == | ||
There are often a few packages that you want to install that don't exist in the Ubuntu repositories. If they have any dependencies on other packages, trying to | There are often a few packages that you want to install that don't exist in the Ubuntu repositories. If they have any dependencies on other packages, trying to use '''dpkg''' can drop you into "dpkg hell", and having '''apt''' resolve those dependencies for you would really help. | ||
There are full blown methods of creating your own local repository, such as [[UbuntuHelp:Debarchiver|Debarchiver]] or [[UbuntuHelp:Dak|Dak]]. These are overkill, when all you want is a means of resolving dependencies of the handful of packages you've downloaded from the web (not for an entire repository that you want to use without Internet connection; for this use [[UbuntuHelp:AptGet/Offline/Repository|AptGet/Offline/Repository]]). A simple solution is to use '''dpkg-scanpackages''', which will build a repository you can add to your sources.list. | |||
== Creating a Personal Repository == | == Creating a Personal Repository == | ||
There are | There are 4 steps to setting up a simple repository for yourself | ||
<ol><li>[[UbuntuHelp:InstallingSoftware|Install]] dpkg-dev | |||
</li><li>Put the packages in a directory | |||
</li><li>Create a script that will scan the packages and create a file '''apt-get update''' can read | |||
</li><li>Add a line to your sources.list pointing at your repository</li></ol> | |||
=== Install dpkg-dev === | |||
Type in a terminal | |||
<pre><nowiki> | |||
sudo apt-get install dpkg-dev | |||
</nowiki></pre> | |||
=== The Directory === | === The Directory === | ||
Create a directory where you will keep your packages. For this example, we'll use /usr/local/mydebs. | Create a directory where you will keep your packages. For this example, we'll use /usr/local/mydebs. | ||
<pre><nowiki> | <pre><nowiki> | ||
mkdir /usr/local/mydebs | sudo mkdir -p /usr/local/mydebs | ||
</nowiki></pre> | </nowiki></pre> | ||
Now move your packages into the directory you've just created. | Now move your packages into the directory you've just created. | ||
=== The Script === | Previously downloaded Packages are generally stored on your system in the /var/cache/apt/archives directory. | ||
It's a simple | If you have installed apt-cacher you will have additional packages stored in its /packages directory. | ||
=== The Script update-mydebs === | |||
It's a simple three liner: | |||
<pre><nowiki> | <pre><nowiki> | ||
#! /bin/bash | #! /bin/bash | ||
cd /usr/local/mydebs | cd /usr/local/mydebs | ||
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz | dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz | ||
</nowiki></pre> | </nowiki></pre> | ||
Cut and paste the above into gedit, and save it as '''update-mydebs''' in ~/bin. (the tilde '~' means your home directory. If ~/bin does not exist, create it: Ubuntu will put that directory in your PATH. It's a good place to put personal scripts). Next, make the script executable: | Cut and paste the above into gedit, and save it as '''update-mydebs''' in ~/bin. (the tilde '~' means your home directory. If ~/bin does not exist, create it: Ubuntu will put that directory in your PATH. It's a good place to put personal scripts). Next, make the script executable: | ||
第26行: | 第37行: | ||
</nowiki></pre> | </nowiki></pre> | ||
'''How the script works:''' | '''How the script works:''' | ||
'''dpkg-scanpackages''' looks at all the packages in mydebs, and the output is compressed and written to a file (Packages.gz) that '''apt-get update''' can read (see below for a reference that explains this in excruciating detail). /dev/null is an empty file; it is a substitute for an override file which holds some additional information about the packages, which in this case is not really needed. | '''dpkg-scanpackages''' looks at all the packages in mydebs, and the output is compressed and written to a file (Packages.gz) that '''apt-get update''' can read (see below for a reference that explains this in excruciating detail). /dev/null is an empty file; it is a substitute for an override file which holds some additional information about the packages, which in this case is not really needed. See deb-override(5) if you want to know about it. | ||
=== Sources.list === | === Sources.list === | ||
add the line | add the line | ||
第33行: | 第44行: | ||
</nowiki></pre> | </nowiki></pre> | ||
to your /etc/apt/sources.list, and you're done. | to your /etc/apt/sources.list, and you're done. | ||
==== CD Option ==== | |||
You can burn the directory containing the debs to a CD and use that as a repository as well (good for sharing between computers). To use the CD as a repository, simply run | |||
<pre><nowiki> | |||
sudo apt-cdrom add | |||
</nowiki></pre> | |||
== Using the Repository == | == Using the Repository == | ||
Whenever you put a new deb in the mydebs directory, run | Whenever you put a new deb in the mydebs directory, run | ||
第39行: | 第55行: | ||
sudo apt-get update | sudo apt-get update | ||
</nowiki></pre> | </nowiki></pre> | ||
Now your local packages can be manipulated with ''' | Now your local packages can be manipulated with '''[[UbuntuHelp:Synaptic|Synaptic]]''', '''aptitude''' and the apt commands: '''apt-get''', '''apt-cache''', etc. When you attempt to '''apt-get install''', any dependencies will be resolved for you, as long as they can be met. | ||
Badly made packages will probably fail, but you won't have endured dpkg hell. | Badly made packages will probably fail, but you won't have endured dpkg hell. | ||
== | == See Also == | ||
[[UbuntuHelp:AptGetHowto|AptGetHowto]] | * [[UbuntuHelp:AptGetHowto|AptGetHowto]] | ||
[http://www.debian.org/doc/manuals/maint-guide/index.en.html Debian New Maintainers Guide] (this is the | * [http://www.debian.org/doc/manuals/maint-guide/index.en.html Debian New Maintainers Guide] (this is the excruciating one) | ||
* [[UbuntuHelp:Repositories/Ubuntu|Repositories/Ubuntu]] | |||
* [[UbuntuHelp:AptCdrom|AptCdrom]] | |||
* [[UbuntuHelp:AptGet/Offline/Repository|AptGet/Offline/Repository]] | |||
---- | ---- | ||
[[category: | [[category:CategoryOffline]] [[category:CategoryPackageManagement]] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2010年5月20日 (四) 00:03的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Repositories/Personal }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/af | • {{#if: UbuntuHelp:Repositories/Personal|Afrikaans| [[::Repositories/Personal/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ar | • {{#if: UbuntuHelp:Repositories/Personal|العربية| [[::Repositories/Personal/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/az | • {{#if: UbuntuHelp:Repositories/Personal|azərbaycanca| [[::Repositories/Personal/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/bcc | • {{#if: UbuntuHelp:Repositories/Personal|جهلسری بلوچی| [[::Repositories/Personal/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/bg | • {{#if: UbuntuHelp:Repositories/Personal|български| [[::Repositories/Personal/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/br | • {{#if: UbuntuHelp:Repositories/Personal|brezhoneg| [[::Repositories/Personal/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ca | • {{#if: UbuntuHelp:Repositories/Personal|català| [[::Repositories/Personal/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/cs | • {{#if: UbuntuHelp:Repositories/Personal|čeština| [[::Repositories/Personal/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/de | • {{#if: UbuntuHelp:Repositories/Personal|Deutsch| [[::Repositories/Personal/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/el | • {{#if: UbuntuHelp:Repositories/Personal|Ελληνικά| [[::Repositories/Personal/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/es | • {{#if: UbuntuHelp:Repositories/Personal|español| [[::Repositories/Personal/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/fa | • {{#if: UbuntuHelp:Repositories/Personal|فارسی| [[::Repositories/Personal/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/fi | • {{#if: UbuntuHelp:Repositories/Personal|suomi| [[::Repositories/Personal/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/fr | • {{#if: UbuntuHelp:Repositories/Personal|français| [[::Repositories/Personal/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/gu | • {{#if: UbuntuHelp:Repositories/Personal|ગુજરાતી| [[::Repositories/Personal/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/he | • {{#if: UbuntuHelp:Repositories/Personal|עברית| [[::Repositories/Personal/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/hu | • {{#if: UbuntuHelp:Repositories/Personal|magyar| [[::Repositories/Personal/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/id | • {{#if: UbuntuHelp:Repositories/Personal|Bahasa Indonesia| [[::Repositories/Personal/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/it | • {{#if: UbuntuHelp:Repositories/Personal|italiano| [[::Repositories/Personal/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ja | • {{#if: UbuntuHelp:Repositories/Personal|日本語| [[::Repositories/Personal/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ko | • {{#if: UbuntuHelp:Repositories/Personal|한국어| [[::Repositories/Personal/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ksh | • {{#if: UbuntuHelp:Repositories/Personal|Ripoarisch| [[::Repositories/Personal/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/mr | • {{#if: UbuntuHelp:Repositories/Personal|मराठी| [[::Repositories/Personal/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ms | • {{#if: UbuntuHelp:Repositories/Personal|Bahasa Melayu| [[::Repositories/Personal/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/nl | • {{#if: UbuntuHelp:Repositories/Personal|Nederlands| [[::Repositories/Personal/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/no | • {{#if: UbuntuHelp:Repositories/Personal|norsk| [[::Repositories/Personal/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/oc | • {{#if: UbuntuHelp:Repositories/Personal|occitan| [[::Repositories/Personal/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/pl | • {{#if: UbuntuHelp:Repositories/Personal|polski| [[::Repositories/Personal/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/pt | • {{#if: UbuntuHelp:Repositories/Personal|português| [[::Repositories/Personal/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ro | • {{#if: UbuntuHelp:Repositories/Personal|română| [[::Repositories/Personal/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/ru | • {{#if: UbuntuHelp:Repositories/Personal|русский| [[::Repositories/Personal/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/si | • {{#if: UbuntuHelp:Repositories/Personal|සිංහල| [[::Repositories/Personal/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/sq | • {{#if: UbuntuHelp:Repositories/Personal|shqip| [[::Repositories/Personal/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/sr | • {{#if: UbuntuHelp:Repositories/Personal|српски / srpski| [[::Repositories/Personal/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/sv | • {{#if: UbuntuHelp:Repositories/Personal|svenska| [[::Repositories/Personal/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/th | • {{#if: UbuntuHelp:Repositories/Personal|ไทย| [[::Repositories/Personal/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/tr | • {{#if: UbuntuHelp:Repositories/Personal|Türkçe| [[::Repositories/Personal/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/vi | • {{#if: UbuntuHelp:Repositories/Personal|Tiếng Việt| [[::Repositories/Personal/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/yue | • {{#if: UbuntuHelp:Repositories/Personal|粵語| [[::Repositories/Personal/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/zh | • {{#if: UbuntuHelp:Repositories/Personal|中文| [[::Repositories/Personal/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/zh-hans | • {{#if: UbuntuHelp:Repositories/Personal|中文(简体)| [[::Repositories/Personal/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Repositories/Personal | UbuntuHelp:Repositories/Personal | {{#if: | :}}Repositories/Personal}}/zh-hant | • {{#if: UbuntuHelp:Repositories/Personal|中文(繁體)| [[::Repositories/Personal/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:Repositories/Personal|:Repositories/Personal|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Repositories/Personal/zh | | {{#ifexist: Repositories/Personal/zh | | {{#ifeq: {{#titleparts:Repositories/Personal|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Repositories/Personal|1|-1|}} | zh | | }}
General information: Repositories in Ubuntu
Introduction
There are often a few packages that you want to install that don't exist in the Ubuntu repositories. If they have any dependencies on other packages, trying to use dpkg can drop you into "dpkg hell", and having apt resolve those dependencies for you would really help. There are full blown methods of creating your own local repository, such as Debarchiver or Dak. These are overkill, when all you want is a means of resolving dependencies of the handful of packages you've downloaded from the web (not for an entire repository that you want to use without Internet connection; for this use AptGet/Offline/Repository). A simple solution is to use dpkg-scanpackages, which will build a repository you can add to your sources.list.
Creating a Personal Repository
There are 4 steps to setting up a simple repository for yourself
- Install dpkg-dev
- Put the packages in a directory
- Create a script that will scan the packages and create a file apt-get update can read
- Add a line to your sources.list pointing at your repository
Install dpkg-dev
Type in a terminal
sudo apt-get install dpkg-dev
The Directory
Create a directory where you will keep your packages. For this example, we'll use /usr/local/mydebs.
sudo mkdir -p /usr/local/mydebs
Now move your packages into the directory you've just created. Previously downloaded Packages are generally stored on your system in the /var/cache/apt/archives directory. If you have installed apt-cacher you will have additional packages stored in its /packages directory.
The Script update-mydebs
It's a simple three liner:
#! /bin/bash cd /usr/local/mydebs dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
Cut and paste the above into gedit, and save it as update-mydebs in ~/bin. (the tilde '~' means your home directory. If ~/bin does not exist, create it: Ubuntu will put that directory in your PATH. It's a good place to put personal scripts). Next, make the script executable:
chmod u+x ~/bin/update-mydebs
How the script works: dpkg-scanpackages looks at all the packages in mydebs, and the output is compressed and written to a file (Packages.gz) that apt-get update can read (see below for a reference that explains this in excruciating detail). /dev/null is an empty file; it is a substitute for an override file which holds some additional information about the packages, which in this case is not really needed. See deb-override(5) if you want to know about it.
Sources.list
add the line
deb file:/usr/local/mydebs ./
to your /etc/apt/sources.list, and you're done.
CD Option
You can burn the directory containing the debs to a CD and use that as a repository as well (good for sharing between computers). To use the CD as a repository, simply run
sudo apt-cdrom add
Using the Repository
Whenever you put a new deb in the mydebs directory, run
sudo update-mydebs sudo apt-get update
Now your local packages can be manipulated with Synaptic, aptitude and the apt commands: apt-get, apt-cache, etc. When you attempt to apt-get install, any dependencies will be resolved for you, as long as they can be met. Badly made packages will probably fail, but you won't have endured dpkg hell.
See Also
- AptGetHowto
- Debian New Maintainers Guide (this is the excruciating one)
- Repositories/Ubuntu
- AptCdrom
- AptGet/Offline/Repository