ArangoDB 是一个开源 NoSQL 数据库,具有开源年份和灵活的文档、键值和图形数据模型。使用集成的 Web 界面或命令行界面可以轻松管理该数据库。
步骤 1. 首先,通过apt
在终端中运行以下命令确保所有系统包都是最新的。
sudo apt update sudo apt upgrade sudo apt install curl apt-transport-https
步骤 2. 在 Ubuntu 20.04 上安装 ArangoDB。
现在运行以下命令将 apt 存储库添加到您的系统:
echo \'deb https://download.arangodb.com/arangodb34/DEBIAN/ /\' | sudo tee /etc/apt/sources.list.d/arangodb.list
接下来,导入用于对包进行签名的 GPG 密钥:
wget -q https://download.arangodb.com/arangodb34/DEBIAN/Release.key -O- | sudo apt-key add -
之后,我们可以使用以下命令安装 ArangoDB 软件:
sudo apt update sudo apt install arangodb3
如果您在安装过程中没有设置 root 密码,您可以在安装后通过运行来保护 ArangoDB:
sudo arango-secure-installation
安装完成后,启动 ArangoDB 服务并使用以下命令使其在系统重新启动时启动:
sudo systemctl start arangodb3 sudo systemctl enable arangodb3
步骤 3. 访问 ArangoDB Shell。
ArangoDB 带有一个命令行实用程序来管理数据库。您可以使用以下命令连接 ArangoDB shell:
arangosh
输出:
$ arangosh Please specify a password: _ __ _ _ __ __ _ _ __ __ _ ___ ___| |__ / _` | \'__/ _` | \'_ \\ / _` |/ _ \\/ __| \'_ \\ | (_| | | | (_| | | | | (_| | (_) \\__ \\ | | | \\__,_|_| \\__,_|_| |_|\\__, |\\___/|___/_| |_| |___/ arangosh (ArangoDB 3.4.9 [linux] 64bit, using jemalloc, build tags/v3.4.9-0-g1001202f8, VPack 0.1.33, RocksDB 5.16.0, ICU 58.1, V8 5.7.492.77, OpenSSL 1.1.0l 20 May 2021) Copyright (c) ArangoDB GmbH Command-line history will be persisted when the shell is exited. Connected to ArangoDB \'http+tcp://127.0.0.1:8529\' version: 3.4.9 [SINGLE, server], database: \'_system\', username: \'root\' Type \'tutorial\' for a tutorial or \'help\' to see common examples 127.0.0.1:8529@_system>
现在,使用以下命令创建一个名为 mydb 的数据库:
127.0.0.1:8529@_system> db._createDatabase(\"mydb\");
接下来,使用以下命令创建数据库用户:
127.0.0.1:8529@_system> var users = require(\"@arangodb/users\"); 127.0.0.1:8529@_system> users.save(\"myuser@localhost\", \"your-strong-password\");
输出:
{ \"user\" : \"myuser@localhost\", \"active\" : true, \"extra\" : { }, \"code\" : 201 }
接下来,使用以下命令授予 mydb 数据库的所有权限:
127.0.0.1:8529@_system> users.grantDatabase(\"myuser@localhost\", \"mydb\");
现在,使用以下命令退出 ArangoDB shell:
127.0.0.1:8529@_system> exit
步骤 4. 访问 ArangoDB Web 界面。
ArangoDB 服务器带有用于管理的内置 Web 界面。它使您可以管理数据库、集合、文档、用户、图形、运行和解释查询、查看服务器统计信息等等。您可以通过编辑文件来配置它:/etc/arangodb3/arangod.conf
nano /etc/arangodb3/arangod.conf
找到以下行:
endpoint = tcp://127.0.0.1:8529
并将其替换为以下行:
endpoint = tcp://your-server-ip-address:8529
进行此更改后重新启动 ArangoDB 服务:
sudo systemctl restart arangodb3
现在打开您的网络浏览器并转到,您将看到以下内容:http://your-server-ip-address:8529
感谢您使用本教程在 Ubuntu 20.04 LTS Focal Fossa 系统上安装 ArangoDB。如需更多帮助或有用信息,我们建议您查看官方 ArangoDB 网站。