yum命令下载安装包及依赖包

以centos7 X86架构为例:

yum install --downloadonly httpd   #安装包存放地址/var/cache/yum/x86_64/7/updates/packages

yum reinstall --downloadonly httpd #httpd已安装的情况下下载安装包,存放路径/var/cache/yum/x86_64/7/updates/packages

yum reinstall --downloadonly --downloaddir=/mnt/ol httpd

yum install --downloadonly --downloaddir=/mnt/ol dnf #下载安装包在制定目录/mnt/ol

dnf install -y httpd --downloadonly --downloaddir=/mnt/ol #--y参数的作用,不是手动选择是了

如果试用上面的命令时提示已安装,可以用下面的命令卸载后再试:

rpm -qa |grep httpd #找到安装的https包
httpd-tools-2.4.6-97.el7.centos.5.x86_64
httpd-2.4.6-97.el7.centos.5.x86_64

rpm -e --nodeps httpd-2.4.6-97.el7.centos.5.x86_64 httpd-tools-2.4.6-97.el7.centos.5.x86_64 #卸载上面命令找到的包

你可能感兴趣的:(linux,linux,centos,服务器)