You can define individual Yum repositories by adding [repository] sections (where repository is a unique repository ID, such as [my_personal_repo]) to /etc/yum.conf or to .repo files in the /etc/yum.repos.d/directory. All .repo files in /etc/yum.repos.d/are read by yum; best practice is to define your repositories here instead of in /etc/yum.conf. You can create new, custom .repo files in this directory, add [repository] sections to those files, and the next time you run a yum command, it will take all newly-added repositories into account.
Here is a (bare-minimum) example of the form a .repo file should take:
[repository_ID]
name=A Repository Name
baseurl=http://path/to/repo or ftp://path/to/repo or file://path/to/local/repo
Every [repository] section must contain the following minimum parts:
[repository_ID]
The repository ID is a unique, one-word (no spaces; underscores are allowed) string of characters (enclosed by brackets) that serves as a repository identifier.
name= This is a human-readable string describing the repository.
baseurl=http://path/to/repo, ftp://path/to/repo, file://path/to/local/repo
This is a URL to the directory where the repodata directory of a repository is located. Usually this URL is an HTTP link, such as:
Yum always expands the $releasever, $arch and $basearch variables in URLs. See the following section for explanations of all Yum variables: Section 1.3.3, “Using Yum Variables”.
*
If the repository is available over FTP, use: ftp://path/to/repo
*
If the repository is local to the machine, use file://path/to/local/repo
*
If a specific online repository requires basic HTTP authentication, you can specify your username and password in the baseurl= line by prepending it as username:password@link. For example, if a repository on http://www.example.com/repo/ requires a username of "user" and a password of "password", then the baseurl link can be specified as baseurl=http://user:password@www.example.com/repo/
Here are some other useful-but-optional [repository] options:
enabled=<1 or 0>
Setting enabled=0 instructs yum not to include that repository as a package source when performing updates and installs. This is an easy way of quickly turning repositories on and off, which is useful when you desire a single package from a repository that you do not want to enable for updates, etc. Turning repositories on and off can also be performed quickly by passing either the --enablerepo= or --disablerepo= option to yum, or easily through PackageKit's Add/Remove Software window. For the latter, refer to Section 2.2.1, “Refreshing Software Sources (Yum Repositories)”.
xiadao_81 于 2009-12-27 15:20:50发表:
yum命令很强大,只要你能连上网就行了!
hery_yang 于 2009-12-27 13:13:37发表:
不懂
eplinux 于 2009-12-26 23:22:37发表:
You can define individual Yum repositories by adding [repository] sections (where repository is a unique repository ID, such as [my_personal_repo]) to /etc/yum.conf or to .repo files in the /etc/yum.repos.d/directory. All .repo files in /etc/yum.repos.d/are read by yum; best practice is to define your repositories here instead of in /etc/yum.conf. You can create new, custom .repo files in this directory, add [repository] sections to those files, and the next time you run a yum command, it will take all newly-added repositories into account.
or --disablerepo= option to yum, or easily through PackageKit's Add/Remove Software window. For the latter, refer to Section 2.2.1, “Refreshing Software Sources (Yum Repositories)”.
Here is a (bare-minimum) example of the form a .repo file should take:
[repository_ID]
name=A Repository Name
baseurl=http://path/to/repo or ftp://path/to/repo or file://path/to/local/repo
Every [repository] section must contain the following minimum parts:
[repository_ID]
The repository ID is a unique, one-word (no spaces; underscores are allowed) string of characters (enclosed by brackets) that serves as a repository identifier.
name=
This is a human-readable string describing the repository.
baseurl=http://path/to/repo, ftp://path/to/repo, file://path/to/local/repo
This is a URL to the directory where the repodata directory of a repository is located. Usually this URL is an HTTP link, such as:
baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
Yum always expands the $releasever, $arch and $basearch variables in URLs. See the following section for explanations of all Yum variables: Section 1.3.3, “Using Yum Variables”.
*
If the repository is available over FTP, use: ftp://path/to/repo
*
If the repository is local to the machine, use file://path/to/local/repo
*
If a specific online repository requires basic HTTP authentication, you can specify your username and password in the baseurl= line by prepending it as username:password@link. For example, if a repository on http://www.example.com/repo/ requires a username of "user" and a password of "password", then the baseurl link can be specified as baseurl=http://user:password@www.example.com/repo/
Here are some other useful-but-optional [repository] options:
enabled=<1 or 0>
Setting enabled=0 instructs yum not to include that repository as a package source when performing updates and installs. This is an easy way of quickly turning repositories on and off, which is useful when you desire a single package from a repository that you do not want to enable for updates, etc. Turning repositories on and off can also be performed quickly by passing either the --enablerepo=
bingwzi 于 2009-12-19 21:39:01发表:
可以在yum的配置文件里添加yum源。
longyun 于 2009-12-19 21:11:55发表:
没明白楼主想说什么?
haolong 于 2009-12-19 21:09:17发表:
是不是不能上网啊?
wskttg 于 2009-12-19 19:48:24发表:
问题没看懂
alick 于 2009-12-19 18:16:03发表:
怎么个不成功,LZ说一下。
其实只要你上网能连上软件源就一般没有问题
worldeditor 于 2009-12-19 17:52:55发表:
不懂