RedHat7.4 yum configuration

RedHat7.4 yum configuration


 

 

1. yum configuration

1.1 Local yum source configuration

  1. Settings Use ISO image software: Virtual Machine -> Settings

 

Local ISO selection
Local ISO selection

 

  1. At this point, after setting the local ISO, mounted in the Linux file / dev / sr0

 

sr0 equipment
sr0 equipment

 

  1. The sr0 mount / mnt / cdrom path, if this path does not exist, create.
# 创建路径
mkdir -p /mnt/cdrom
# 一次性挂载
mount /dev/sr0 /mnt/cdrom

 

Mount Mirror
Mount Mirror

 

  1. Permanent mount , open the file: / etc / fstab, and add a line

 

fstab file
fstab file

 

From left to right:

  • Mounted file system name or UUID or LABEL
  • Mount points
  • File system
  • Mount options: ro, noatime, async, etc.
  • dump option, usually the default 0
  • fsck options, general default 0
  1. After saving, command line, type mount -a mount entries to automatically mount fstab file, after each restart automatically mounted.

  2. /Etc/yum.repos.d/ switch to the directory, if there is a backup of all files, and create a yum end of file .repo, create local.yum.repo here, reads as follows

[local_yum]    # 括号中的名称为仓库源名称,通常为字母和数字,必须填写
name=local     # 对yum的描述,可写可不写
baseurl=file:///mnt/cdrom    # baseurl表示声明yum可以管理并使用的rpm包路径,必须填写
enabled=1            # enabled 表示当前仓库是否开启:1为开启,0为关闭,此项不写默认为开启
gpgcheck=0           # gpgcheck 表示安装rpm包时,是否基于公私钥对匹配包的安全信息:1表示开启, 0表示关闭,此项不写默认为验证
  1. Run Cleanup command and query the local package
    yum clean all;yum list | wc -l;

 

Cleanup and local package
Cleanup and local package

 

Configuring network source yum source CentOS

Note: If there is the best source of local yum install wget, easy to download the rpm package to the virtual machine can also be used to download and upload into the windows linux

  1. Find yum dependencies installed
# 查找已经安装的yum依赖包
rpm -qa | grep yum
  1. The uninstall yum dependencies
# 直接卸载已经安装的yum依赖包,不检查依赖
rpm -qa | grep yum | xargs rpm -e --nodeps

 

Uninstall dependencies
Uninstall dependencies

 

  1. Download dependencies, create a directory and download the corresponding file:
mkdir -p /tmp/yum; cd $_;
# 下载安装包
yum_list="yum-utils-1.1.31-50.el7.noarch.rpm 
yum-updateonboot-1.1.31-50.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 
yum-3.4.3-161.el7.centos.noarch.rpm 
python-kitchen-1.1.1-5.el7.noarch.rpm
python-chardet-2.2.1-1.el7_1.noarch.rpm";
for i in ${yum_list}; do wget http://mirrors.163.com/centos/7/os/x86_64/Packages/${i}; done;
  1. Yum install dependencies, installation may depend on a single error, the entire installation: * may also prompt other dependencies exist rpm -ivh, if prompted to http://mirrors.163.com/centos/7/os or based on keywords http://mirrors.aliyun.com/centos/7/os downloaded from the website.

 

Reliance installation
Reliance installation

 

  1. /Etc/yum.repos.d/ configuration file under the agreement with the local yum configuration
[base]
name= yum repo
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
enabled=1
gpgcheck=0
  1. After configuration is complete check list rpm

 

yum list
yum list

 

  1. Try to install it vim: yum install vim -y

Guess you like

Origin www.cnblogs.com/h-zhang/p/11068991.html