Linux运维学习第九课

来源:互联网 发布:js复选框取消选中事件 编辑:程序博客网 时间:2024/04/30 11:50

############软件的安装###########


###
软件名###

[abrt-addon-ccpp]-[2.1.11-19].[el7].[x86_64].rpm    ##rpm
结尾的适用与redhat操作系统
     



###
软件安装方式###

分为两种,rpm安装与yum安装
---------------------------------------------------------------------------------------------------------------
1.rpm
rpm -ivh    name.rpm    ##
安装 ,-v显示过程,-h指定加密方式为hash
        -e  name         ##
卸载
    -ql name        ##
查询软件生成文件
    -qlp    name.rpm    ##
查询软件安装后会生成什么文件
    -qa        ##
查询系统中安装的所有软件名称
    -qa |grep name      ##
查询软件是否安装
    -q name        ##
。。。。
    -qp name.rpm     ##
查询软件安装包安装后的名字
    -qf filename       ##
查看filename属于那个安装包
    -ivh name.rpm --force   ##
强制安装
    -qi name        ##
查看软件信息
    -Kv name.rpm        ##
检测软件包是否被篡改
    -qp name.rpm --scripts ##
检测软件在安装或卸载过程中执行的动作
---------------------------------------------------------------------------------------------------------------
2.yum
yum
上层软件管理工具,最重要的功能是可以解决软件的倚赖关系
yum
能够投入使用的前提是必须要有yum源,以及配置源的指向文件

yum  install  
软件名/软件包的绝对路径

###yum
源配置###(需要root权限)

分为三种  本地yum 共享yum 第三方软件仓库
--------------------------------------------------------------------------------------------------------------
1.
配置本地yum
  1>
先准备一个iso镜像文件(与系统适配的,版本号不小于当前版本号) rhel-server-7.2-x86_64-dvd.iso
  2>
将镜像文件挂载在/mnt    mountrhel-server-7.2-x86_64-dvd.iso /mnt
  3>
编辑本地配置文件
  [root@foundation12 ~]# vim /etc/yum.repos.d/rht7.2.repo
    1 [rhel7.2]
    2 name=rhel7.2
    3 baseurl=file:///mnt
    4 gpgcheck=0
  4>
以上的操作都是临时操作,在重启机器之后就会消失,如果需要长期挂载,则需要更改另一个配置文件:
  [root@foundation12 ~]# vim/etc/rc.d/rc.local
  
在打开的文件后面添加代码:
   mountrhel-server-7.2-x86_64-dvd.iso  /mnt
---------------------------------------------------------------------------------------------------------------
2.
配置共享源
************************************
  #
以本机作为服务端
  1>
首先本机要有httpd服务:
    yum install httpd
    systemctl stop firewalld     ##
关闭火墙
    systemctl disable firewalld  ##
开机不启动火墙
    systemctl start httpd        ##
开启httpd
    systemctl enable httpd       ##
开机启动httpd
  2>
建立共享目录,并挂载镜像
    mkdir /var/www/html/rhel7.2   (
文件路径必须是/var/www/html/)
    mountrhel-server-7.2-x86_64-dvd.iso  /var/www/html/rhel7.2
  3>
测试
   
打开浏览器 输入http://本机ip/rhel7.2 就能看到镜像中的内容
   
例子:  http://172.25.254.12/rhel7.2
  *4>
修改本机yum源配置 (如果本机yum源不用这个镜像就不需要做第4步与第5)
  [root@foundation12 ~]# vim/etc/yum.repos.d/rht7.2.repo
    1 [rhel7.2]
    2 name=rhel7.2
    3 baseurl=file:///var/www/html/rhel7.2
    4 gpgcheck=0
  *5>
开机自动挂载
    [root@foundation12 ~]# vim/etc/rc.d/rc.local
    
添加:mountrhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2
************************************
  #
在其他主机上通过这个yum源进行安装
  1>
修改yum源配置
   [root@foundation13 ~]# vim/etc/yum.repos.d/rht7.2.repo
    1 [rhel7.2]
    2 name=rhel7.2
    3 baseurl=http://
服务端ip/rhel7.2
    4 gpgcheck=0
  2>yum clean all   ##
清除yum缓存,识别新配置
  3>
进行软件安装,安装来源是服务端的iso镜像
---------------------------------------------------------------------------------------------------------------
3.
第三方软件仓库搭建
  1>
把所有的rpm软件包存放在一个目录下,这个目录只能存放rpm文件
  2>createrepo -v  rpm
存放目录(绝对路径相对路径都可以)
    **
每次在这个目录下添加软件都要执行一次这个命令
  3>
修改yum源配置文件
  [root@foundation12 ~]# vim/etc/yum.repos.d/rht7.2.repo
    1 [rhel7.2]
    2 name=rhel7.2
    3 baseurl=file://rpm
存放目录(绝对路径)
    4 gpgcheck=0
  4>yum clean all
  #
也可以将第三方软件仓库进行共享,作为共享源
 
rpm文件拷到/var/www/html/的一个目录下,就可以将这些软件包共享出去
 
在其他主机的/etc/yum.repos.d/xxxx.repo中添加
    1 [rhel7.2]
    2 name=rhel7.2
    3 baseurl=http://
服务端ip/rpm存放目录(绝对路径)
    4 gpgcheck=0
 
就可以使用这些软件包了

####yum
命令####
yum     install     softwarename/
软件包的绝对路径   ##安装
        repolist            ##
列出设定yum源信息
        remove      softwarename    ##
卸载
        list        softwarename    ##
查看软件源中是否有次软件
        list all            ##
列出所有软件名称
        list installd           ##
列出已经安装的软件名称
        list available          ##
列出可以用yum安装的软件名称
        clean all           ##
清空yum缓存
        search      softwareinfo    ##
根据软件信息搜索软件名字
        whatprovides    filename    ##
yum源中查找包含filename文件的软件包      
        update              ##
更新软件
        history             ##
查看系统软件改变历史
        reinstall   softwarename    ##
重新安装
        info        softwarename    ##
查看软件信息
        groups list         ##
查看软件组信息
        groups info softwaregroup   ##
查看软件组内包含的软件
        groups install  softwaregroup   ##
安装组件
        groups remove   softwaregroup   ##
卸载组件
 

0 0
原创粉丝点击