
# 安装OFED驱动
#### 操作背景
裸机支持VROCE能力，需要优先安装对应的ofed 5.8-3.0.7.0-LTS版本驱动
#### 前提条件
- 已登录虚拟机。
- 已获取对应OFED驱动安装包及管理软件并上传至虚拟机。 获取方式：参考[软件准备](https://support.huaweicloud.com/bpicg-bms/zh-cn_topic_0000001409181017.html#ZH-CN_TOPIC_0000001409181017)章节下载对应的驱动包。
  ![](https://support.huaweicloud.com/bpicg-bms/public_sys-resources/note_3.0-zh-cn.png)
  Huawei Cloud EulerOS 2.0操作系统下载使用OpenEuler 22.03操作系统对应的驱动包。
  
 
#### 操作步骤
1. 执行命令**tar -zxvf** MLNX_OFED_LINUX-5.8-3.0.7.0-xxx-x86_64.tgz（*xxx*为OFED安装包名）解压OFED安装包。
2. 解压完成后，进入"MLNX_OFED_LINUX-5.8-3.0.7.0-xxx-x86_64"文件夹执行安装。 ./mlnxofedinstall --without-fw-update --force --add-kernel-support --skip-distro-check --distro hce --without-ucx --without-depcheck （hce）
   ./mlnxofedinstall --without-fw-update --without-ucx --force （CentOS）
   ./mlnxofedinstall --force --all （Ubuntu22.04）
   ```
   以centos系列为例：
   [root@localhost MLNX_OFED_LINUX-5.8-3.0.7.0-xxx-x86_64]# ./mlnxofedinstall --without-fw-update --without-ucx --force
   Logs dir: /tmp/MLNX_OFED_LINUX.1479.logs
   General log file: /tmp/MLNX_OFED_LINUX.1479.logs/general.log
   Verifying KMP rpms compatibility with target kernel...
   Error: One or more required packages for installing MLNX_OFED_LINUX are missing.
   Please install the missing packages using your Linux distribution Package Management tool.
   Run:
   yum install fuse-libs tcsh tk createrepo
   ```
   
3. 在安装过程中，如果缺少相关依赖包，执行**yum install** *xxx* 进行安装。
   按照上一步提示执行：**yum install fuse-libs tcsh tk createrepo**
   
4. 按照步骤2安装依赖完成后，再次执行对应命令安装脚本。 等待一段时间后如下所示，即为安装成功。
   ![](https://support.huaweicloud.com/bpicg-bms/zh-cn_image_0000001990530550.png "点击放大")
   
5. 安装成功后，执行**/etc/init.d/**openibd restart**** 加载驱动。
   ```
   [root@localhost MLNX_OFED_LINUX-5.8-3.0.7.0-xxx-x86_64.tgz]# /etc/init.d/openibd restart
   Uploading HCA driver:                                      [ OK ]
   Loading HCA driver and Access Layer:                       [ OK ]
   ```
   
6. 执行**reboot**命令，使驱动生效。
 
