USB/IP-Ubuntu 14.04服务端操作手册

1. 安装USB/IP

1.1. 查看内核是否打开了USBIP的支持

egrep USBIP /boot/config-3.13.0-xx-generic 

CONFIG_USBIP_CORE=m

CONFIG_USBIP_VHCI_HCD=m

CONFIG_USBIP_HOST=m

# CONFIG_USBIP_DEBUG is not set

1.2. 编译安装

创建脚本make-usbip-userspace.sh

#!/bin/bash

 

# Requires a linux kernel higher than 3.2.0-22.25

 

# Determine the current kernel version and relevant directories

kernelver=`uname -r | cut -d '-' -f 1`

builddir=~/build/

kernelloc=drivers/staging/usbip/userspace/

 

# Setting up the build directory

if [ -d ${builddir} ]

then

        echo "E: Directory ${buiddir} would be used for building but already exists."

        echo "   Please remove this directory in order to build cleanly."

        exit 1

fi

 

mkdir -p ${builddir}

 

# Getting the source code into the build directory

sudo apt-get install linux-source-${kernelver}

tar -x -f /usr/src/linux-source-${kernelver}.tar.bz2 -C ${builddir}

cd ${builddir}/linux-source-${kernelver}

 

# Install required packages for building

sudo apt-get install sysfsutils libwrap0-dev gcc libglib2.0-dev libtool automake autoconf pkg-config libsysfs-dev

 

# Do the actual build

cd ${kernelloc}

./autogen.sh

./configure --with-usbids-dir=/usr/share/misc/

sudo make install

 

# Create a soft-link so the client space tools find the libraries

sudo ln -s /usr/local/lib/libusbip.so.0 /usr/lib/libusbip.so.0

执行./make-usbip-userspace.sh

引用:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/900384

#10

https://launchpadlibrarian.net/106481975/make-usbip-userspace.sh

1.3. 加载USBIP相应的模块

modprobe usbip_host 

modprobe usbip_core

modprobe vhci_hcd

可以将模块加入/etc/modules,系统自启动加载

lsmod | grep usbip

usbip_host             23867  0 

usbip_core             32112  2 usbip_host,vhci_hcd

1.4. 运行USBIP后台进程

运行usbipd -D

2. USB/IP设备管理

2.1. 查看本机插上的设备的总线IDbus id

root@inspiron:~# usbip list -l

Local USB devices

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

 - busid 1-1 (8087:0024)

   Intel Corp. : Integrated Rate Matching Hub (8087:0024)

         1-1:1.0 -> hub

 

 - busid 1-1.3 (0bda:0129)

   Realtek Semiconductor Corp. : RTS5129 Card Reader Controller (0bda:0129)

         1-1.3:1.0 -> rts5139

 

 - busid 1-1.5 (0c45:648d)

   Microdia : unknown product (0c45:648d)

         1-1.5:1.0 -> uvcvideo

         1-1.5:1.1 -> uvcvideo

 

 - busid 2-1 (8087:0024)

   Intel Corp. : Integrated Rate Matching Hub (8087:0024)

         2-1:1.0 -> hub

 

 - busid 3-2 (0951:1643)

   Kingston Technology : DataTraveler G3 (0951:1643)

         3-2:1.0 -> usb-storage

 

 - busid 3-3 (046d:c52b)

   Logitech, Inc. : Unifying Receiver (046d:c52b)

         3-3:1.0 -> usbhid

         3-3:1.1 -> usbhid

         3-3:1.2 -> usbhid

看到标识为蓝色的即为USB设备

2.2. 根据查到的总线ID 绑定在usbip-host

root@inspiron:~# usbip bind -b 3-2

bind device on busid 3-2: complete

2.3. 确认设备已经绑定到usbip-host

root@inspiron:~# usbip list -r 127.0.0.1

Exportable USB devices

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

 - 172.16.4.1

        3-2: Kingston Technology : DataTraveler G3 (0951:1643)

           : /sys/devices/pci0000:00/0000:00:14.0/usb3/3-2

           : (Defined at Interface level) (00/00/00)

           :  0 - Mass Storage / SCSI / Bulk-Only (08/06/50)

 

root@inspiron:~# usbip list -l

Local USB devices

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

 - busid 1-1 (8087:0024)

   Intel Corp. : Integrated Rate Matching Hub (8087:0024)

         1-1:1.0 -> hub

 

 - busid 1-1.3 (0bda:0129)

   Realtek Semiconductor Corp. : RTS5129 Card Reader Controller (0bda:0129)

         1-1.3:1.0 -> rts5139

 

 - busid 1-1.5 (0c45:648d)

   Microdia : unknown product (0c45:648d)

         1-1.5:1.0 -> uvcvideo

         1-1.5:1.1 -> uvcvideo

 

 - busid 2-1 (8087:0024)

   Intel Corp. : Integrated Rate Matching Hub (8087:0024)

         2-1:1.0 -> hub

 

 - busid 3-2 (0951:1643)

   Kingston Technology : DataTraveler G3 (0951:1643)

         3-2:1.0 -> usbip-host

 

 - busid 3-3 (046d:c52b)

   Logitech, Inc. : Unifying Receiver (046d:c52b)

         3-3:1.0 -> usbhid

         3-3:1.1 -> usbhid

         3-3:1.2 -> usbhid

标识为蓝色的由usb-storage->usbip-host

这时候Ubuntu客户端或者Windows客户端可以连接使用

好的,下面是Hadoop安装教程-单机-伪分布式配置-Hadoop2.6.0-Ubuntu14.04详细教程教学: 1. 安装Java Hadoop是基于Java开发的,因此需要先安装Java。可以在终端中输入以下命令进行安装: ```bash sudo apt-get update sudo apt-get install default-jdk ``` 2. 下载Hadoop 可以在Hadoop官网下载Hadoop压缩包,也可以在终端中输入以下命令进行下载: ```bash wget https://archive.apache.org/dist/hadoop/core/hadoop-2.6.0/hadoop-2.6.0.tar.gz ``` 3. 解压Hadoop 在终端中输入以下命令解压Hadoop压缩包: ```bash tar -xzvf hadoop-2.6.0.tar.gz ``` 4. 配置Hadoop环境变量 打开终端中的/etc/environment文件,并在其中添加以下内容: ```bash export HADOOP_HOME=/path/to/hadoop export PATH=$PATH:$HADOOP_HOME/bin ``` 其中,/path/to/hadoop为Hadoop所在的路径。保存文件后,输入以下命令使配置生效: ```bash source /etc/environment ``` 5. 配置Hadoop 进入Hadoop目录,编辑etc/hadoop/hadoop-env.sh文件。找到以下行: ```bash export JAVA_HOME=${JAVA_HOME} ``` 将其修改为: ```bash export JAVA_HOME=/usr/lib/jvm/default-java ``` 保存文件并关闭。 6. 配置HDFS 进入etc/hadoop目录,编辑hdfs-site.xml文件。添加以下内容: ```xml <configuration> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/path/to/hadoop/data/dfs/namenode</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/path/to/hadoop/data/dfs/datanode</value> </property> </configuration> ``` 其中,/path/to/hadoop/data为Hadoop数据存储路径。 7. 配置YARN 进入etc/hadoop目录,编辑yarn-site.xml文件。添加以下内容: ```xml <configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name> <value>org.apache.hadoop.mapred.ShuffleHandler</value> </property> </configuration> ``` 8. 配置MapReduce 进入etc/hadoop目录,编辑mapred-site.xml文件。添加以下内容: ```xml <configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> </configuration> ``` 9. 格式化HDFS 在终端中输入以下命令格式化HDFS: ```bash hdfs namenode -format ``` 10. 启动Hadoop 在终端中输入以下命令启动Hadoop: ```bash start-all.sh ``` 11. 验证Hadoop 在浏览器中输入http://localhost:50070,即可访问Hadoop Web UI。在该页面中可以查看HDFS的状态、数据块、节点等信息。 以上就是Hadoop安装教程-单机-伪分布式配置-Hadoop2.6.0-Ubuntu14.04详细教程教学。希望对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值