Home  >  Article  >  Operation and Maintenance  >  what is linux repo

what is linux repo

藏色散人
藏色散人Original
2023-03-25 09:08:023549browse

linux repo refers to "repository", indicating the location of the installation file. At the same time, repo is also the name of the toolkit required to develop the android host environment in the linux environment and is used for version control; the repo file refers to Fedora The configuration file of the yum source. Usually a repo file defines the details of one or more software repositories.

what is linux repo

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

What is linux repo?

In the linux operating system, repo=repository indicates the location of the installation file. At the same time, repo is also used to develop android hosts in the linux environment. The name of the toolkit required by the environment for version control. REPO is a script written by Google using a python script to call Git. It is mainly used to download and manage the software warehouse of the android project.

Detailed explanation of the configuration file repo file of linux yum

repo file:

The repo file is the yum source (software) in Fedora Warehouse) configuration file, usually a repo file defines the details of one or more software warehouses, such as where we will download software packages that need to be installed or upgraded. The settings in the repo file will be read and applied by yum!

The working principle of YUM is not complicated. The dependencies of each RPM software will be recorded in the header. If the contents of the header can be recorded and analyzed, you can know each What additional basic software needs to be installed before the software is installed. That is to say, first use the analysis tool to analyze all RPM files on the server, and then record the analysis. As long as the recorded files are queried when installing or upgrading, you can know all the associated software. So the basic workflow of YUM is as follows:

Server side: All RPM software packages are stored on the server, and then the dependencies of each RPM file are analyzed using relevant functions, and these data are recorded into files. Stored in a specific directory on the server.

Client: If you need to install a certain software, first download the dependency file recorded on the server (can be through WWW or FTP), analyze the record data downloaded by the server, and then obtain all All relevant software can be downloaded and installed at once.

vi /etc/yum.conf
[main]
cachedir=/var/cache/yum
#cachedir:yum缓存的目录,yum在此存储下载的rpm包和数据库,一般是/var/cache/yum。
debuglevel=2
#debuglevel:除错级别,0──10,默认是2 貌似只记录安装和删除记录
logfile=/var/log/yum.log
pkgpolicy=newest

#pkgpolicy: Package policy. There are two options, newest and last. This function is if you set up multiple repositories, and the same software exists in different repositories at the same time, which one yum should install. If it is newest, yum will install the latest version. . If it is last, yum will sort the server IDs alphabetically and select the last one to install the software on the server. Generally choose the newest.

distroverpkg=centos-release

#Specify a software package, and yum will determine your release version based on this package. The default is redhat-release, or it can be any installed version for your own release. rpm package.

tolerant=1

#tolerent, there are also two options, 1 and 0, indicating whether yum tolerates errors related to software packages on the command line. For example, if you want to install 1, 2, 3 packages, and 3 of them have been installed before. If you set it to 1, yum will not show an error message. The default is 0.

exactarch=1
#exactarch,有两个选项1和0,代表是否只升级和你安装软件包cpu体系一致的包,如果设为1,则如你安装了一个i386的rpm,则yum不会用1686的包来升级。
retries=20
#retries,网络连接发生错误后的重试次数,如果设为0,则会无限重试。
obsoletes=1
gpgcheck=1
#gpgchkeck= 有1和0两个选择,分别代表是否是否进行gpg校验,如果没有这一项,默认是检查的。
reposdir=/etc/yy.rm #默认是 /etc/yum.repos.d/ 低下的 xx.repo后缀文件

#It will be included by default. That is to say, /etc/yum.repos.d/xx.repo no matter how many configuration files there are and how many [name] there are in each, they will all be integrated into one in the end. It can be seen that the repeated [name] behind it overwrites the previous

exclude=xxx

#exclude to exclude certain software from the upgrade list. You can use wildcards. Each item in the list must be separated by spaces. This is useful for installation. For example, beautification package, Chinese patch is especially useful for friends.

keepcache=[1 or 0]

# Setting keepcache=1, yum retains cached headers and packages after successfully installing the package. The default value is keepcache=0. Do not save

reposdir=[包含 .repo 文件的目录的绝对路径]

#. This option allows the user to specify the absolute path of the .repo file. The .repo file contains information about the software repository (same as the [repository] section in the /etc/yum.conf file).

Part 2:

vi /etc/yum.repo.d/xx.repo

In fact, this field can also be configured directly in yum.conf

[serverid]

#where serverid is used for To distinguish between different repositories, there must be a unique name. Repeatedly, the front covers the back - or the other way around? ? ? Using enabled to test is to overwrite the previous

name=Some name for this server

#name, which is a description of the repository and supports variables like $releasever $basearch; name=Fedora Core $releasever - $basearch - Released Updates

baseurl=url://path/to/repository/

#The baseurl is the most important part of the server settings. Only when the settings are correct can the software be obtained from it. Its format is:

baseurl=url://server1/path/to/repository/
url://server2/path/to/repository/
url://server3/path/to/repository/

#The url supports three protocols: http:// ftp:// file://. The baseurl can be followed by multiple URLs. You can change it to a faster mirror site yourself, but there can only be one baseurl, which means it cannot be in the following format:

baseurl=url://server1/path/to/repository/
baseurl=url://server2/path/to/repository/
baseurl=url://server3/path/to/repository/

The directory pointed to by the url must be this The upper level of the repository header directory, it also supports variables such as $releasever $basearch.

#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch

#The above line specifies the address list of a mirror server, which is usually enabled. In this example, a comment symbol is added to disable it. We can try to replace $releasever and $basearch with their corresponding versions and Architectures, such as 10 and i386, are opened in a browser and we can see a long list of available mirror server addresses.

You can add multiple options after the url, such as gpgcheck, exclude, failovermethod, etc., for example:

gpgcheck=1

exclude=gaim

# Among them, gpgcheck and exclude have the same meaning as the [main] part, but they only work on this server.

failovermethod=priority

#failovermethode has two options: roundrobin and priority, which mean there are When there are multiple URLs to choose from, the order selected by yum and roundrobin are randomly selected. If the connection fails, the next one is used, and the cycle is repeated. Priority starts from the first one according to the order of the URLs. If not specified, the default is roundrobin.

enabled=[1 or 0]

#When a software repository is configured as enabled=0, yum will not use the repository as a software package when installing or upgrading software packages. Provide source. Using this option, the software repository can be enabled or disabled.

#You can also easily enable and disable specified software repositories through yum's --enablerepo=[repo_name] and --disablerepo=[repo_name] options, or through PackageKit's "Add/Remove Software" tool.

Several variables

$releasever, the release version, is obtained from the distroverpkg in the [main] section. If not, it is judged based on the redhat-release package.

$arch, cpu system, such as i686, athlon, etc.

$basearch, the basic system group of cpu, such as i686 and athlon both belong to i386, alpha and alphaev6 both belong to alpha.

After the yum.conf setting is completed, we can fully experience the convenience brought by yum.

There is one more thing that has not been done. That is to import the GPG key of each repository. As mentioned before, yum can use gpg to verify the package to ensure the integrity of the downloaded package, so we first need to go to each repository site to find the gpg key, which is usually placed prominently on the homepage. Location, some plain text files with names such as RPM-GPG-KEY.txt, download them, and then use the rpm --import xxx.txt command to import them. It is best to import the GPG-KEY that comes with the distribution. rpm --import /usr/share/doc/redhat-release-*/RPM-GPG-KEY is used for official software upgrades.

Recommended learning: "linux video tutorial"

The above is the detailed content of what is linux repo. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn