linux学习-二进制软件包管理

二进制软件包管理(RPM、YUM)

源代码包安装

脚本安装(Shell或Java脚本)

Debian系Linux软件包管理简介

rpm软件包管理:

卸载:rpm -e 【软件名称】

例子:重新安装sudo

rpm -ivh sudo-1.7.2p1-5.el5.i386.rpm

挂载光盘:

首先mkdir /mnt/cdrom

挂载:mount /dev/cdrom /mnt/cdrom,如果遇到找不到介质,要在虚拟机的设置cd中将镜像添加进来。

cd到CentOS目录下,可以看到有很多安装包,使用ls | grep sudo,找到sudo包

使用rpm -q 【软件名】,可以查看软件是否安装。

使用rpm -qa | grep samba,查看系统中安装的所有安装包,且查看和samba相关的包。

rpm -ivh 【选项】 【软件名】

【选项】:--excludedocs:不安装软件包中的文档文件,--prefix PATH:将软件包安装到由PATH指定的路径下,

--test:只对安装进行测试,并不实际安装。

软件包已经被安装:如果要覆盖安装该软件包,可以在命令行使用--replacepkgs选项。

文件冲突:使用--replacefiles

未解决依赖关系:当前软件包可能依赖其他软件包,在安装了特定的软件包之后才能安装该软件包。必须安装完所依赖的软件包,才能解决这个我问题。如果强制安装使用--modeps选项。

rpm没有很好的解决软件包之间的依赖关系问题,因此才有了yum。

YUM软件包管理:可以自动解决软件包的依赖关系,同时方便软件包升级。

安装yum install

检测升级yum check-update

升级yum update

软件包查询yum list

软件包信息yum info

卸载 yum remove

帮助yum -help、man yum

在使用yum安装sudo:yum install sudo,报错:YumRepo Error: All mirror URLs are not using ftp, http[s] or file.

分析是yum镜像源的问题:

1.首先通过lsb_release -a查询下

2.根据查询信息,将/etc/yum.repos.d/CentOS-Base.repo中baseurl路径做调整,文件内容如下:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/5.5/os/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/5.5/updates/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://vault.centos.org/5.5/addons/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/5.5/extras/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/5.5/centosplus/i386/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/5.5/contrib/i386/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
3.保存文件后,运行yum clean all 
4.执行yum install sudo。


猜你喜欢

转载自blog.csdn.net/hsj1213522415/article/details/80429287