Linux 第11天: (08月17日) 练习和作业

 

 

 

删除文件之后恢复文件

 

rm /usr/bin/tree

rpm -qf /bin/tree

rpm -ql tree

rpm -ivh /run/media/root/CentOS\ 7\ x86_64/Packages/tree-1.6.0-10.e17.x86_64.rpm

cp           /run/media/root/CentOS\ 7\ x86_64/Packages/tree-1.6.0-10.e17.x86_64.rpm .

rpm2cpio tree-1.6.0-10.e17.x86_64.rpm | cpio -tv

ll /usr/share/doc/tree-1.6.0/README

echo >> /usr/share/doc/tree-1.6.0/README

rpm2cpio tree-1.6.0-10.e17.x86_64.rpm |cpio -idv ./usr/bin/tree

cp ./usr/bin/tree /bin/
rpm2cpio /mnt/Packages/rpm-4.11.3-17.e17.x86_64.rpm |cpio -tv

rpm2cpio /mnt/Packages/rpm-4.11.3-17.e17.x86_64.rpm |cpio -id ./bin/rpm

 

 


卸载之后使用光盘恢复rpm

 

centos 7

rpm -e rpm --nodeps

光盘引导选择 Rescue a CentOS system

df

cd /run/install/repo 进入光盘

rpm -ivh Packages/rpm-4.11.3-17.x86_64.rpm --root=/mnt/sysp_w_picpath/


centos 6

mkdir /mnt/cdrom

mount /dev/cdrom /mnt/cdrom

rpm -ivh Packages/rpm-4.8.0-47.e16.x86_64.rpm --root=/mnt/sysp_w_picpath/

 

 

 

密钥文件

 

ll /run/media/root/CentOS\ 7\ x86_64/RPM-GPG-KEY-CentOS-7

ll /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

rpm --import 导入密钥

 


 

安装双内核

 

cd /media/CentOS_6.8_Final/
cp Packages/kernel-2.6.32-573.e16.x86_64.rpm Packages/kernel-firmware-2.6.32-573.e16.noarch.rpm /root
cd
ls
uname -r
rpm -ivh kernel-*
rpm -ivh kernel-* --oldpackage
rpm -ivh kernel-* --force