yum搭建本地倉庫

[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

?

yum更換國內源

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

?

?wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo??//下載

?

?或者

?curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo??//-O 使用URL中默認的文件名保存文件到本地

?

?yum list

yum下載rpm

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

?卸載就是刪除安裝的文件

?