在我的上一篇文章中将Raspberry Pi安装在具有Internet连接的环境中之后,Pi爱好者的下一步是如何配置您的Pi,以便您可以在任何地方进行控制。
根据Google的研究,我发现有两个网站提供免费服务,可通过Internet从任何地方远程访问您的Pi。
1. 编织的 Remot3.it
注意: 编织已发展成为remot3.it。验证Remot3.it进程后,我将再次更新此部分。
1.1 通过Weaved SSH连接将Pi升级到remot3.it
仅当通过Weaved ssh连接连接到Pi时,才使用这些说明。
立即将您的Pi和所有编织服务添加到remot3.it
1.2将您的Pi从Weaved升级到remot3.it
仅当您可以物理访问Pi时,才使用这些说明 通过局域网连接(Wi-Fi或以太网)。或使用USB(或蓝牙)键盘+鼠标和HDMI监视器。
第1步,共4步
使用键盘+ HDMI监视器或通过Wi-Fi或以太网LAN的ssh连接在Pi上打开命令行。
第2步,共4步
更新您的Pi上的软件包列表,以便您获取weavedconnectd软件包的最新版本
> sudo apt-get更新
第3步,共4步
通过输入以下命令,下载并安装包含对remot3.it的支持的weavedconnectd deb软件包。
> 须藤apt-get install weavedconnectd
第4步,共4步
从命令行运行weavedinstaller。
sudo weavedinstaller
使用屏幕上的登录菜单(如下所示),在提示符下输入“ 1”,以登录您的remot3.it帐户。 使用您先前存在的Weaved帐户电子邮件和密码登录 www.remot3.it88.
接下来,当提示您输入设备名称时,为您的Pi提供一个设备名称(例如my_Pi_001),如下所示。输入的设备名称将显示在remot3.it门户中。您可以稍后随时编辑设备名称。输入名称并按Enter,然后让安装程序完成并返回提示。然后输入“ 4”退出交互式菜单安装程序。 (菜单项目4)。
登录为:pi
[电子邮件 protected]'s password:
的Linux raspberrypi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l
Debian GNU / 的Linux系统附带的程序是免费软件;
每个程序的确切分配条款在
/ usr / share / doc / * / copyright中的单个文件。
Debian GNU / 的Linux绝对不提供担保
适用法律允许。
Last login: Mon Dec 5 10:49:33 2016 from 19.24.116.129
[电子邮件 protected] 〜$
[电子邮件 protected] 〜$ sudo apt-get更新
Get:1 http://archive.raspberrypi.org wheezy Release.gpg [473 B]
Hit http://raspberrypi.collabora.com wheezy Release.gpg
Get:2 http://mirrordirector.raspbian.org wheezy Release.gpg [473 B]
Hit http://raspberrypi.collabora.com wheezy Release
Get:3 http://mirrordirector.raspbian.org wheezy Release [14.4 kB]
Get:4 http://archive.raspberrypi.org wheezy Release [17.6 kB]
Hit http://raspberrypi.collabora.com wheezy/rpi armhf Packages
Get:5 http://mirrordirector.raspbian.org wheezy/main armhf Packages [6,935 kB]
Get:6 http://archive.raspberrypi.org wheezy/main armhf Packages [145 kB]
Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en_GB
Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en
Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB
Ign http://archive.raspberrypi.org wheezy/main Translation-en
Get:7 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [23.6 kB]
Get:8 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [49.3 kB ]
Get:9 http://mirrordirector.raspbian.org wheezy/rpi armhf Packages [592 B]
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en
Fetched 7,186 kB in 22s (320 kB/s)
Reading package lists... Done
[电子邮件 protected] 〜$ 须藤apt-get install weavedconnectd
Reading package lists... Done
建立依赖树
Reading state information... Done
weavedconnectd is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 144 not upgraded.
[电子邮件 protected] 〜$ sudo weavedinstaller
编织的 connection installer Version: v1.3-02_Pi
Checking your network for compatibility...
Your network is compatible with 编织的 services.
请输入您的编织用户名(电子邮件地址):
[电子邮件 protected]
Please enter your password:
You have entered either an incorrect username or password. Please try again.
Press the 'Enter' key to continue.
请输入您的编织用户名(电子邮件地址):
[电子邮件 protected]
Please enter your password:
================================================== =======
协议 港口 服务 编织名称
================================================== =======
TCP协议 3389 xrdp xrdp-pi
SSH协议 22 sshd jrasp-ssh
********************** 主菜单 ************************
* *
* 1)附加/重新安装编织到服务 *
* 2)从服务中删除编织的附件 *
* 3)退出 *
* *
********************************************************** *******
请从以上选项(1-3)中选择:
3
[电子邮件 protected] 〜$
编织的为您的Raspberry提供您想要远程提供的任何基于TCP的服务-安全且无端口转发• SSH协议on port 22•端口80上的Web(http)•端口8000上的WebIOPI(仅适用于Raspberry Pi)•端口5901上的VNC•您喜欢的任何端口上的自定义TCP服务
可以在同一盒子上安装多个服务,还有免费的iOS应用程序,可以将您的Pi设置为向您发送推送通知。
主页说 它增加了远程连接的功能&只需15分钟即可将其移动到您的Raspberry Pi。
1.1手动安装
100%[============================>] 303,036 665K/s in 0.4s 2015-10-06 12:45:23(665 KB / s)–已保存`weaved-nixinstaller_1.2.13.bin'[303036/303036] [电子邮件 protected] 〜$ chmod + x weaved-nixinstaller_1.2.13.bin 您正在运行安装程序脚本版本:v1.2.13 现在启动Weaved connectd守护程序安装程序… 正在检查与Weaved网络的兼容性... 检查DNS是否有效……。[确定] 正在检查与weaved.com的TCP连接…<oip=192.168.2.250> [OK] 发送至174.36.235.146:5960 [] [mip = 216.165.201.211] [oport = 59612 mport = 59612] [无重新映射] [保留端口] [确定] 恭喜你!您的网络与Weaved服务兼容。 ***********协议选择菜单*********** 请从以上选项(1-5)中选择: SSH的默认端口是22。 协议:ssh 请输入您的编织用户名(电子邮件地址): 现在,请输入您的密码: 您的设备UID已成功设置为:80:00:00:05:46:00:52:0F。 UID预注册成功:80:00:00:05:46:00:52:0F。 现在,我们将向Weaved后端服务注册您的设备。 正在为Weavedssh22…注册注册Weaved服务。 正在启动Weavedssh22… ********************************************************** ************************ 设备别名: 设备UID: 设备密码: 别名,设备UID和设备机密保存在许可证文件中: 如果删除此许可证文件,则必须重新运行安装程序。 ********************************************************** ************************ 可以通过键入以下命令来启动和停止服务: |
通过单击您的设备名称,Weaved网站将为您提供新的主机名和端口,以便您从Internet上的任何位置进行远程连接。
1.2使用apt-get进行自动安装
********************** 主菜单 ************************ 请从以上选项(1-3)中选择: |
2.适度性
如果您的Raspberry Pi已连接到Internet,则可以通过Internet在任何地方通过Dataplicity访问它。您甚至可以连接到防火墙后面的设备,而无需复杂的网络配置。 数据一致性使用客户端启动的HTTPS连接,因此它是安全的,经过加密的,并且您无需设置特定的防火墙例外。 数据一致性的主页说,只有60秒钟,您的Pi才能随时随地进行控制。当然,这将花费超过60秒的时间,但您等待的时间不会超过5分钟。这是我测试的所有输出:
登录为:pi
[电子邮件 protected]的密码: 的Linux raspberrypi 3.18.7-v7 +#755 SMP PREEMPT周四2月12日17:20:48 GMT 2015 armv7 l Debian GNU / 的Linux系统附带的程序是免费软件; 每个程序的确切分配条款在 / usr / share / doc / * / copyright中的单个文件。 Debian GNU / 的Linux绝对不提供担保 适用法律允许。 上次登录时间:2015年10月10日星期六10:18:58来自192.168.2.120 [电子邮件 protected] 〜$ curl -s //dataplicity.com/1c7196e9.sh | sudo sh 欢迎使用Dataplicity Shell快速安装 在某些系统上,此过程最多可能需要15分钟,但通常< 30 seconds [第5步,共1步]更新系统… 选择以前未选择的软件包python-medusa。 (正在读取数据库…77461当前安装的文件和目录。) 正在解压缩python-medusa(从…/ python-medusa_1%3a0.5.4-7_all.deb)… 选择先前未选择的软件包python-pkg-resources。 解包python-pkg-resources(来自…/ python-pkg-resources_0.6.24-1_all.deb) … 选择先前未选择的软件包python-meld3。 正在解压缩python-meld3(来自…/ python-meld3_0.6.5-3.1_armhf.deb)… 选择以前未选择的程序包管理程序。 正在打开主管的包装(来自…/ supervisor_3.0a8-1.1 + deb7u1_all.deb)… 设置python-medusa(1:0.5.4-7)… 设置python-pkg-resources(0.6.24-1)… 设置python-meld3(0.6.5-3.1)… 设置主管(3.0a8-1.1 + deb7u1)… 起始主管:主管。 正在处理python-support的触发器... 选择先前未选择的软件包libossp-uuid16。 (正在读取数据库…77687当前安装的文件和目录。) 正在解包libossp-uuid16(来自…/ libossp-uuid16_1.6.2-1.3_armhf.deb)… 选择先前未选择的软件包uuid。 打开uuid的包装(从…/ uuid_1.6.2-1.3_armhf.deb)… 正在处理man-db的触发器... 设置libossp-uuid16(1.6.2-1.3)… 设置uuid(1.6.2-1.3)… 预配置包… (正在读取数据库…77701当前安装的文件和目录。) 准备替换libssl1.0.0:armhf 1.0.1e-2 + rvt + deb7u14(使用... / libssl1.0 .0_1.0.1e-2 + rvt + deb7u17_armhf.deb)… 正在解压替代libssl1.0.0:armhf… 准备替换libexpat1:armhf 2.1.0-1 + deb7u1(使用…/ libexpat1_2.1.0-1 + deb7u2_armhf.deb)… 正在打开替换libexpat1:armhf的包装… 选择先前未选择的软件包libexpat1-dev。 正在解压缩libexpat1-dev(从…/ libexpat1-dev_2.1.0-1 + deb7u2_armhf.deb)… 选择以前未选择的软件包libssl-dev。 正在解压缩libssl-dev(从... / libssl-dev_1.0.1e-2 + rvt + deb7u17_armhf.deb)… 选择以前未选择的软件包libssl-doc。 正在解压缩libssl-doc(来自…/ libssl-doc_1.0.1e-2 + rvt + deb7u17_all.deb)… 选择先前未选择的软件包python2.7-dev。 正在解压缩python2.7-dev(从…/ python2.7-dev_2.7.3-6 + deb7u2_armhf.deb)… 选择先前未选择的软件包python-dev。 正在解压缩python-dev(从... / python-dev_2.7.3-4 + deb7u1_all.deb)… 正在处理man-db的触发器... 设置libssl1.0.0:armhf(1.0.1e-2 + rvt + deb7u17)… 设置libexpat1:armhf(2.1.0-1 + deb7u2)… 设置libexpat1-dev(2.1.0-1 + deb7u2)… 设置libssl-dev(1.0.1e-2 + rvt + deb7u17)… 设置libssl-doc(1.0.1e-2 + rvt + deb7u17)… 设置python2.7-dev(2.7.3-6 + deb7u2)… 设置python-dev(2.7.3-4 + deb7u1)… [第5步,共2步]安装Dataplicity Core… id:dataplicity:没有这样的用户 /tmp/tmpYpFshT/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriatly and may cause certain SSL connections to fail. For more information, see //urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. /tmp/tmpYpFshT/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriatly and may cause certain SSL connections to fail. For more information, see //urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. 正在阅读包装清单…完成 建立依赖树 正在读取状态信息…完成 将安装以下新软件包: python-psutil 0个已升级,1个新安装,0个要删除和93个未升级。 需要获取54.4 kB档案。 执行此操作后,将使用264 kB的额外磁盘空间。 Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-psutil armhf 0.5.1-1 [54.4 kB] 10秒内即可获得54.4 kB(5,203 B / s) 选择以前未选择的软件包python-psutil。 (正在读取数据库…当前已安装的79253个文件和目录。) 正在解压缩python-psutil(从... / python-psutil_0.5.1-1_armhf.deb)… 设置python-psutil(0.5.1-1)… 正在处理python-support的触发器... [第3步,共5步]安装Dataplicity… [第5步,共4步]正在注册设备“ raspberrypi”… [第5步,共5步]正在启动服务… 现在已安装Dataplicity Shell! 您的设备将在几秒钟内在线 Visit //dataplicity.com/devices/ to manage your device [电子邮件 protected] 〜$重新启动主管:主管。 |
安装Dataplicity软件包后,您可以登录到Dataplicity,选择所需的设备并访问远程Shell。就这么简单!
安装软件包之前在Dataplicity Site上的设备页面 |
您的Raspberry设备显示在“您的设备”页面中 |
3. 树莓派动态IP DNS更新
3.1在Raspberry Pi上安装DDclient
3.2配置/etc/ddclient.conf文件
我正在使用Dynu免费动态域更新服务。根据我在Dynu网站上找到的建议配置文件,我为自己生成了一个。
登录为:pi
[电子邮件 protected]'s password:
的Linux raspberrypi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l
Debian GNU / 的Linux系统附带的程序是免费软件;
每个程序的确切分配条款在
/ usr / share / doc / * / copyright中的单个文件。
Debian GNU / 的Linux绝对不提供担保
适用法律允许。
Last login: Sun Dec 4 22:43:54 2016 from 192.168.2.13
[电子邮件 protected] 〜$ cd /etc
[电子邮件 protected] /etc $ sudo cat ddclient.conf
daemon = 60
syslog=yes # Lheck every 60 seconds.
mail=root # Mail all msgs to root.
mail-failure=root # Mail failed update msgs to root.
pid=/var/run/ddclient.pid # Record PID in file.
use=web, web=checkip.dynu.com/, web-skip='IP Address' #Get ip from server.
server=api.dynu.com # IP update server.
protocol=dyndns2
login=jonnet # Your username.
password=12345678 # Password or MD5 of password.
51sec.DYNU.COM # List 上e or more hostnames 上e 上 each line.
91sec.dynu.com
#MYDOMAIN.COM
[电子邮件 protected] /etc $
3.3将ddclient作为守护程序运行
/etc/default/ddclient
and set:daemon_interval
参数也是如此,我认为默认值300秒(5分钟)是合理的,因此我没有更改它。/etc/cron.daily
or /etc/cron.weekly
:注意: 有关如何从Linux命令行获取公共IP地址的信息
curl
or wget
从公共站点提取信息:curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
wget http://ipinfo.io/ip -qO -