On Linux, with Yum installed, the downloaded RPM package is removed after the default installation is complete, and if you want Yum to install the software, you will need to modify the Keepcache parameter in the/etc/yum.conf configuration file.
[[email protected] ~]# cat /etc/yum.conf [main]cachedir=/var/cache/yum/$basearch/$releasever 【安装包保存位置】keepcache=0 【默认0是不保存安装包,改为1即可】debuglevel=2logfile=/var/log/yum.logexactarch=1obsoletes=1gpgcheck=1plugins=1installonly_limit=5bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yumdistroverpkg=centos-release
Use VIM or sed to modify
[[email protected] ~]# sed -n ‘s#keepcache=0#keepcache=1#gp‘ /etc/yum.conf keepcache=1 【最好先不要用-i参数直接修改源文件,先输出看修改是否正确,或者先备份yum.conf配置文件】[[email protected] ~]# sed -i ‘s#keepcache=0#keepcache=1#g‘ /etc/yum.conf 【-i修改源文件配置】[[email protected] ~]# grep "keepcache" /etc/yum.conf【检查是否已修改】keepcache=1
If you do not understand sed, use vim to modify
vim /etc/yum.conf
How to keep the Yum installed RPM package in Linux