基基于阿里云服务器在Ubuntu环境下配置MQTT云服务平台

基于阿里云服务器在Ubuntu环境下配置MQTT云服务平台

首先登陆阿里云服务器

1.安装所需要的依赖包

1
2
3
4
5
6
$ sudo apt update && sudo apt install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

2.添加 EMQ X 的官方 GPG 密钥

1
$ curl -fsSL https://repos.emqx.io/gpg.pub | sudo apt-key add -

验证密钥

1
2
3
4
5
$ sudo apt-key fingerprint 3E640D53

pub rsa2048 2019-04-10 [SC]
FC84 1BA6 3775 5CA8 487B 1E3C C0B4 0946 3E64 0D53
uid [ unknown] emqx team <support@emqx.io>

3.使用以下命令设置 stable 存储库

1
2
3
4
$ sudo add-apt-repository \
"deb [arch=amd64] https://repos.emqx.io/emqx-ce/deb/ubuntu/ \
./$(lsb_release -cs) \
stable"

4.更新 apt 包索引

1
$ sudo apt update

5.安装最新版本的 EMQ X Broker

1
sudo apt install empx

6.安装特定版本的 EMQ X Broker

1
2
3
4
5
6
$ sudo apt-cache madison emqx

emqx | 4.0.0 | https://repos.emqx.io/emqx-ce/deb/ubuntu bionic/stable amd64 Packages
emqx | 3.0.1 | https://repos.emqx.io/emqx-ce/deb/ubuntu bionic/stable amd64 Packages
emqx | 3.0.0 | https://repos.emqx.io/emqx-ce/deb/ubuntu bionic/stable amd64 Packages
$ sudo apt install emqx=4.0.0 #更改4.0.0选择自己需要的版本

启动EMQ X Broker

1
2
3
4
5
6
7
8
9
10
11
$ emqx start
emqx 4.0.0 is started successfully!

$ emqx_ctl status
Node 'emqx@127.0.0.1' is started
emqx v4.0.0 is running
停止 EMQ X Broker
$ emqx stop
ok
卸载 EMQ X Broker
$ sudo apt remove emqx

阿里云服务器安全配置

进入安全配置打开这几个端口

duankou然后就可以通过浏览器访问啦,找到你的阿里云服务器公网ip地址,在浏览器中输入yourip:18083,就会进入如下界面

捕获服务器admin,密码为public