The content of this article is about how to build an MQTT server under Ubuntu. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
The blogger previously wrote an article "Building an MQTT Server under Windows". This time I will try to build an MQTT server under Ubuntu. In fact, after downloading the source code package, the rest is almost the same as that article.
Virtual machine Ubuntu 14.04.5 LTS
Apache-Apollo-1.7.1
Since building Apollo environment variables requires JAVA_HOME
, you need to install JDK at this time. You can refer to this article: "Ubuntu Installs JDK1.8.0 and Configure environment variables".
First download Apache-Apollo, download page: http://www.apache.org/dyn/closer.cgi?path=activemq/activemq-apollo/1.7 .1/apache-apollo-1.7.1-unix-distro.tar.gz
Or enter the following command:
wget http://apache.fayea.com/activemq/activemq-apollo/1.7.1/apache-apollo-1.7.1-unix-distro.tar.gz
Decompress the source package:
tar -zxvf apache-apollo-1.7.1-unix-distro.tar.gz
Enter the apache-apollo-1.7.1/bin directory
cd apache-apollo-1.7.1/bin/
Enter ./apollo
to view the help
pi@raspberry-pi:~/Downloads/apache-apollo-1.7.1/bin$ ./apollo usage: apollo [--log <log_level>] <command> [<args>]The most commonly used apollo commands are: create creates a new broker instance disk-benchmark Benchmarks your disk's speed help Display help information version Displays the broker versionSee 'apollo help <command>' for more information on a specific command.
Create a Broker example: /apollo create mybroker
. MQTT servers are all called Broker.
pi@raspberry-pi:~/Downloads/apache-apollo-1.7.1/bin$ ./apollo create mybroker Creating apollo instance at: mybroker Generating ssl keystore... You can now start the broker by executing: "/home/***/Downloads/apache-apollo-1.7.1/bin/mybroker/bin/apollo-broker" run Or you can setup the broker as system service and run it in the background: sudo ln -s "/home/***/Downloads/apache-apollo-1.7.1/bin/mybroker/bin/apollo-broker-service" /etc/init.d/ /etc/init.d/apollo-broker-service start
There will be prompts later on how to start the server and create a service.
Start Apollo:
pi@raspberry-pi:~/Downloads/apache-apollo-1.7.1/bin$ ./mybroker/bin/apollo-broker run
After checking the print information, you can know the port to which MQTT is connected and the management page port.
Finish.
The above is the detailed content of How to build an MQTT server under Ubuntu. For more information, please follow other related articles on the PHP Chinese website!