redhat6本地源NBD驱动安装

旧巷老猫 提交于 2021-02-13 06:30:17

安装NBD驱动

一.配置本地yum源

1、挂载系统安装光盘
# mount /dev/cdrom /mnt/cdrom/

# mkdir /mnt/media

# cp -rf /mnt/cdrom/* /mnt/media

 

2、配置本地yum源

# cd /etc/yum.repos.d/

#vi rhel-source.repo

[rhel-source]

name=Red Hat Enterprise Linux $releasever - $basearch - Source
 #baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
baseurl=file:///mnt/media/
enabled=1
 gpgcheck=0
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 [rhel-source-beta]
 name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
#baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
 enabled=0
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
  ~

二.编译安装NBD驱动

1.   yum install kernel-devel kernel-headers (本地yum源安装!!)
2.   cd /tmp
 3.   wget http://vault.centos.org/7.0.1406/os/Source/SPackages/kernel-3.10.0-123.el7.src.rpm (这里内核一定跟需要安装NBD驱动的内核一致!!)
4.   rpm -ihv kernel-3.10.0-123.el7.src.rpm
 5.   cd ~/rpmbuild/SOURCES
 6.   tar Jxvf linux-3.10.0-123.el7.tar.xz -C /usr/src/kernels/
 7.   cd /usr/src/kernels/
8.   mv $(uname -r) $(uname -r)-old
9.   mv linux-3.10.0-123.el7 $(uname -r)
10.  cd $(uname -r)
11.  make mrproper
12.  cp ../$(uname -r)-old/Module.symvers ./
13.  cp /boot/config-$(uname -r) ./.config
14.  make oldconfig
15.  make prepare
16.  make scripts
17.  make CONFIG_BLK_DEV_NBD=m M=drivers/block CONFIG_MODULE_SIG=0 CONFIG_MODULE_SIG_FORCE=0
 18.  cp drivers/block/nbd.ko /lib/modules/$(uname -r)/kernel/drivers/block/
 19.  depmod –a
 20.modprobe nbd max_part=16
 21.qemu-nbd -c /dev/nbd0 sdapath/sdname1.qcow2
 22.qemu-nbd -c /dev/nbd1 sdapath /sdname2.qcow2
 23.lsmod grep|fuse
 24.lsmod grep | nbd
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!