[root@localhost ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 寫保護,将以隻讀方式挂載
cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
[root@localhost ~]# cp -r /etc/yum.repos.d/ /etc/yum.repos.d.ori/ //複制
rm -f /etc/yum.repos.d/*
[root@localhost ~]# rm -f /etc/yum.repos.d/* //删除檔案
vim /etc/yum.repos.d/dvd.repo //内容如下
[dvd] //右側倉庫名字
name=install dvd //作為描述的字元串
baseurl=file:///mnt //rpm在哪
enable=1 //是否可用 1可用
gpgcheck=0 //是否檢查。0不檢測
yum clean all
[root@localhost ~]# yum clean all //清理緩存
已加載插件:fastestmirror
正在清理軟體源: dvd
Cleaning up everything
Cleaning up list of fastest mirrors
yum list
[root@localhost ~]# yum list
zenity.x86_64 3.8.0-4.el7 dvd
zziplib.x86_64 0.13.62-5.el7 dvd
cd /etc/yum.repos.d/
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# cp ./dvd.repo dvd.repo.ori
rm -f dvd.repo
[root@localhost yum.repos.d]# rm -f dvd.repo
或者
yum install -y 包名 --downloadonly
[root@localhost yum.repos.d]# yum install -y zsh --downloadonly //僅僅下載下傳不安裝
[root@localhost yum.repos.d]# rpm -q zsh
未安裝軟體包 zsh
ls /var/cache/yum/x86_64/7/
[root@localhost yum.repos.d]# ls /var/cache/yum/x86_64/7/base/packages/ //預設下載下傳到此
zlib-static-1.2.7-17.el7.x86_64.rpm zsh-5.0.2-28.el7.x86_64.rpm
yum install -y 包名 --downloadonly --downloaddir=路徑
[root@localhost yum.repos.d]# yum install -y zabbix20-proxy-mysql.x86_64 --downloadonly --downloaddir=/root/ //--downloaddir指定下載下傳到哪裡去
yum reinstall -y 包名 --downloadonly --downloaddir=路徑
[root@localhost yum.repos.d]# yum reinstall -y vim --downloadonly --downloaddir=/tmp //reinstall 重新安裝
cd /usr/local/src/
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.32.tar.gz
tar zxvf httpd-2.2.32.tar.gz //解壓
cd httpd-2.2.32
./configure --prefix=/usr/local/apache2
make //編譯
make install
解除安裝就是删除安裝的檔案
本文轉自 蝦米的春天 51CTO部落格,原文連結:http://blog.51cto.com/lsxme/1980876,如需轉載請自行聯系原作者