{"id":23113,"date":"2025-04-19T07:06:55","date_gmt":"2025-04-18T23:06:55","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/23113.html"},"modified":"2025-04-19T07:06:55","modified_gmt":"2025-04-18T23:06:55","slug":"linux%e5%ae%89%e8%a3%85mqtt-%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%88%e5%9b%be%e6%96%87%e6%95%99%e7%a8%8b%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/23113.html","title":{"rendered":"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09"},"content":{"rendered":"<p>MQTT&#xff08;Message Queuing Telemetry Transport&#xff09;\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae&#xff0c;\u4e13\u4e3a\u4f4e\u5e26\u5bbd\u548c\u4e0d\u7a33\u5b9a\u7684\u7f51\u7edc\u73af\u5883\u8bbe\u8ba1&#xff0c;\u975e\u5e38\u9002\u5408\u7269\u8054\u7f51&#xff08;IoT&#xff09;\u5e94\u7528\u3002 \u5b98\u7f51\u5730\u5740&#xff1a;https:\/\/www.emqx.com\/<\/p>\n<h2>\u4e00\u3001\u7248\u672c\u9009\u62e9<\/h2>\n<p>\u6839\u636e\u81ea\u5df1\u7684\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u4e0b\u8f7d\u5373\u53ef&#xff0c;\u63a8\u8350\u4f7f\u7528rpm\u5b89\u88c5\u65b9\u5f0f\u3002<\/p>\n<p>\u4e0b\u8f7d\u5730\u5740&#xff1a;https:\/\/www.emqx.com\/zh\/downloads-and-install\/broker?os&#061;RHEL<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230653-6802db0d3e268.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u91cc\u56e0\u4e3a\u6211\u7684\u662f\u64cd\u4f5c\u7cfb\u7edf\u662f\u7ea2\u5e3dcentos7 &#xff0c;\u6240\u4ee5\u9009\u62e9\u8fd9\u4e2a\u7248\u672c\u8fdb\u884c\u4e0b\u8f7d\u5b89\u88c5\u3002<\/p>\n<h2>\u4e8c\u3001\u5b89\u88c5\u6559\u7a0b<\/h2>\n<h3>1\u3001\u4e0b\u8f7demqx<\/h3>\n<p><span class=\"token function\">wget<\/span> https:\/\/www.emqx.com\/zh\/downloads\/broker\/5.7.2\/emqx-5.7.2-el7-amd64.rpm<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230653-6802db0d789c3.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>2\u3001\u5b89\u88c5emqx<\/h3>\n<p><span class=\"token function\">sudo<\/span> yum <span class=\"token function\">install<\/span> emqx-5.7.2-el7-amd64.rpm <span class=\"token parameter variable\">-y<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230653-6802db0daa9db.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>3\u3001\u542f\u52a8emqx<\/h3>\n<p><span class=\"token function\">sudo<\/span> systemctl start emqx<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230654-6802db0e4899d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h2>\u4e09\u3001\u53d1\u5e03\u4e0e\u8ba2\u9605<\/h2>\n<p><span class=\"token function\">sudo<\/span> yum <span class=\"token function\">install<\/span> mosquitto mosquitto-clients <span class=\"token parameter variable\">-y<\/span><\/p>\n<h2>1\u3001\u8ba2\u9605\u6d88\u606f<\/h2>\n<p>mosquitto_sub <span class=\"token parameter variable\">-h<\/span> localhost <span class=\"token parameter variable\">-t<\/span> <span class=\"token string\">&#034;test\/topic&#034;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230654-6802db0e97324.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h2>2\u3001\u53d1\u5e03\u6d88\u606f<\/h2>\n<p>mosquitto_pub <span class=\"token parameter variable\">-h<\/span> localhost <span class=\"token parameter variable\">-t<\/span> <span class=\"token string\">&#034;test\/topic&#034;<\/span> <span class=\"token parameter variable\">-m<\/span> <span class=\"token string\">&#034;Hello MQTT&#034;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230654-6802db0eb1831.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf7\u6b21\u3002MQTT\uff08Message Queuing Telemetry Transport\uff09\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae\uff0c\u4e13\u4e3a\u4f4e\u5e26\u5bbd\u548c\u4e0d\u7a33\u5b9a\u7684\u7f51\u7edc\u73af\u5883\u8bbe\u8ba1\uff0c\u975e\u5e38\u9002\u5408\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u3002_linux \u5b89\u88c5mqtt<\/p>\n","protected":false},"author":2,"featured_media":23107,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,320,43,44],"topic":[],"class_list":["post-23113","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-mqtt","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/23113.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf7\u6b21\u3002MQTT\uff08Message Queuing Telemetry Transport\uff09\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae\uff0c\u4e13\u4e3a\u4f4e\u5e26\u5bbd\u548c\u4e0d\u7a33\u5b9a\u7684\u7f51\u7edc\u73af\u5883\u8bbe\u8ba1\uff0c\u975e\u5e38\u9002\u5408\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u3002_linux \u5b89\u88c5mqtt\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/23113.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T23:06:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230653-6802db0d3e268.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23113.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/23113.html\",\"name\":\"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T23:06:55+00:00\",\"dateModified\":\"2025-04-18T23:06:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/23113.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/23113.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23113.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/23113.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.7k\u6b21\uff0c\u70b9\u8d5e9\u6b21\uff0c\u6536\u85cf7\u6b21\u3002MQTT\uff08Message Queuing Telemetry Transport\uff09\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6d88\u606f\u4f20\u8f93\u534f\u8bae\uff0c\u4e13\u4e3a\u4f4e\u5e26\u5bbd\u548c\u4e0d\u7a33\u5b9a\u7684\u7f51\u7edc\u73af\u5883\u8bbe\u8ba1\uff0c\u975e\u5e38\u9002\u5408\u7269\u8054\u7f51\uff08IoT\uff09\u5e94\u7528\u3002_linux \u5b89\u88c5mqtt","og_url":"https:\/\/www.wsisp.com\/helps\/23113.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T23:06:55+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418230653-6802db0d3e268.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/23113.html","url":"https:\/\/www.wsisp.com\/helps\/23113.html","name":"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T23:06:55+00:00","dateModified":"2025-04-18T23:06:55+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/23113.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/23113.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/23113.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u5b89\u88c5MQTT \u670d\u52a1\u5668\uff08\u56fe\u6587\u6559\u7a0b\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/23113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=23113"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/23113\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/23107"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=23113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=23113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=23113"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=23113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}