liunx之redhat中软件管理(yum源安装)

#####linux中的软件管理####


##1。使用已经网络安装资源安装软件##
首先在自己安装的虚拟机中
cd  /etc/yum.repos.d/
再进行vim   yum.repo  编写
或者在自己安装的虚拟机中
vim /etc/yun.repos.d/yum.repo   ##文件名称必须以repo结尾

[rhe17.2]
name=rhel17.2 source    ###对软件源的描述
baseurl=http://172.25.254.250/rhel7.2/x86_64/dvd    ##网络安装源  
注意:当在自己电脑上使用删掉/x86_64/dvd 即可
当连接主机与所下载的虚拟机时先 vim /root/.ssh/known_hosts删光

gpgcheck=0    ##不检测gpgcheck   
enabled=1     ##此安装源语句块生效

yum clean all ##清空系统中原有的yum信息
yum repolist

##2.配置本地yum源###
1.获得一个与本机系统版本一致的系统镜像


2.挂载镜像
mount  /xxx/xxxx.iso   /rhel7.2                              临时挂载

3.设定永久挂载
vim /etc/rc.d/rc.local
mount /xxx/xxxxx.iso   /rhel7.2
chmod 755  /etc/rc.d/rc.local  ##在系统开机时会自动执行此脚本

配置永久挂载


4.设定系统安装源指向

在就行这一步时,先进行查看/etc/yum.repos.d/下有无 .repo文件,

如果存在则必须把文件移动到一个文件夹中,否则会在安装时出现以下问题

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
http://172.25.254.250/rhel7.0/x86_64/dvd/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 172.25.254.250:80; No route to host"
Trying other mirror.


表示安装源文件不能连接,此时下载不能进行,因为读取文件时不分先后,

系统会读取带有‘repo’的文件,我们所写的文件yum.repo自然不会被读取

导致下载不能完成

mkdir /etc/yum.repos.d/l
mv /etc/yum.repos.d/*/etc/yum.repos.d/l


vim /etc/yum.repos.d/yum.repo
[rhel7.2]
name=rhel7.2
baseurl=file:///rhel7.2
gpgcheck=0

yum clean all

yum  install httpd  -y

表示下载httpd服务完成
####3.共享型yum源的部署####
1.在一台已经建立好本地yum源的主机中安装httpd
yum install  httpd

2.配置网络yum源

进行网络环境的配置,以便于yum源安装

systemctl start httpd
systemctl stop firewalld
systemctl  enable  httpd
systemctl  disable  firewalld


mkdir /var/www/html/rhel7.2
mount  /xxxx/xxxx.iso  /var/www/html/rhel7.2


vim  /etc/rc.d/rc.local
mount  /xxxx/xxxx.iso  /var/www/html/rhel7.2


测试:

在浏览器中输入地址:
http://ip/rhel7.2
http://172.25.254.79/rhel7.2   <<<<<<此地值就是网络yum源地址

####4.yum命令###
1.yun命令的使用必须时在yum源搭建成功后才能正常运行
2.yum命令的详细用法
yum      clean   all       ##清楚原有yum缓存


             repolist          ##列出仓库信息


             install  software ##安装


            update            ##更新
             list    software  ##查看软件


             list    all       ##查看所有软件

由于文件太多加管道附塞选出关于gcc的软件


            list    installde ##列出已安装软件
             list    available      ##列出可安装软件
            reinstall  software    ##重新安装
         remove  software       ##卸载
         info    software       ##查看软件信息
         search  software信息    ##根据软件信息查找软件
         whatprovides  file     ##根据文件找出包含此文件的软件
         groups  list           ##列出软件组
         groups  info           ##查看软件组的信息
         group   install  sfgroup  ##安装软件组
         groups  remove   sfgroup  ##卸载软件组

###5.用rpm命令处理软件####

rpm    -i ##安装
       -v ##显示过程
       -h  ##hash加密
       -e ##卸载
       -q ##查看
       -a ##所有
       -p ##软件包
       -ql  ##查看软件在系统中的安装路径
       -qlp ##查看未安装的软件包在系统中如果安装后产生文件的路径
       -qf  ##根据某个文件找出此文件属于那个安装包
       -qc  ##查看软件的配置文件名称
       -qd ##查看软件的帮助文件
       --scritps ##查看脚本
       --nodeps  ##安装软件忽略软件倚赖
       --force   ##强行安装软件
       --Kv ##检测软件包是否被篡改


###6.第三方软件仓库的搭建###
1.把所有的rpm包放到一个目录中
2.createrepo  -v /存放软件包的目录 ###命令执行成功后会生成repodate目录


3.vim /etc/yum.repos.d/yum.repo

在虚拟机中(没有rpm软件库)配置文件
[software]
name=software
baseurl=http://172.25.254.79/software
gpgcheck=0


[rhel7.2]
name=rhel7.2 scoure
baseurl=http://172.25.254.66/rhel7.2
gpgcheck=0

在主机中(software文件中有rpm库)配置方法

[software]
name=software
baseurl-file:///software
gpgcheck=0


[rhel7.2]
name=rhel7.2
baseurl=file:///rhel7.2
gpgcheck=0

yum clean all
yum list linuxqq

猜你喜欢

转载自blog.csdn.net/qq_42732013/article/details/81395645
今日推荐