LoRaServer 笔记 1.2 基础依赖工具准备

2020-04-17 11:07:36 浏览数 (1)

前言

本篇笔记介绍开发所需的几个基础依赖工具。

小能手最近在学习 LoRa Server 项目,应该是最有影响力的 LoRaWAN 服务器开源项目。它组件丰富,代码可读性强,是个很好的学习资料。更多学习笔记,可点此查看。

1 MQTT broker

代码语言:javascript复制
sudo yum install mosquitto mosquitto-clients

2 PostgreSQL

2.1 安装

PostgreSQL 的安装具体见官网:https://www.postgresql.org/download/linux/redhat/

代码语言:javascript复制
# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

To use the PostgreSQL Yum Repository, follow these steps:

  1. Select version: 11
  2. Select platform: CentOS 7
  3. Select architecture:
  4. Install the repository RPM:
代码语言:javascript复制
yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
  1. Install the client packages:
代码语言:javascript复制
> yum install postgresql11
  1. Optionally install the server packages:
代码语言:javascript复制
yum install postgresql11-server
  1. Optionally initialize the database and enable automatic start:
代码语言:javascript复制
/usr/pgsql-11/bin/postgresql-11-setup initdb
systemctl enable postgresql-11
systemctl start postgresql-11

2.2 配置

配置操作如下:

代码语言:javascript复制
# sudo -u postgres psql
psql (11.2)
Type "help" for help.

postgres=# create role loraserver_as with login password 'dbpassword';
CREATE ROLE
postgres=# create role loraserver_ns with login password 'dbpassword';
CREATE ROLE
postgres=# create database loraserver_as with owner loraserver_as;
CREATE DATABASE
postgres=# create database loraserver_ns with owner loraserver_ns;
CREATE DATABASE
postgres=# c loraserver_as
You are now connected to database "loraserver_as" as user "postgres".
loraserver_as=# create extension pg_trgm;
ERROR:  could not open extension control file "/usr/pgsql-11/share/extension/pg_trgm.control": No such file or directory
loraserver_as=# q

这种问题下,需要安装下插件。

代码语言:javascript复制
# sudo yum install postgresql11-contrib

再试下就可以了。

代码语言:javascript复制
# sudo -u postgres psql
psql (11.2)
Type "help" for help.

postgres=# c loraserver_as
You are now connected to database "loraserver_as" as user "postgres".
loraserver_as=# create extension pg_trgm;
CREATE EXTENSION
loraserver_as=# q

3 Redis

Redis 是个比较流行的内存数据存储的数据库,在这个项目中也有用到。

具体安装方法 点击这里。

代码语言:javascript复制
redis-server --appendonly yes

END

0 人点赞