yum偷包的实际操作过程

WARNING! The remote SSH server rejected X11 forwarding request.

Last login: Wed Nov 7 21:39:40 2018

先挂载光盘

[root@mubanji ~]# mount /dev/sr0 /media/cdrom/

mount: block device /dev/sr0 is write-protected, mounting read-only

 安装Wget命令

[root@mubanji ~]# yum -y install wget

Loaded plugins: fastestmirror

Determining fastest mirrors

* c6-media:

file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml

Trying other mirror.

file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml

Trying other mirror.

c6-media | 4.0 kB 00:00 ...

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package wget.x86_64 0:1.12-1.8.el6 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================

Package Arch Version Repository Size

===================================================================================

Installing:

wget x86_64 1.12-1.8.el6 c6-media 482 k

Transaction Summary

===================================================================================

Install 1 Package(s)

Total download size: 482 k

Installed size: 1.8 M

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : wget-1.12-1.8.el6.x86_64 1/1

Verifying : wget-1.12-1.8.el6.x86_64 1/1

Installed:

wget.x86_64 0:1.12-1.8.el6

Complete!

查看Wget命令已存在

[root@mubanji ~]# which wget

/usr/bin/wget

去到下面目录将光盘移动到back目录下

[root@mubanji ~]# cd /etc/yum.repos.d/

[root@mubanji yum.repos.d]# ls

back CentOS-Media.repo

[root@mubanji yum.repos.d]# mv CentOS-Media.repo back/

[root@mubanji yum.repos.d]# ls

back

开始在网上下载包

[root@mubanji yum.repos.d]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

--2018-11-07 21:48:18-- http://mirrors.aliyun.com/repo/epel-6.repo

Resolving mirrors.aliyun.com... 119.249.58.213, 119.249.58.218, 119.249.58.212, ...

Connecting to mirrors.aliyun.com|119.249.58.213|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 664 [application/octet-stream]

Saving to: “/etc/yum.repos.d/epel.repo”

100%[=========================================>] 664 --.-K/s in 0s

2018-11-07 21:48:18 (115 MB/s) - “/etc/yum.repos.d/epel.repo” saved [664/664]

[root@mubanji yum.repos.d]# ls

back epel.repo

清空缓存

[root@mubanji yum.repos.d]# yum -y clean all

Loaded plugins: fastestmirror

Cleaning repos: epel

Cleaning up Everything

Cleaning up list of fastest mirrors

修改yum的配置文件改为下载之后不删包 “将keepcache=0:;改为keepcache=0”

[root@mubanji yum.repos.d]# vim yum.conf

[root@mubanji yum.repos.d]# vim /etc/yum.conf

[root@mubanji yum.repos.d]# cat /etc/yum.conf

[main]

cachedir=/var/cache/yum/$basearch/$releasever

keepcache=1

debuglevel=2

logfile=/var/log/yum.log

exactarch=1

obsoletes=1

gpgcheck=1

plugins=1

installonly_limit=5

bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum

distroverpkg=centos-release

# This is the default, if you make this bigger yum won't see if the metadata

# is newer on the remote and so you'll "gain" the bandwidth of not having to

# download the new metadata and "pay" for it by yum not having correct

# information.

# It is esp. important, to have correct metadata, for distributions like

# Fedora which don't keep old packages around. If you don't like this checking

# interupting your command line usage, it's much better to have something

# manually check the metadata once an hour (yum-updatesd will do this).

# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo

# in /etc/yum.repos.d

下载完成    清理缓存,再建立缓存

[root@mubanji yum.repos.d]# yum -y clean all

Loaded plugins: fastestmirror

Cleaning repos: epel

Cleaning up Everything

[root@mubanji yum.repos.d]# yum makecache

Loaded plugins: fastestmirror

Determining fastest mirrors

epel | 3.2 kB 00:00

epel/group_gz | 71 kB 00:00

epel/filelists | 7.3 MB 00:24

epel/updateinfo | 771 kB 00:01

epel/prestodelta | 467 B 00:00

epel/primary | 3.2 MB 00:09

epel/other | 2.1 MB 00:03

epel 12492/12492

epel 12492/12492

epel 12492/12492

Metadata Cache Created

安装“包”

[root@mubanji yum.repos.d]# yum -y install inotify-tools 

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package inotify-tools.x86_64 0:3.14-1.el6 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================

Package Arch Version Repository Size

===================================================================================

Installing:

inotify-tools x86_64 3.14-1.el6 epel 46 k

Transaction Summary

===================================================================================

Install 1 Package(s)

Total download size: 46 k

Installed size: 104 k

Downloading Packages:

inotify-tools-3.14-1.el6.x86_64.rpm | 46 kB 00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : inotify-tools-3.14-1.el6.x86_64 1/1

Verifying : inotify-tools-3.14-1.el6.x86_64 1/1

Installed:

inotify-tools.x86_64 0:3.14-1.el6

Complete!

[root@mubanji yum.repos.d]# cd /

[root@mubanji /]# cd

[root@mubanji ~]#

[root@mubanji ~]# ll /var/cahe/

ls: cannot access /var/cahe/: No such file or directory

[root@mubanji ~]# ll /var/cache/

total 12

drwxr-xr-x. 2 root root 4096 Oct 18 05:43 fontconfig

drwx------. 2 root root 4096 Nov 7 21:58 ldconfig

drwxr-xr-x. 3 root root 4096 Oct 18 05:40 yum

[root@mubanji ~]# ll /var/cache/yum/x86_64/6/

total 8

drwxr-xr-x. 3 root root 4096 Nov 7 21:41 c6-media

drwxr-xr-x 4 root root 4096 Nov 7 21:56 epel

-rw-r--r-- 1 root root 0 Nov 7 21:55 timedhosts.txt

[root@mubanji ~]# 11 /var/cache/yum/x86_64/6/

-bash: 11: command not found

[root@mubanji ~]# 11 /var

-bash: 11: command not found

[root@mubanji ~]# ll /var/

total 60

drwxr-xr-x. 5 root root 4096 Oct 18 05:43 cache

drwxr-xr-x. 3 root root 4096 Oct 18 05:21 db

drwxr-xr-x. 3 root root 4096 Oct 18 05:21 empty

drwxr-xr-x. 2 root root 4096 Sep 23 2011 games

drwxr-xr-x. 14 root root 4096 Oct 18 05:21 lib

drwxr-xr-x. 2 root root 4096 Sep 23 2011 local

drwxrwxr-x. 4 root lock 4096 Oct 18 05:21 lock

drwxr-xr-x. 3 root root 4096 Nov 7 21:39 log

lrwxrwxrwx. 1 root root 10 Oct 18 05:19 mail -> spool/mail

drwxr-xr-x. 2 root root 4096 Sep 23 2011 nis

drwxr-xr-x. 2 root root 4096 Sep 23 2011 opt

drwxr-xr-x. 2 root root 4096 Sep 23 2011 preserve

drwxr-xr-x. 10 root root 4096 Nov 7 21:58 run

drwxr-xr-x. 8 root root 4096 Oct 18 05:20 spool

drwxrwxrwt. 2 root root 4096 Nov 7 21:58 tmp

drwxr-xr-x. 2 root root 4096 Sep 23 2011 yp

[root@mubanji ~]# ll /var/cache/

total 12

drwxr-xr-x. 2 root root 4096 Oct 18 05:43 fontconfig

drwx------. 2 root root 4096 Nov 7 21:58 ldconfig

drwxr-xr-x. 3 root root 4096 Oct 18 05:40 yum

[root@mubanji ~]# cd /var/cache/yum/x86_64/6/

[root@mubanji 6]# ls

c6-media epel timedhosts.txt

[root@mubanji 6]# pwd

/var/cache/yum/x86_64/6

[root@mubanji 6]# ls

c6-media epel timedhosts.txt

[root@mubanji 6]# cd epel/

[root@mubanji epel]# ls

42c6d9bea29c36584ab1bdc19098c0358ab29b651714c33510b39eb694626083-other.xml.gz

42c6d9bea29c36584ab1bdc19098c0358ab29b651714c33510b39eb694626083-other.xml.gz.sqlite

4ba13802bf121536c2e046e894b21595ca6b8b8e0125f6fbc89d992cf91c2bdb-primary.xml.gz

4ba13802bf121536c2e046e894b21595ca6b8b8e0125f6fbc89d992cf91c2bdb-primary.xml.gz.sqlite

55a73bffdf44e8dfdb2066488144e71e23c8a5d7f72738e8f935b2a6aa57764d-comps-Everything.x86_64.xml.gz

5c7dc671e849a38cfd2fc24230220758d9dc7d641e8ad32a9fd2982bedb6d8c6-prestodelta.xml.gz

a463f1dc536e50668570323c6bdbd23ca4dedaade96f9ca4eb56c91b197e70c6-updateinfo.xml.bz2

b313b56f10adfd8d2278e025a749efb7ee22c7a6bd6f0f22f01b98f9f5622284-filelists.xml.gz

b313b56f10adfd8d2278e025a749efb7ee22c7a6bd6f0f22f01b98f9f5622284-filelists.xml.gz.sqlite

cachecookie

gen

packages

repomd.xml

[root@mubanji epel]# cd ..

[root@mubanji 6]# ll epel/

total 107960

-rw-r--r-- 1 root root 2162817 Nov 5 09:44 42c6d9bea29c36584ab1bdc19098c0358ab29b651714c33510b39eb694626083-other.xml.gz

-rw-r--r-- 1 root root 18942976 Nov 7 21:56 42c6d9bea29c36584ab1bdc19098c0358ab29b651714c33510b39eb694626083-other.xml.gz.sqlite

-rw-r--r-- 1 root root 3373541 Nov 5 09:44 4ba13802bf121536c2e046e894b21595ca6b8b8e0125f6fbc89d992cf91c2bdb-primary.xml.gz

-rw-r--r-- 1 root root 30841856 Nov 7 21:55 4ba13802bf121536c2e046e894b21595ca6b8b8e0125f6fbc89d992cf91c2bdb-primary.xml.gz.sqlite

-rw-r--r-- 1 root root 73206 Nov 5 09:44 55a73bffdf44e8dfdb2066488144e71e23c8a5d7f72738e8f935b2a6aa57764d-comps-Everything.x86_64.xml.gz

-rw-r--r-- 1 root root 467 Nov 5 09:44 5c7dc671e849a38cfd2fc24230220758d9dc7d641e8ad32a9fd2982bedb6d8c6-prestodelta.xml.gz

-rw-r--r-- 1 root root 789752 Nov 5 10:05 a463f1dc536e50668570323c6bdbd23ca4dedaade96f9ca4eb56c91b197e70c6-updateinfo.xml.bz2

-rw-r--r-- 1 root root 7632133 Nov 5 09:44 b313b56f10adfd8d2278e025a749efb7ee22c7a6bd6f0f22f01b98f9f5622284-filelists.xml.gz

-rw-r--r-- 1 root root 46700544 Nov 7 21:55 b313b56f10adfd8d2278e025a749efb7ee22c7a6bd6f0f22f01b98f9f5622284-filelists.xml.gz.sqlite

-rw-r--r-- 1 root root 0 Nov 7 21:55 cachecookie

drwxr-xr-x 2 root root 4096 Nov 7 21:56 gen

drwxr-xr-x 2 root root 4096 Nov 7 21:58 packages

-rw-r--r-- 1 root root 3303 Nov 5 10:05 repomd.xml

[root@mubanji 6]# cd epel/

[root@mubanji epel]# ls

42c6d9bea29c36584ab1bdc19098c0358ab29b651714c33510b39eb694626083-other.xml.gz

42c6d9bea29c36584ab1bdc19098c0358ab29b651714c33510b39eb694626083-other.xml.gz.sqlite

4ba13802bf121536c2e046e894b21595ca6b8b8e0125f6fbc89d992cf91c2bdb-primary.xml.gz

4ba13802bf121536c2e046e894b21595ca6b8b8e0125f6fbc89d992cf91c2bdb-primary.xml.gz.sqlite

55a73bffdf44e8dfdb2066488144e71e23c8a5d7f72738e8f935b2a6aa57764d-comps-Everything.x86_64.xml.gz

5c7dc671e849a38cfd2fc24230220758d9dc7d641e8ad32a9fd2982bedb6d8c6-prestodelta.xml.gz

a463f1dc536e50668570323c6bdbd23ca4dedaade96f9ca4eb56c91b197e70c6-updateinfo.xml.bz2

b313b56f10adfd8d2278e025a749efb7ee22c7a6bd6f0f22f01b98f9f5622284-filelists.xml.gz

b313b56f10adfd8d2278e025a749efb7ee22c7a6bd6f0f22f01b98f9f5622284-filelists.xml.gz.sqlite

cachecookie

gen

packages

repomd.xml

[root@mubanji epel]# cd packages/

[root@mubanji packages]# ls

inotify-tools-3.14-1.el6.x86_64.rpm

将包移动到家目录下

[root@mubanji packages]# mv inotify-tools-3.14-1.el6.x86_64.rpm ~/

[root@mubanji packages]# cd /

[root@mubanji /]# cd

[root@mubanji ~]# ls

anaconda-ks.cfg install.log

inotify-tools-3.14-1.el6.x86_64.rpm install.log.syslog

猜你喜欢

转载自www.cnblogs.com/bawuxixuan/p/9922260.html