安装命令
liujunjun@ubuntu:~$ sudo apt-get update liujunjun@ubuntu:~$ sudo apt-get upgrade liujunjun@ubuntu:~$ sudo apt-get install git liujunjun@ubuntu:~$ git clone git://github.com/mininet/mininet liujunjun@ubuntu:~$ cd mininet liujunjun@ubuntu:~$ cat INSTALL liujunjun@ubuntu:~$ cd /home/liujunjun/mininet/util/ liujunjun@ubuntu:~/mininet/util$ ./install.sh -a (-a选项默认安装在home目录)
make[1]: Entering directory '/home/liujunjun/oflops/doc' make[1]: Nothing to be done for 'install'. make[1]: Leaving directory '/home/liujunjun/oflops/doc' Enjoy Mininet! 安装成功
测试:sudo mn --test pingall
liujunjun@ubuntu:~/mininet/util$ sudo mn --test pingall [sudo] password for liujunjun: *** Creating network *** Adding controller *** Adding hosts: h1 h2 *** Adding switches: s1 *** Adding links: (h1, s1) (h2, s1) *** Configuring hosts h1 h2 *** Starting controller c0 *** Starting 1 switches s1 ... *** Waiting for switches to connect s1 *** Ping: testing ping reachability h1 -> h2 h2 -> h1 *** Results: 0% dropped (2/2 received) *** Stopping 1 controllers c0 *** Stopping 2 links .. *** Stopping 1 switches s1 *** Stopping 2 hosts h1 h2 *** Done completed in 6.684 seconds
版本信息:mn --version
liujunjun@ubuntu:~/mininet/util$ mn --version 2.3.0d6
说明:在~/mininet目录下,我们可以通过git tag命令列出所有可用的Mininet版本(如下截图),Mininet2.1.0p1及以后的版本可以原生支持OpenFlow1.3,所以我们这次安装的Mininet2.3.0d6版本支持OpenFlow协议。
源码树获取成功以后,安装Mininet。
#mininet/util/install.sh[options] 这里典型的[options]主要有下面几种: “-a”:完整安装包括Mininet VM,还包括如Open vSwitch的依赖关系,以及像的OpenFlow Wireshark分离器和POX。默认情况下,这些工具将被安装在你的home目录中。 “-nfv”:安装Mininet、基于OpenFlow的交换机和Open vSwitch。 “-s mydir” :在其他选项使用前使用此选项可将源代码建立在一个指定的目录中,而不是在你的home目录。
所以,你可能会用到下面的某一个命令来安装Mininet:
# install.sh –a ##完整安装(默认安装在home目录下) # install.sh -s mydir –a ##完整安装(安装在其他目录) # install.sh –nfv ##安装Mininet+用户交换机+OVS(安装在home目录下) # install.sh -s mydir –nfv ##安装Mininet+用户交换机+OVS(安装在其他目录下)
说明:其他可用的[options]可以通过install.sh -h命令查看(如下截图),例如你只想安装OpenFlow1.3和Open vSwitch2.3.0,可以使用安装命令
root@ubuntu:/home/liujunjun/mininet/util# ./install.sh -h Detected Linux distribution: Ubuntu 18.04 bionic amd64 sys.version_info(major=2, minor=7, micro=17, releaselevel='final', serial=0) Detected Python (python) version 2 Usage: install.sh [-abcdfhikmnprtvVwxy03] This install script attempts to install useful packages for Mininet. It should (hopefully) work on Ubuntu 11.10+ If you run into trouble, try installing one thing at a time, and looking at the specific installation function in this script. options: -a: (default) install (A)ll packages - good luck! -b: install controller (B)enchmark (oflops) -c: (C)lean up after kernel install -d: (D)elete some sensitive files from a VM image -e: install Mininet d(E)veloper dependencies -f: install Open(F)low -h: print this (H)elp message -i: install (I)ndigo Virtual Switch -k: install new (K)ernel -m: install Open vSwitch kernel (M)odule from source dir -n: install Mini(N)et dependencies + core files -p: install (P)OX OpenFlow Controller -r: remove existing Open vSwitch packages -s <dir>: place dependency (S)ource/build trees in <dir> -t: complete o(T)her Mininet VM setup tasks -v: install Open (V)switch -V <version>: install a particular version of Open (V)switch on Ubuntu -w: install OpenFlow (W)ireshark dissector -y: install R(y)u Controller -x: install NO(X) Classic OpenFlow controller -0: (default) -0[fx] installs OpenFlow 1.0 versions -3: -3[fx] installs OpenFlow 1.3 versions