mqtt(10):安装 debian xface 系统,搭建golang 环境,开发iot边缘网关

前言


本文的原文连接是: https://blog.csdn.net/freewebsys/article/details/89463730
未经博主允许不得转载。
博主地址是:http://blog.csdn.net/freewebsys

1,关于debian


在服务器上面 centos 非常的不错,但是感觉还不是很精简,而且没有一个消耗资源少的桌面。
debian 还是非常不错的。有一个 xface的 桌面系统,相比 gnome 和 kde 算是资源消耗的比较小了。
做小型设备上面的桌面非常不错了。
下载地址:

https://mirrors.aliyun.com/debian-cd/current/arm64/iso-cd/debian-9.8.0-arm64-xfce-CD-1.iso
这个是amd64 位的,其他的下载:
https://opsx.alibaba.com/mirror

2,使用软件


直接进行安装就行了。安装好了就是 xface 的系统了。

Debian GNU/Linux 9

更新 aliyun 的 mirrors 镜像地址:
https://opsx.alibaba.com/mirror

vi /etc/apt/sources.list

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

需要 安装 golang,在使用虚拟机安装 golang 的时候发现,从golang 官网下载的 linux 不能编译文件报错:

2019/04/22 05:31:23 ERROR    0003 Failed to build the application: /usr/local/go/pkg/tool/linux_amd64/link: signal: killed

我用的版本是 1.12 的。官网最新的。后来懒得解决了。直接使用 apt 进行安装一个 1.11 的版本。就没有问题了。
debian apt 没有最新 1.12 的包,估计也再测试解决 bug 呢。

su root 执行:

apt-get update
apt-get install -y golang-1.11 build-essential
apt-get install -y openjdk-8-jdk 

设置golang 环境变量:

扫描二维码关注公众号,回复: 8967529 查看本文章

vi /etc/profile

最后面加上:

export GOROOT=/usr/lib/go-1.11
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

其中 GOROOT 就是golang 的位置,安装到了 usr/lib 目录下面。

配置ssh ,默认 debian 是没有 ssh 服务的。

#安装
apt-get install openssh-server
#增加到 开机启动
# systemctl enable  ssh
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
Created symlink /etc/systemd/system/sshd.service /lib/systemd/system/ssh.service.

debian 9 增加了 systemd 的服务管理。方便多了。可以把一些任务都加入到里面。

3,总结


使用了debian的 xface 桌面系统搭建开发环境,并安装了 golang 环境,不通于 centos的配置。
也都差不多,搭建好了环境就可以开发 mqtt iot 网关了。

其他


购买了一个小主机,默认带了一个 windows ,把系统格式化了,直接装上 xface 当个iot网关。
比想象中大点。配置
赛扬J1900 cup,内存2g,硬盘 30G,带两个网口,wifi,两个 com,4个usb hdmi 和vga 输出。
地址:https://item.jd.com/31466471507.html
(非广告,没给赞助费,觉得挺有意思分享下 ,689 元,有人问,直接贴上了地址,懒得回复评论了。)
以后直接在这个小硬件上研究 golang ,进行开发了。

本文的原文连接是:
https://blog.csdn.net/freewebsys/article/details/89463730

博主地址是:http://blog.csdn.net/freewebsys

发布了624 篇原创文章 · 获赞 259 · 访问量 208万+

猜你喜欢

转载自blog.csdn.net/freewebsys/article/details/89463730