在Ubuntu18.04上搭建netopeer2环境

主要参考https://blog.csdn.net/qq_27923047/article/details/108001624
下面的操作都是在Ubuntu18.04的docker中进行
因为GitHub接入不稳定,因此选用gitee的镜像源

准备工作

step 1:安装必要软件

root@95080ab946bc:~# apt update  -y
root@95080ab946bc:~# apt install gcc cmake build-essential   -y

step 2:安装PCRE2

root@d86bd7159170:~# tar -zxvf pcre2-10.37.tar.gz 

root@d86bd7159170:~# cd pcre2-10.37
root@d86bd7159170:~/pcre2-10.37# 

root@d86bd7159170:~/pcre2-10.37# ./configure 
  • 安装查看
root@d86bd7159170:~/pcre2-10.37# make && make install
...
root@d86bd7159170:~/pcre2-10.37# pcre2-config --version
10.37
root@d86bd7159170:~/pcre2-10.37#

step 3:安装libyang

  • 获取源码
root@d86bd7159170:~# git clone https://gitee.com/yaozuluo/libyang.git
Cloning into 'libyang'...
remote: Enumerating objects: 57323, done.
remote: Total 57323 (delta 0), reused 0 (delta 0), pack-reused 57323
Receiving objects: 100% (57323/57323), 41.04 MiB | 6.16 MiB/s, done.
Resolving deltas: 100% (43172/43172), done.
root@d86bd7159170:~# 

root@d86bd7159170:~# cd libyang/
root@d86bd7159170:~/libyang# 
  • 标准安装步骤
# mkdir build; cd build
# cmake ..
# make
# make install
  • 记录一下最后的log
root@d86bd7159170:~/libyang/build# make install
...
Install the project...
-- Install configuration: "Debug"
-- Installing: /usr/local/lib/libyang.so.2.1.4
-- Installing: /usr/local/lib/libyang.so.2
-- Installing: /usr/local/lib/libyang.so
-- Set runtime path of "/usr/local/lib/libyang.so.2.1.4" to ""
-- Installing: /usr/local/include/libyang/libyang.h
-- Installing: /usr/local/include/libyang/context.h
-- Installing: /usr/local/include/libyang/dict.h
-- Installing: /usr/local/include/libyang/log.h
-- Installing: /usr/local/include/libyang/in.h
-- Installing: /usr/local/include/libyang/parser_data.h
-- Installing: /usr/local/include/libyang/parser_schema.h
-- Installing: /usr/local/include/libyang/plugins.h
-- Installing: /usr/local/include/libyang/plugins_exts.h
-- Installing: /usr/local/include/libyang/plugins_exts_compile.h
-- Installing: /usr/local/include/libyang/plugins_exts_print.h
-- Installing: /usr/local/include/libyang/plugins_types.h
-- Installing: /usr/local/include/libyang/out.h
-- Installing: /usr/local/include/libyang/printer_data.h
-- Installing: /usr/local/include/libyang/printer_schema.h
-- Installing: /usr/local/include/libyang/set.h
-- Installing: /usr/local/include/libyang/tree.h
-- Installing: /usr/local/include/libyang/tree_edit.h
-- Installing: /usr/local/include/libyang/tree_data.h
-- Installing: /usr/local/include/libyang/tree_schema.h
-- Installing: /usr/local/include/libyang/version.h
-- Installing: /usr/local/include/libyang/config.h
-- Installing: /usr/local/bin/yanglint
-- Set runtime path of "/usr/local/bin/yanglint" to ""
-- Installing: /usr/local/share/man/man1/yanglint.1
-- Installing: /usr/local/bin/yangre
-- Set runtime path of "/usr/local/bin/yangre" to ""
root@d86bd7159170:~/libyang/build# 

step 4:安装sysrepo

  • 获取源码
root@d86bd7159170:~# git clone https://gitee.com/cly11/bak_sysrepo.git
Cloning into 'bak_sysrepo'...
remote: Enumerating objects: 33175, done.
remote: Total 33175 (delta 0), reused 0 (delta 0), pack-reused 33175
Receiving objects: 100% (33175/33175), 17.13 MiB | 15.47 MiB/s, done.
Resolving deltas: 100% (24864/24864), done.
root@d86bd7159170:~# ls -l
total 2260
drwxr-xr-x 12 root root    4096 Jan 10 01:26 bak_sysrepo
drwxr-xr-x 13 root root    4096 Jan 10 00:52 libyang
drwxr-xr-x  8 1169 1169    4096 Jan 10 01:08 pcre2-10.37
-rw-rw-r--  1 1000 1000 2299767 Jan 10 01:05 pcre2-10.37.tar.gz
root@d86bd7159170:~# cd bak_sysrepo/
root@d86bd7159170:~/bak_sysrepo# 
  • 标准安装步骤
# mkdir build; cd build
# cmake ..
# make
# make install
  • 记录一下最后的log
...
Install the project...
-- Install configuration: "Debug"
-- Up-to-date: /usr/local/lib/libsysrepo.so.6.0.1
-- Up-to-date: /usr/local/lib/libsysrepo.so.6
-- Up-to-date: /usr/local/lib/libsysrepo.so
-- Up-to-date: /usr/local/include/sysrepo.h
-- Up-to-date: /usr/local/include/sysrepo_types.h
-- Up-to-date: /usr/local/include/sysrepo/version.h
-- Up-to-date: /usr/local/include/sysrepo/values.h
-- Up-to-date: /usr/local/include/sysrepo/xpath.h
-- Up-to-date: /usr/local/bin/sysrepoctl
-- Up-to-date: /usr/local/bin/sysrepocfg
-- Up-to-date: /usr/local/bin/sysrepo-plugind
-- Up-to-date: /usr/local/lib/pkgconfig/sysrepo.pc

step 5:安装zlib和libssh

apt-get install zlib1g-dev libssl-dev -y

step 6:安装libnetconf

  • 获取源码
root@d86bd7159170:~# git clone https://gitee.com/mirrors/libnetconf2.git
Cloning into 'libnetconf2'...
remote: Enumerating objects: 8316, done.
remote: Counting objects: 100% (920/920), done.
remote: Compressing objects: 100% (821/821), done.
remote: Total 8316 (delta 582), reused 114 (delta 68), pack-reused 7396
Receiving objects: 100% (8316/8316), 2.92 MiB | 10.75 MiB/s, done.
Resolving deltas: 100% (6035/6035), done.
root@d86bd7159170:~# cd libnetconf2/
root@d86bd7159170:~/libnetconf2# 
  • 标准安装步骤
# mkdir build; cd build
# cmake ..
# make
# make install
  • 记录一下最后的log
Install the project...
-- Install configuration: "Debug"
-- Installing: /usr/local/lib/libnetconf2.so.2.1.20
-- Installing: /usr/local/lib/libnetconf2.so.2
-- Installing: /usr/local/lib/libnetconf2.so
-- Set runtime path of "/usr/local/lib/libnetconf2.so.2.1.20" to ""
-- Installing: /usr/local/include/nc_client.h
-- Installing: /usr/local/include/nc_server.h
-- Installing: /usr/local/include/libnetconf2/log.h
-- Installing: /usr/local/include/libnetconf2/netconf.h
-- Installing: /usr/local/include/libnetconf2/session.h
-- Installing: /usr/local/include/libnetconf2/messages_client.h
-- Installing: /usr/local/include/libnetconf2/messages_server.h
-- Installing: /usr/local/include/libnetconf2/session_client.h
-- Installing: /usr/local/include/libnetconf2/session_client_ch.h
-- Installing: /usr/local/include/libnetconf2/session_server.h
-- Installing: /usr/local/include/libnetconf2/session_server_ch.h
-- Installing: /usr/local/include/libnetconf2/config.h
root@d86bd7159170:~/libnetconf2/build# 

step 7:安装netopeer2

  • 获取源码
root@d86bd7159170:~# git clone https://gitee.com/cly11/netopeer2_bak.git
Cloning into 'netopeer2_bak'...
remote: Enumerating objects: 8331, done.
remote: Total 8331 (delta 0), reused 0 (delta 0), pack-reused 8331
Receiving objects: 100% (8331/8331), 3.27 MiB | 95.00 KiB/s, done.
Resolving deltas: 100% (5903/5903), done.
root@d86bd7159170:~# cd netopeer2_bak/
root@d86bd7159170:~/netopeer2_bak# 
  • 标准安装步骤外加添加链接
# mkdir build; cd build
# cmake ..
# make
# ln -s /usr/local/lib/libsysrepo.so.6 /lib/
# ln -s /usr/local/lib/libnetconf2.so.2 /lib/
# ln -s /usr/local/lib/libyang.so /lib/
# ln -s /usr/local/lib/libssh.so.4 /lib/
# make install

运行

  • 运行netopeer2-server,注意运行的目录
root@d86bd7159170:~/netopeer2_bak# netopeer2-server -d -v 2

root@d86bd7159170:~/netopeer2_bak# netopeer2-server -d -v 2
[INF]: LY: Searching for "ietf-yang-types" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Newer revision than "ietf-yang-types@2013-07-15" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-yang-types" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Newer revision than "ietf-yang-types@2013-07-15" not found, using this as the latest revision.
[INF]: SR: Scheduled changes not applied because of other existing connections.
[INF]: LY: Searching for "ietf-datastores" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-datastores@2018-02-14.yang" file.
[INF]: LY: Searching for "ietf-yang-library" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-yang-library@2019-01-04.yang" file.
[INF]: LY: Searching for "ietf-inet-types" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Newer revision than "ietf-inet-types@2013-07-15" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-datastores" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-datastores@2018-02-14.yang" file.
[INF]: LY: Newer revision than "ietf-datastores@2018-02-14" not found, using this as the latest revision.
[INF]: LY: Searching for "sysrepo-monitoring" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/sysrepo-monitoring@2021-01-15.yang" file.
[INF]: LY: Searching for "sysrepo-plugind" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/sysrepo-plugind@2020-12-10.yang" file.
[INF]: LY: Searching for "ietf-netconf" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf@2013-09-29.yang" file.
[INF]: LY: Searching for "ietf-netconf-acm" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf-acm@2018-02-14.yang" file.
[INF]: LY: Searching for "ietf-yang-metadata" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Newer revision than "ietf-yang-metadata@2016-08-05" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-netconf-with-defaults" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf-with-defaults@2011-06-01.yang" file.
[INF]: LY: Searching for "ietf-netconf" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf@2013-09-29.yang" file.
[INF]: LY: Newer revision than "ietf-netconf@2013-09-29" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-netconf-notifications" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf-notifications@2012-02-06.yang" file.
[INF]: LY: Searching for "ietf-origin" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-origin@2018-02-14.yang" file.
[INF]: LY: Searching for "ietf-netconf-monitoring" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf-monitoring@2010-10-04.yang" file.
[INF]: LY: Searching for "ietf-netconf-nmda" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf-nmda@2019-01-07.yang" file.
[INF]: LY: Searching for "ietf-origin" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-origin@2018-02-14.yang" file.
[INF]: LY: Newer revision than "ietf-origin@2018-02-14" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-netconf-with-defaults" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf-with-defaults@2011-06-01.yang" file.
[INF]: LY: Newer revision than "ietf-netconf-with-defaults@2011-06-01" not found, using this as the latest revision.
[INF]: LY: Searching for "nc-notifications" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/nc-notifications@2008-07-14.yang" file.
[INF]: LY: Searching for "notifications" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/notifications@2008-07-14.yang" file.
[INF]: LY: Searching for "ietf-x509-cert-to-name" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-x509-cert-to-name@2014-12-10.yang" file.
[INF]: LY: Searching for "ietf-crypto-types" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-crypto-types@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-keystore" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-keystore@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-crypto-types" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-crypto-types@2019-07-02.yang" file.
[INF]: LY: Newer revision than "ietf-crypto-types@2019-07-02" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-truststore" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-truststore@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-tcp-common" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-tcp-common@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-ssh-server" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-ssh-server@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-ssh-common" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-ssh-common@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-keystore" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-keystore@2019-07-02.yang" file.
[INF]: LY: Newer revision than "ietf-keystore@2019-07-02" not found, using this as the latest revision.
[INF]: LY: Searching for "iana-crypt-hash" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/iana-crypt-hash@2014-08-06.yang" file.
[INF]: LY: Searching for "ietf-tls-server" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-tls-server@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-tls-common" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-tls-common@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-truststore" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-truststore@2019-07-02.yang" file.
[INF]: LY: Newer revision than "ietf-truststore@2019-07-02" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-netconf-server" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-netconf-server@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-x509-cert-to-name" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-x509-cert-to-name@2014-12-10.yang" file.
[INF]: LY: Newer revision than "ietf-x509-cert-to-name@2014-12-10" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-tcp-client" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-tcp-client@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-tcp-common" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-tcp-common@2019-07-02.yang" file.
[INF]: LY: Newer revision than "ietf-tcp-common@2019-07-02" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-tcp-server" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-tcp-server@2019-07-02.yang" file.
[INF]: LY: Searching for "ietf-subscribed-notifications" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-subscribed-notifications@2019-09-09.yang" file.
[INF]: LY: Searching for "ietf-interfaces" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-interfaces@2018-02-20.yang" file.
[INF]: LY: Searching for "ietf-network-instance" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-network-instance@2019-01-21.yang" file.
[INF]: LY: Searching for "ietf-ip" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-ip@2018-02-22.yang" file.
[INF]: LY: Searching for "ietf-yang-schema-mount" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-yang-schema-mount@2019-01-14.yang" file.
[INF]: LY: Searching for "ietf-restconf" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-restconf@2017-01-26.yang" file.
[INF]: LY: Use of anydata to define configuration data is not recommended. /ietf-subscribed-notifications:filters/stream-filter/{uses='stream-filter-elements'}/filter-spec/stream-subtree-filter/stream-subtree-filter
[INF]: LY: Use of anydata to define configuration data is not recommended. /ietf-subscribed-notifications:subscriptions/subscription/{uses='subscription-policy'}/{uses='subscription-policy-dynamic'}/{uses='subscription-policy-modifiable'}/target/stream/stream-filter/within-subscription/{uses='stream-filter-elements'}/filter-spec/stream-subtree-filter/stream-subtree-filter
[INF]: LY: Searching for "ietf-yang-push" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-yang-push@2019-09-09.yang" file.
[INF]: LY: Searching for "ietf-subscribed-notifications" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-subscribed-notifications@2019-09-09.yang" file.
[INF]: LY: Newer revision than "ietf-subscribed-notifications@2019-09-09" not found, using this as the latest revision.
[INF]: LY: Searching for "ietf-yang-patch" in "/root/bak_sysrepo/build/repository/yang".
[INF]: LY: Loading schema from "/root/bak_sysrepo/build/repository/yang/ietf-yang-patch@2017-02-22.yang" file.
[INF]: LY: Use of anydata to define configuration data is not recommended. /ietf-yang-push:{augment='/sn:filters'}/ietf-yang-push:selection-filter/{uses='selection-filter-types'}/filter-spec/datastore-subtree-filter/datastore-subtree-filter
[INF]: LY: Use of anydata to define configuration data is not recommended. /ietf-subscribed-notifications:filters/stream-filter/{uses='stream-filter-elements'}/filter-spec/stream-subtree-filter/stream-subtree-filter
[INF]: LY: Use of anydata to define configuration data is not recommended. /ietf-yang-push:{augment='/sn:subscriptions/sn:subscription/sn:target'}/ietf-yang-push:datastore/{uses='datastore-criteria'}/{uses='selection-filter-objects'}/selection-filter/within-subscription/{uses='selection-filter-types'}/filter-spec/datastore-subtree-filter/datastore-subtree-filter
[INF]: LY: Use of anydata to define configuration data is not recommended. /ietf-subscribed-notifications:subscriptions/subscription/{uses='subscription-policy'}/{uses='subscription-policy-dynamic'}/{uses='subscription-policy-modifiable'}/target/stream/stream-filter/within-subscription/{uses='stream-filter-elements'}/filter-spec/stream-subtree-filter/stream-subtree-filter
[INF]: LY: The ordered-by statement is ignored in lists representing notification content (/ietf-yang-push:push-change-update/datastore-changes/{uses='ypatch:yang-patch'}/yang-patch/edit).
[INF]: SR: Connection 60 created.
[INF]: SR: Session 42 (user "root", CID 60) created.
[ERR]: SR: RPC subscription for "/ietf-netconf:get-config" with priority 0 already exists.
[ERR]: NP: Subscribing for "/ietf-netconf:get-config" RPC failed (Invalid argument).
[ERR]: NP: Server RPC subscribe failed.
[INF]: NP: Server terminated.
[INF]: SR: No datastore changes to apply.
root@d86bd7159170:~/netopeer2_bak# 
  • 确认服务
root@d86bd7159170:~/netopeer2_bak# ps -ef | grep net
root       17019       1  0 02:58 ?        00:00:00 netopeer2-server
root       17031       7  0 03:01 pts/0    00:00:00 grep --color=auto net
root@d86bd7159170:~/netopeer2_bak# 


root@d86bd7159170:~/netopeer2_bak# ss -apn | grep 830     
tcp   LISTEN     0       5                0.0.0.0:830             0.0.0.0:*      users:(("netopeer2-serve",pid=17019,fd=34))                                    
root@d86bd7159170:~/netopeer2_bak# 
  • 给root设置密码
root@d86bd7159170:~/netopeer2_bak# passwd
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@d86bd7159170:~/netopeer2_bak# 
  • 运行netopeer2-cli ,;连接netopeer2-server
root@d86bd7159170:~/netopeer2_bak# netopeer2-cli 
> connect localhost
Interactive SSH Authentication
Type your password:
Password: 
> 

*接着 获取running

> get-config --source running
DATA
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <keystore xmlns="urn:ietf:params:xml:ns:yang:ietf-keystore">
    <asymmetric-keys>
      <asymmetric-key>
        <name>genkey</name>
        <algorithm>rsa2048</algorithm>
        <public-key>MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAubowy3luPuk3/5PZtXApS+Y6XopgcvpMZNbtoS9nvH4sZBd75ApZ3Zwd3WXs/KQvylX14ktczxrVs+NLtN5ZZO0vOZMF/v/wGoOoWMljboRt5Bx1oV27qjmd9pohesrusDl+DpyOo1kmvFwypgXk6PWzVBBUJKifdk5VnGdEGoBF8opMxqmgYUaCqjKLFnpgXfkDu9RGp4KO/oHyvtQQ49ChMnWkphYUc+73msG2rkcrJO0yUCeY1HNA8um1ihilnnmphT3DfCib8PinJjzyaekFvVbxdHwB/swYtwIZWrqSLibfUS6fL99DPVHs2QtTUCAYUGBzjp3042lhC+9hewIDAQAB</public-key>
        <private-key>MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC5ujDLeW4+6Tf/k9m1cClL5jpeimBy+kxk1u2hL2e8fixkF3vkClndnB3dZez8pC/KVfXiS1zPGtWz40u03llk7S85kwX+//Aag6hYyWNuhG3kHHWhXbuqOZ32miF6yu6wOX4OnI6jWSa8XDKmBeTo9bNUEFQkqJ92TlWcZ0QagEXyikzGqaBhRoKqMosWemBd+QO71Eango7+gfK+1BDj0KEydaSmFhRz7veawbauRysk7TJQJ5jUc0Dy6bWKGKWeeamFPcN8KJvw+KcmPPJp6QW9VvF0fAH+zBi3AhlaupIuJt9RLp8v30M9UezZC1NQIBhQYHOOnfTjaWEL72F7AgMBAAECggEAedJ57Q0SViuNcpOdKpiOTd2OjbKAPwqUj1Q2/BHnHkk4ftK0jciIV4buQ+l2P+TGABbQOIWsM6Brahn9734k7sFwx3f7Z96itBGFm+9EzBoLJqPQOG8OCELQrQ8+RJfVZjvfxl/EY7q3YLes9R9Knc+Dt/EZ8A22wtfw6a0Gi8ZXaeGK4/y7o2vU5JdPhMcZUJQ9l42Rd+rxtVggD/IvN5TWNl7gV+CxpfjZF5KyL/tkSXaUMxZfGykuNAKpenOwG6hV448i2aphqhiFEP5LRJvtcqiDbc//HIdg+zbQIrrzyc+cSPVxWaSHxiGxP1U26zBZWCXtan2qW+MYJ0oIaQKBgQDg/AzM5FDbTJ7/di7s4s7Wvbu0mHObWrDy0PPKaJJ6nnrFiMtz5OoXKpRJFW+Z4jUvEYz43cbsRC0nCUjQdZAMGWOewYWiGKLXRXy8jtv6/nKgWwVOs4knQob5bU7gA5j7WEoAvVRDcdRyfRW1Qx70QQN2eUl0/jroONzV7PCunwKBgQDTVLWIwqYkp/xCprrKQ7W+kgPT4f/fKvFReRxtT4f9THm3UP74vZes/k1/D4IvXJiASjgLy6fqgd9K+6lzHn7symWmKx1lzeaFmDSniB6ChiQZfIKu2NIkegU8nr+xORkhLZyQTD+JcVa+Laq1lN9Yed1gvW7NQHFQM6w7NfILpQKBgQCZUYqTkj+7wpJTusEtsz6LPo8M+htGUl5lipmoZOz1XMyDkr47A1O3Z8/XoiEEeBAQPGCaM+Bcn/U5Ne2GCaeZZy/pPy4HEcze8L6ZbK1idUW+G2kZgeXEeGSs0529sRXuqvL7YAptT8QcJTvG46/Tef6XHP4/GQUhvaZYrngyNwKBgQCFPMgDRG2JeNvDjekAcvYYA2kkYj13D1T7//abOGRNn7SxjgBjBO2m5OIpNLboc2G2qJRzY2AnquAEH2yzJsvxMJ4ryM0NDWbEXbT81wYdVsNVyjl+UTcURlYc5R2Id65PS7mFBH2egvWki5gwSX8TAio/vs8n2vRWE24IGrfS/QKBgQCtMrDtNVLkVpY5bPHAXJJ3KmwN0cEuOeI2Mjg9nfjjitJIG4gOUSxif6KoR8y1OSZjtJBttiAb21XvFnA/kaSk0qBsvo5iHwaBidDHK+qRCEClshvTzOz80QE9XfvFnpKcKiGH1uClgPNhmy/w6aQqbHmbrwRIb5VkiDo3sdxHYQ==</private-key>
      </asymmetric-key>
    </asymmetric-keys>
  </keystore>
  <netconf-server xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-server">
    <listen>
      <endpoint>
        <name>default-ssh</name>
        <ssh>
          <tcp-server-parameters>
            <local-address>0.0.0.0</local-address>
            <keepalives>
              <idle-time>1</idle-time>
              <max-probes>10</max-probes>
              <probe-interval>5</probe-interval>
            </keepalives>
          </tcp-server-parameters>
          <ssh-server-parameters>
            <server-identity>
              <host-key>
                <name>default-key</name>
                <public-key>
                  <keystore-reference>genkey</keystore-reference>
                </public-key>
              </host-key>
            </server-identity>
            <client-authentication>
              <supported-authentication-methods>
                <publickey/>
                <passsword/>
                <other>interactive</other>
              </supported-authentication-methods>
            </client-authentication>
          </ssh-server-parameters>
        </ssh>
      </endpoint>
    </listen>
  </netconf-server>
</data>

> 

对接成功!

  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 在Ubuntu 18.04下搭建PX4环境的步骤如下: 1. 安装依赖项 在终端中输入以下命令: sudo apt-get update sudo apt-get install git zip qtcreator cmake build-essential genromfs ninja-build libopencv-dev libeigen3-dev -y 2. 克隆PX4代码 在终端中输入以下命令: cd ~ git clone https://github.com/PX4/Firmware.git --recursive 3. 安装PX4工具链 在终端中输入以下命令: cd ~/Firmware make px4_sitl_default gazebo 4. 配置环境变量 在终端中输入以下命令: echo "source ~/Firmware/Tools/setup_gazebo.bash ~/Firmware ~/Firmware/build/px4_sitl_default" >> ~/.bashrc source ~/.bashrc 5. 启动PX4仿真 在终端中输入以下命令: cd ~/Firmware make px4_sitl_default gazebo 6. 测试 在终端中输入以下命令: cd ~/Firmware make px4_sitl_default gazebo 以上就是在Ubuntu 18.04下搭建PX4环境的步骤。 ### 回答2: 在ubuntu18.04搭建PX4环境,需要进行以下步骤: 1.更新安装包: sudo apt-get update sudo apt-get upgrade 2.安装GNUPG: sudo apt install gnupg 3.下载PX4 GPG key: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 045F9926759BAC3C 4.添加PX4软件源: sudo add-apt-repository "deb https://px4.io/repos/apt/ubuntu `lsb_release -cs` main" 5.更新软件源: sudo apt-get update 6.安装PX4: sudo apt install px4 7.安装PX4模拟器: sudo apt install sitl 8.安装ROS框架: sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt install curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - sudo apt-get update sudo apt-get install ros-melodic-desktop-full 9.依照机型安装相应依赖包: sudo apt-get install protobuf-compiler libeigen3-dev libxml2-utils libopencv-dev libblas-dev liblapack-dev libboost-all-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev gstreamer1.0-plugins-good python-matplotlib python-argparse python-lxml python-yaml python-six python-dev python-numpy python-pip python-setuptools cmake build-essential sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" sudo apt-get update 10.构建PX4: 注意,以下操作要在PX4源代码目录下执行 cd PX4-Autopilot make px4_sitl_default gazebo 11.启动PX4模拟器: ./Tools/gazebo_sitl.sh -i 0 -m iris gazebo 以上就是在ubuntu18.04搭建PX4环境的完整步骤,如果按照以上步骤进行操作,就能够成功地搭建并启动模拟器,进行相关的开发调试。 ### 回答3: 在Ubuntu 18.04下搭建PX4环境,需要以下步骤: 1. 安装依赖项 在Ubuntu中,需要安装以下软件包: - git - cmake - python-jinja2 - python-pip - python-dev - build-essential - pkg-config - libgtk-3-dev - libcanberra-gtk3-module - libavcodec-dev - libavformat-dev - libswscale-dev - libreadline-dev - libudev-dev 可以通过以下命令进行安装: sudo apt-get install git cmake python-jinja2 python-pip python-dev build-essential pkg-config libgtk-3-dev libcanberra-gtk3-module libavcodec-dev libavformat-dev libswscale-dev libreadline-dev libudev-dev 2. 下载PX4源代码 安装完成依赖项后,需要从Github上下载PX4源代码,可以通过以下命令进行: git clone https://github.com/PX4/Firmware.git --recursive 3. 安装PX4的依赖项 PX4的依赖项可以通过以下命令进行安装: cd Firmware make px4_sitl_default gazebo 如果出现错误,请安装缺少的依赖项。常见的依赖项包括python-future、python-empy、python-toml等。 4. 编译PX4 编译PX4可以通过以下命令进行: cd Firmware make px4_fmu-v3_default 5. 启动PX4 启动PX4可以通过以下命令进行: cd Firmware make px4_sitl_default 在启动过程中可能会出现一些错误,常见的错误包括端口被占用、缺少权限等。需要根据实际情况进行处理。 以上就是Ubuntu 18.04下搭建PX4环境的步骤,希望能对大家有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值