1、服务器购买
https://www.aliyun.com/ 打开网址,注册账号。按下图一步步操作。
![image-20220905171609329](https://img-blog.csdnimg.cn/img_convert/0f4086e4c3c3a894981ac0f97b28c661.png)
![image-20220905171702609](https://img-blog.csdnimg.cn/img_convert/3f9839890e47604d259b71764557d5c1.png)
由于实验为主,购买低配,安装windows 64位服务器,如步骤④⑤所示。
![image-20220905171857184](https://img-blog.csdnimg.cn/img_convert/0e2d88c7e050c6487d80ca83bb40b961.png)
进行系统配置。
![image-20220905174842751](https://img-blog.csdnimg.cn/img_convert/e1232e2d2ba9afc95ff0edf634bcf799.png)
设置登录密码,后面远程登录会用到。
![image-20220905175009694](https://img-blog.csdnimg.cn/img_convert/ab3e38e5bac04be8d3e337f740fb68fa.png)
![image-20220905175134415](https://img-blog.csdnimg.cn/img_convert/5eb199649d18865d10de0388425a2497.png)
购买完成后,直接点击“管理控制台”进行配置,主要配置规则。
![image-20220905175405337](https://img-blog.csdnimg.cn/img_convert/ff56e622e184970304da44e54eb13b2f.png)
首先点击左侧的“安全组”。这里简单讲下为什么要配置安全组,比如你要去参观朋友居住的寝室,那么会事先跟朋友讲好,你要过来了,把你住的的寝室门打开,这样到时你才能进去,而别的寝室由于没有打招呼就一直是关着的。其实这里的“门”相当于端口,由于以后会涉及到各种各样的端口,我们就直接把所有的端口都打开,这也是我们为什么配置安全组的原因。
![image-20220905211831480](https://img-blog.csdnimg.cn/img_convert/6cb24ffd3d117f89ee590df1b9d3250f.png)
看到右侧有“配置规则”,点击进入。
![image-20220905180744472](https://img-blog.csdnimg.cn/img_convert/30c9c78146c3713e3dae104be3c3ac60.png)
在“入方向”和“出方向”都要进行配置,先进行“入方向”配置,手动添加。
![image-20220905180807567](https://img-blog.csdnimg.cn/img_convert/c3d1dc8ba2cfeebe5bd1dbb3afe25db4.png)
根据下图配置
![image-20220905180834754](https://img-blog.csdnimg.cn/img_convert/5150aa223d4a52fd2528c0819481d48c.png)
进行“出方向”配置,同理于“入方向”配置。
![image-20220905180859968](https://img-blog.csdnimg.cn/img_convert/b26c213633a4baf6c5e5b4d0a374636f.png)
![image-20220905180920635](https://img-blog.csdnimg.cn/img_convert/c0d568914391bcc19cedd6d4ebbf35f4.png)
![image-20220905181135178](https://img-blog.csdnimg.cn/img_convert/7b718125428a39a5698e0dba8b27a420.png)
购买的服务器配置到此为止。
2、远程登录
按住键盘的WIN+R,输入“mstsc”。
![image-20220905181901864](https://img-blog.csdnimg.cn/img_convert/39623302240ba8e9e3a4e12576d3a58c.png)
在①处输入购买的服务器公有IP地址。由于有需要将本地电脑中的资料复制到云服务器,将建立本地电脑和云服务器的连接,点击②处。
![image-20220905183127281](https://img-blog.csdnimg.cn/img_convert/896804a3a7ce4f29f3636851346c11bf.png)
点击“详细信息”。
![image-20220905183206711](https://img-blog.csdnimg.cn/img_convert/dfec678a917dacd31a4997299cab7771.png)
勾选“I”盘,大家根据需要勾选,因为我的资料都在I盘。
![image-20220905183223138](https://img-blog.csdnimg.cn/img_convert/c4bbbb6ef519e1fc95fdb8a140297247.png)
确认后,点击“连接”。
![image-20220905183239271](https://img-blog.csdnimg.cn/img_convert/584715c8e5c7974411943ebb13ad5340.png)
输入之前设置的密码。
![image-20220905182053422](https://img-blog.csdnimg.cn/img_convert/5fe9d7fd759fbf33e64dc751558d7072.png)
按要求操作。
![image-20220905182116986](https://img-blog.csdnimg.cn/img_convert/4cadfac831597eb4bea2d5eb334c6eba.png)
进入服务器以后,可以看到本地电脑的I盘了。
![image-20220905183345938](https://img-blog.csdnimg.cn/img_convert/2dcc8f809da5fd9607822240f6981450.png)
3、mqtt平台搭建
在云服务器中搭建mqtt平台需要用到两个文件,在本地电脑中如下图所示。
![image-20220905212937356](https://img-blog.csdnimg.cn/img_convert/7f1f15d6963f4c6aa8e876e40e6f329c.png)
链接:https://pan.baidu.com/s/1soetUhqIDHqpUrbXuDgPwg?pwd=udbe
提取码:udbe
在云服务器中打开I盘,将本地I盘中的formqtt文件夹复制到云服务器中的C盘,如下图所示,将其中的压缩包解压。(注意:由于购买的服务器配置低,解压速度慢,有考虑先在本地电脑解压,再复制。这样有一定的风险,文件容易丢失,因此最好压缩包复制过去,在云服务器中解压)。接下去操作均在云服务器中操作!!
![image-20220905193620919](https://img-blog.csdnimg.cn/img_convert/8f1bfc99c216b807b529a247a9d95976.png)
在云服务其中按下图的路径复制 msvcv120.dll文件。
![image-20220905193636665](https://img-blog.csdnimg.cn/img_convert/21da2ce00fa5630ed3796238f20d6944.png)
复制到下图路径。
![image-20220905193727894](https://img-blog.csdnimg.cn/img_convert/5104119af475fd93ab0f4beb05e016f2.png)
打开下图路径,接下去需要运行emqttd文件。根据以往知识,首先要在命令框中打开对应路径,再运行,这里教大家一个简单方法,在下图箭头地方直接输入cmd.
![image-20220905193820234](https://img-blog.csdnimg.cn/img_convert/ab365e575b0dc8c979d920dea6864bec.png)
从命令框中我们知道已经进入了bin文件夹,输入指令 emqttd console
![image-20220905193918879](https://img-blog.csdnimg.cn/img_convert/6d29a51205cf6f6046a64c3df486a33e.png)
第一次启动的时候可能没反应,再重新运行一次,如下图,启动成功。
![image-20220905194055065](https://img-blog.csdnimg.cn/img_convert/2fc4163f858c4b75c88bd67c5bcb0d48.png)
在网页输入http://IP地址:18083,提示输入账号密码。默认的账号:admin。密码:public。
![image-20220905194500536](https://img-blog.csdnimg.cn/img_convert/7ad2d8d438e9619759e5a7a65275f345.png)
如下图,配置完成。
![image-20220905195328080](https://img-blog.csdnimg.cn/img_convert/7a381d82e13ca64e8b91c6f133bde382.png)
在实际使用过程中涉及到mqtt的账号和密码,但我们不知道,我们就直接修改MQTT用户名和密码。
首先关闭mqtt服务器。
![image-20220905201735100](https://img-blog.csdnimg.cn/img_convert/ebc2e8f8c20cdc72700b973141ef505c.png)
根据文件夹路径找到文件,以写字板方式打开,不要用记事本方式打开!!!
![image-20220905204626455](https://img-blog.csdnimg.cn/img_convert/35318f606033e21548e4dc35519c55ab.png)
将“true”改成“false”。
![image-20220905204228511](https://img-blog.csdnimg.cn/img_convert/534013c49fe566f51d660f201703757e.png)
在“plugins”文件夹下找到emq_auth_username.conf文件,添加账号和密码。
![image-20220905204550889](https://img-blog.csdnimg.cn/img_convert/356f750e5d5b7ede81ed61527b2f22b3.png)
到此为止修改完成!!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)