本文介绍在Ubuntu 18.04 Bionic Beaver操作系统上安装RethinkDB的方法,它是用于构建实时Web应用程序的可伸缩数据库,是一个存储无模式JSON文档的NoSQL数据库,它使你能够以极少的工作量构建出色的实时应用程序。
一、使用RethinkDB预构建的包 Sam Hughes已经准备好了.deb软件包下载,下载你需要的那个版本,本文下载的是rethinkdb_2.3.6.srh.1.0bionic_amd64.deb软件包。 然后使用dpkg命令安装它: $ sudo dpkg -i rethinkdb_2.3.6.srh.1.0bionic_amd64.deb Selecting previously unselected package rethinkdb. (Reading database ... 55796 files and directories currently installed.) Preparing to unpack rethinkdb_2.3.6.srh.1.0bionic_amd64.deb ... Unpacking rethinkdb (2.3.6.srh.1~0bionic) ... Setting up rethinkdb (2.3.6.srh.1~0bionic) ... The RethinkDB startup service is installed but disabled. To enable it, follow the instructions in the guide located at http://www.rethinkdb.com/docs/guides/startup/ Processing triggers for systemd (237-3ubuntu10.12) ... Processing triggers for ureadahead (0.100.0-20) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... 复制示例配置文件(Configuration file options)并使用配置文件文档作为指南进行自定义: sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf sudo vim /etc/rethinkdb/instances.d/instance1.conf 例子,启用http管理控制台: ### Web options ## Port for the http admin console ## Default: 8080 + port-offset http-port=8080 设置服务器的名称: ### Meta ## The name for this server (as will appear in the metadata). ## If not specified, it will be randomly chosen from a short list of names. server-name=server1 默认的Data目录是/var/lib/rethinkdb/,但你可以更改它: ### File path options ## Directory to store data and metadata ## Command line default: ./rethinkdb_data ## Init script default: /var/lib/rethinkdb/<name>/ (where <name> is the name of this file without the extension) directory=/var/lib/rethinkdb/default 重新启动systemd服务,运行sudo systemctl restart rethinkdb.service/systemctl status rethinkdb.service命令:
访问服务器IP和8080端口上的RethinkDB Web控制台:
二、从源代码构建 需要先运行以下命令更新Ubuntu 18.04系统: sudo apt update sudo apt -y upgrade 让我们重新启动以处理更新的系统: sudo reboot 1、安装构建工具 在选写本文时,Ubuntu 18.04 RethinkDB软件包没有正式的APT存储库,但是,我们将从源代码构建它,通过在终端上运行以下命令来安装所需的构建依赖项: sudo apt -y install git build-essential protobuf-compiler python libprotobuf-dev libcurl4-openssl-dev libboost-all-dev libncurses5-dev libjemalloc-dev wget m4 g++ 一般来说,你需要GCC或Clang(在Ubuntu 18.04系统中编译LLVM/Clang等全部源代码)、Protocol Buffers、jemalloc、Ncurses、Boost、Python 2、libcurl、libcrypto(OpenSSL,参考在Ubuntu 18.04下安装和使用OpenSSL 1.1.1a的方法)。 2、在Ubuntu 18.04上构建RethinkDB 我们现在准备在Ubuntu 18.04上构建RethinkDB。 下载并解压缩文件: wget https://download.rethinkdb.com/dist/rethinkdb-latest.tgz tar xvf rethinkdb-latest.tgz 将你的工作目录更改为RethinkDB源: cd rethinkdb-*/ 确保构建和安装的所有依赖项都可用: $ ./configure --allow-fetch * Reading arguments from 'configure.default' * Prepending the following arguments: --fetch re2 --fetch gtest --fetch v8 --fetch jemalloc * Detecting system configuration Bash: 4.4.19(1)-release Use ccache: no C++ Compiler: GCC 7.3.0 (/usr/bin/c++) Host System: x86_64-linux-gnu Build System: Linux 4.15.0-47-generic x86_64 Cross-compiling: no Host Operating System: Linux Build Architecture: x86_64 C++11: ok Precompiled web assets: yes Protobuf compiler: /usr/bin/protoc python: python 2.7.15 Node.js package manager: external/node_0.12.2 coffee: external/coffee-script_1.10.0 Browserify: external/browserify_13.1.0 bluebird: external/bluebird_2.9.32 web UI dependencies: external/admin-deps_2.0.3 wget: /usr/bin/wget curl: /usr/bin/curl Google Test: external/gtest_1.7.0 termcap: -ltermcap boost_system: -lboost_system protobuf: -lprotobuf v8 javascript engine: external/v8_3.30.33.16-patched2 RE2: external/re2_20140111 z: -lz crypto: external/openssl_1.0.1t ssl: external/openssl_1.0.1t curl: -lcurl malloc: jemalloc jemalloc: external/jemalloc_4.1.0 Test protobuf: ok Test boost: ok Test OpenSSL: external/openssl_1.0.1t Installation prefix: /usr/local Configuration prefix: /usr/local/etc Runtime data prefix: /usr/local/var * Wrote configuration to config.mk 配置完成后,调用make命令构建RethinkDB: make 要构建.deb包,运行: sudo apt -y install debhelper fakeroot libssl-dev make build-deb UBUNTU_RELEASE=bionic 等待构建完成然后安装软件: sudo make install 这会将RethinkDB二进制文件复制到yourPATH上的目录,将手册页复制到MANPATH上的目录,此过程需要一段时间,具体取决于系统中可用的CPU核心数。
相关主题 |