linux中的软件管理

一、yum源的安装

1.使用网络已经安装资源的安转软件

hahahahaha  下载的软件仓库名称
http 软件网址
gpgcheck1   社区版(供使用)官方授权


vim /etc/yum.repos.d/yum.repo        ##文件名称必须以repo结尾
[rhel7.2]
name=rhel7.2 source                         ##对软件源的描述
baseurl=http://172.25.254.250/rhel7.2/x86_64/dd                 ##网络安装源
gpgcheck=0                                                                             ##不检测gpgkey
enabled=1                                                                                ##此安装源语句块生效

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

linux中的软件管理

linux中的软件管理

2.配置本地yum源

1)获得一个与本机系统版本一致的系统镜像

linux中的软件管理
2)挂载镜像
mount   /xxx/xxxxxx.iso    /rhel7.2
3)设定永久挂载
vim /etc/rc.d/rc.local
mount /xxx/xxxxxx.iso      /rhel7.2
chmod 755 /etc/rc.d/rc.local                         ##在系统开机时会自动执行此脚本

linux中的软件管理

linux中的软件管理

linux中的软件管理

4)设定系统安装源指向
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup
vim /etc/yum.repos.d/yum.repo
[rhel7.2]
name=rhel7.2
baseurl=file:///rhel7.2
gpgcheck=0

yum clean all

linux中的软件管理

linux中的软件管理

linux中的软件管理

linux中的软件管理

yum install httpd -y

linux中的软件管理
file://访问本地的文件
3.共享型yum源的部署

1)在一台已经连接好本地yum源的主机中安装httpd
yum install httpd
2)配置网络yum源
systemctl start httpd
systemctl stop firewalld
systemctl enable httpd
systemctl disable firewalld

mkdir /var/www/html/rhel7.2

linux中的软件管理
mount /xxx/xxxxxx.iso /var/www/html/rhel7.2

linux中的软件管理

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

linux中的软件管理
二、yum命令

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

linux中的软件管理
    repolist                ##列出仓库信息

linux中的软件管理
 yum   install softwar         ##安装软件

linux中的软件管理
    yum   update                           ##更新软件
    yum  list    software                ##查看软件

linux中的软件管理
 yum   list    all             ##查看所有软件

linux中的软件管理
yum    list    installed       ##列出已安装软件

linux中的软件管理
 yum   list    available       ##列出可安装软件

linux中的软件管理
 yum    reinstall software      ##重新安装软件

linux中的软件管理
 yum   remove software         ##卸载软件

linux中的软件管理
 yum   info software           ##查看软件信息

linux中的软件管理
yum    search software                   ##根据软件信息查找软件

linux中的软件管理  yum   whatprovides file                  ##根据文件找出包含此文件的软件

linux中的软件管理
yum    groups list             ##列出软件组

linux中的软件管理
yum    groups info             ##查看软件组的信息

linux中的软件管理

groups install sfgroup      ##安装软件组

group remove sfgroup     ##卸载软件组

三、用rpm命令处理软件

rpm    -ivh   software.rpm           ##安装软件(无法解决软件的依赖性)

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

rpm -ivh software.rpm  --nodeps     ##安装软件(忽略软件的依赖性)

linux中的软件管理
   rpm    -qa         ##查看系统中所有安装软件的名称

linux中的软件管理
    rpm -qa | grep software       ##查看软件是否安装

linux中的软件管理

  rpm -e software                             ##卸载软件

linux中的软件管理

rpm -qp software.rpm                    ##查看软件安装后的安装包

linux中的软件管理
rpm    -qlp   software.rpm             ##查看软件安装后的生成文件

linux中的软件管理
 rpm    -qf    software.rpm          ##查看软件所在的具体位置

linux中的软件管理
 ram   qi   firefox                         ##查看软件信息 

linux中的软件管理
rpm  -qp  software.rpm   --scripts  ##查看脚本(检测软件在安装和卸载的过程中执行的动作)

linux中的软件管理

rpm -ivh software.rpm    --force               ##表示强制安装软件        

linux中的软件管理
rpm    -Kv  software.rpm                          ##检测软件是否被篡改(ok表示没有被篡改)

linux中的软件管理
四、第三方软件仓库的搭建

1)把所有的rpm包放到一个目录中

linux中的软件管理
2)createrepo -v /存放软件包的目录

linux中的软件管理
3)vim /etc/yum.repos.d/yum.repo
[software]
name=software
baseurl=file:///software
gpgcheck=0

linux中的软件管理

linux中的软件管理

yum clean all
yum list linuxqq

linux中的软件管理