Teach you every minute to get under Linux yum source configuration

Linux operating system for our technical staff, whether it is developing, testing or operation and maintenance should be a familiar operating system. That being the case, then it is not open around the Linux operating system installation package. Installed packages under Linux there are three, namely rpm installation source compiler installed, yum install. Next, we will focus on what the most common and best use of an installation method that yum installed, because it can help us to resolve dependencies between packages to improve efficiency Oh.

A, yum Know

1. yum is how to install software

l yum repository (also known as yum source) is used to store various rpm dependencies between packages and packages (repodata directory)

l need to install computer software to the designated yum repositories to install packages

2. yum source role

Package Manager, software housekeeper in similar Windows.

3. yum source advantage

Resolve dependencies between packages, improve the efficiency of operation and maintenance personnel.

4. yum SOURCES

① local yum source

A local yum yum source is a local warehouse, typically the local system CD or image file.

② network yum source

The so-called network yum yum source refers to a warehouse in a remote (not local), you need to install networking.

  • More well-known domestic network source (aliyun source, source 163, sohu source, the well-known universities and other open source image)
  • Better-known network of foreign source (centos source, redhat source, Red Hat extended epel source, etc.)
  • Specific software related to network sources (Nginx, MySQL, Zabbix, etc.)

Two, yum source configuration

Note: The following operating system Centos 6.5, for example, similar to other Linux systems.

1. Local source configuration yum

① Mount mirrored to the local operating system

Manually mount the CD to the specified directory

[root@Heima ~]# mount -o ro /dev/sr0 /mnt
Boot automatically mount
[root@Heima ~]# echo "mount -o ro /dev/sr0 /mnt" >> /etc/rc.local
or
[root@Heima ~]# echo "/dev/sr0 /mnt iso9660 defaults,ro 0 0" >> /etc/fstab

Description:

1. /etc/rc.local file is an operating system boot file a final reading, the document needs to have executable permissions, the system will help you to automatically mount at boot time, it is recommended to use this method.

2. / etc / fstab file can be, but if you modify the error could cause the system to get up.

② designated by yum repository configuration files

Into a specified directory, clear the default operating system Centos source
[Root @ Heima ~] # cd /etc/yum.repos.d/
[root@Heima yum.repos.d]# rm -f ./*
Creating ending .repo files in that directory
[root@Heima yum.repos.d]# vim local.repo
[Local] warehouse name, do not have special symbols (custom)
name yum repository description = local, can not write
baseurl = file: /// mnt designated yum repository path (important), file: // indicates the local warehouse
enabled = 1 indicates enabled warehouse 1 is enable; 0 indicates not enabled
gpgcheck = 0 not verify the signature warehouse packages, 0 means no check; 1 indicates parity

2. Network Configuration yum

① Method 1:

Yum repository can be specified directly by modifying the configuration file.

Specific software network source:
[root@Heima yum.repos.d]# cat nginx.repo
[nginx]
name=nginx repo
baseurl = http: //nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
The basic software network source:
[root@Heima yum.repos.d]# cat 163.repo
[163]
​name=163 network yum
baseurl = http: //mirrors.163.com/centos/6/os/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
[root@Heima yum.repos.d]# cat aliyun.repo
[Aliyun
name=aliyun
baseurl = http: //mirrors.aliyun.com/centos/6/os/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

② Method 2:

By installing the package, the file is automatically created .repo (automatic configuration).

Configuring epel source as an example:

1) Download the source package epel
[root@Heima ~]# wget -P /tmp https://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm --no-check-certificate
--2019-02-20 09:42:41-- https://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm
Resolving mirrors.aliyun.com... 119.96.206.232, 116.211.153.230, 116.211.153.236, ...
Connecting to mirrors.aliyun.com|119.96.206.232|:443... connected.
WARNING: certificate common name “img.ucdl.pp.uc.cn” doesn’t match requested host name “mirrors.aliyun.com”.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-redhat-package-manager]
Saving to: “/tmp/epel-release-6-8.noarch.rpm”
100%[================================================================================>] 14,540 --.-K/s in 0.03s
2019-02-20 09:42:41 (538 KB/s) - “/tmp/epel-release-6-8.noarch.rpm” saved [14540/14540]

2) installation package

[root@Heima ~]# rpm -ivh /tmp/epel-release-6-8.noarch.rpm
warning: /tmp/epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1: warm-release ########################################### [100 %]

3) Check the configuration file

[Root @ Heim ~] # ls /etc/yum.repos.d/epel*
/etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo

Three, yum tool related commands

# yum install package -y
The default is to install the software from the warehouse, specifies the name of the software. A plurality of packages separated by a space; -Y (canceled interaction)
# yum install ./xxx.rpm
or
# yum localinstall ./xxx.rpm
Rpm installation package from the local specified path, rather than from its warehouse
# yum remove 或者 erase package
Uninstall packages
# yum update
All software updates warehouse than the machine has been installed to the software
# yum update package
Specified software upgrade
# yum search mysql
Software search out all of the software name "mysql" keyword
# yum provides "libaudiofile.so.0"
Find out what packages are provided by the module
# yum clean all
Prior to empty the cache yum list
# yum makecache
Create a new cache
# yum list
All packages listed warehouse
# yum repolist
List the depots have been configured
# Yum list | grep keyword
@ Representatives have successfully installed
# yum list installed
View installed package
# yum grouplist
View package group
# yum groupinstall "包组"
Installation package group
# yum groupremove "包组"

IV Summary

1. yum is a tool for installing rpm packages under Linux, use it to install the package, you must configure yum source in advance.

2. yum yum source into a local source and a source network yum. Local yum source refers to a depot local; network yum source refers to software in a remote warehouse.

3. The existing warehouse software packages also have repodata directory that store dependencies between software

4. yum tool to install rpm package biggest advantage is to resolve package dependencies, improve work efficiency

Guess you like

Origin blog.csdn.net/itcast_cn/article/details/94553819