{"id":943,"date":"2018-11-10T11:12:26","date_gmt":"2018-11-10T08:12:26","guid":{"rendered":"http:\/\/leodev.ru\/blog\/?p=943"},"modified":"2018-11-10T11:14:51","modified_gmt":"2018-11-10T08:14:51","slug":"%d1%83%d1%81%d1%82%d0%b0%d0%bd%d0%be%d0%b2%d0%ba%d0%b0-%d0%b8-%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%be%d0%b9%d0%ba%d0%b0-mosquitto-%d0%b2-ubuntu","status":"publish","type":"post","link":"https:\/\/leodev.ru\/blog\/misc\/%d1%83%d1%81%d1%82%d0%b0%d0%bd%d0%be%d0%b2%d0%ba%d0%b0-%d0%b8-%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%be%d0%b9%d0%ba%d0%b0-mosquitto-%d0%b2-ubuntu\/","title":{"rendered":"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Mosquitto \u0432 Ubuntu"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440 MQTT<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-add-repository ppa:mosquitto-dev\/mosquitto-ppa\nsudo apt-get update\nsudo apt install mosquitto<\/code><\/pre>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install mosquitto-clients<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u043b\u0438 \u0441\u043b\u0443\u0436\u0431\u0430 mqtt \u0431\u0440\u043e\u043a\u0435\u0440\u0430<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo service mosquitto status\nmosquitto start\/running, process 16614<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 mqtt \u0441 \u0433\u043e\u0441\u0442\u0435\u0432\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 MQTTlens \u0438\u043b\u0438 MQTTDashboard \u0434\u043b\u044f \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u0440\u043e\u043b\u044f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443\/\u043f\u0430\u0440\u043e\u043b\u044e. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0438\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0444\u0430\u0439\u043b&nbsp;<strong>mosquitto.pwd<\/strong> \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435&nbsp;<strong>\/etc\/mosquitto\/<\/strong> \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0432 \u043d\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <strong>leo<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mosquitto_passwd -c \/etc\/mosquitto\/mosquitto.pwd leo<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u043b\u0435\u0435, \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0432\u0432\u043e\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/mosquitto\/mosquitto.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430, \u0447\u0435\u043c&nbsp;\u0433\u043e\u0432\u043e\u0440\u0438\u043c MQTT \u0433\u0434\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448 \u0444\u0430\u0439\u043b \u0441 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>allow_anonymous false\npassword_file \/etc\/mosquitto\/mosquitto.pwd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u0443<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo service mosquitto restart<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c MQTT \u0432 \u043c\u0438\u0440 (\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u043e\u0443\u0442\u0435\u0440\u0430)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 1883 \u043f\u043e\u0440\u0442. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0438\u0437 \u043c\u0438\u0440\u0430 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 \u0440\u043e\u0443\u0442\u0435\u0440\u0435<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>config rule\noption name 'Allow Mosquitto'\noption src 'wan'\noption proto 'tcp'\noption dest 'lan'\noption dest_ip '192.168.1.13'\noption dest_port '1883'\noption enabled '0'\noption target 'ACCEPT'\n\nconfig redirect\noption name 'Mosquitto'\noption target 'DNAT'\noption src 'wan'\noption dest 'lan'\noption proto 'tcp'\noption src_dport '1883'\noption dest_ip '192.168.1.13'\noption dest_port '1883'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440 MQTT<\/p>\n","protected":false},"author":1,"featured_media":946,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[107,105],"tags":[255,254,131],"class_list":["post-943","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-misc","tag-mosquitto","tag-mqtt","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts\/943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/comments?post=943"}],"version-history":[{"count":2,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts\/943\/revisions"}],"predecessor-version":[{"id":945,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/posts\/943\/revisions\/945"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/media\/946"}],"wp:attachment":[{"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/media?parent=943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/categories?post=943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leodev.ru\/blog\/wp-json\/wp\/v2\/tags?post=943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}