Archlinux 安装软件之 Arango

最近想要使用 arango 代替以前的 mongo 数据库,但是一直安装不成功。原因是 AUR 的PKGBUILD中的sha256sums错误了,而且还是比较旧的版本。

最后自己手动安装搞定的

安装

1. 创建一个项目文件夹

1
mkdir arango && cd arango

2. 获取 deb 包

1
aria2c -x15 -j15 -s5 -c https://download.arangodb.com/arangodb35/DEBIAN/amd64/arangodb3_3.5.3-1_amd64.deb --all-proxy="http://127.0.0.1:12333"

3. 获取 sha256sums

1
sha256sum arangodb3_3.5.3-1_amd64.deb

编写 PKGBUILD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Maintainer: dilipvamsi <m.dilipvamsi at gmail dot com>

_pkgname='arangodb'
pkgname="${_pkgname}-bin"
pkgdesc="Arangodb binary from deb."
pkgver=3.5.3
pkgrel=1
_pkgver='3.5.3-1'
arch=('x86_64')
url="https://www.arangodb.com/"
license=('APACHE')
provides=(${_pkgname})
conflicts=(
"${_pkgname}"
"${_pkgname}-client-bin"
)
source=(
https://download.arangodb.com/arangodb34/Community/Linux/arangodb3_${_pkgver}_amd64.deb
)
validpgpkeys=("CD8CB0F1E0AD5B52E93F41E7EA93F5E56E751E9B") # Frank Celler (ArangoDB Debian Repository) <info@arangodb.com>
# 手动生成一次 sha256sum
sha256sums=(
25b63ff6cd9dc97c270d46dfce0ca621c0de82d1d2cd03b20260c424418f3ad3
)

install=arangodb.install
package() {
msg2 "Extracting the data.tar.gz..."
tar -xf "data.tar.gz" -C $pkgdir

msg2 "Removing /etc/init.d"
rm -r $pkgdir/etc/init.d

msg2 "Moving all binaries from /usr/sbin to /usr/bin and then removing it"
mv $pkgdir/usr/sbin/* $pkgdir/usr/bin
rmdir $pkgdir/usr/sbin

msg2 "Changing /usr/sbin to /usr/bin in arangodb3.service"
sed -i 's/\/usr\/sbin/\/usr\/bin/g' $pkgdir/lib/systemd/system/arangodb3.service

msg2 "Moving /lib to /usr/lib"
mv $pkgdir/lib $pkgdir/usr
}

编写arangodb.install

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
pre_install() {

set -e
getent group arangodb >/dev/null || groupadd -r arangodb
getent passwd arangodb >/dev/null || useradd -r -g arangodb -d /usr/share/arangodb3 -s /bin/false -c "ArangoDB Application User" arangodb

# check if the arangodb group was added locally in /etc/group
# if not, then the arangod binary will very likely try to open a socket
# connection to nscd to query the group information from there.
# if there is no nscd running, starting the arangod binary will fail
(grep -q "^arangodb:" /etc/passwd && grep -q "^arangodb:" /etc/group) || (nscd -g >/dev/null 2>&1) || cat 1>&2 <<EOF
################################################################################
Unable to query nscd service for user or group 'arangodb'. As a consequence, it
is very likely that installing or starting the arangod server will fail because
it can neither find user/group 'arangodb' in /etc/passwd or /etc/group nor via
an nscd group lookup.

Please install 'nscd' before installing the arangodb package.
################################################################################
EOF

install -o arangodb -g arangodb -m 755 -d /var/lib/arangodb3
install -o arangodb -g arangodb -m 755 -d /var/lib/arangodb3-apps
install -o arangodb -g arangodb -m 755 -d /var/log/arangodb3

}

post_install() {

cat << EOF

Welcome to ArangoDB.

To get started you will need to tell systemd to reload it's unit
files, then enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable arangodb3.service
sudo systemctl start arangodb3.service

ArangoDB 3 ships with authentication enabled. To use it you will need
to start the server with 'authentication = false' in the following
files:

/etc/arangodb3/arangosh.conf
/etc/arangodb3/arangod.conf

Then set the passwords and create the users you need:

$> arangosh
127.0.0.1:8529@_system> require("org/arangodb/users").update("root",
"mypassword")
127.0.0.1:8529@_system> require("org/arangodb/users").save("myuser",
"mypassword");

Set the 'authentication = true' and then restart ArangoDB:

sudo systemctl restart arangodb3.service

You can now use your username and password to access the
administrative interface at:

http://localhost:8529

ArangoDB now works with logrotate:

sudo logrotate /etc/logrotate.d/arangodb3

Getting help:
http://stackoverflow.com/questions/tagged/arangodb
https://arangodb-community.slack.com
https://docs.arangodb.com/cookbook
https://docs.arangodb.com

EOF

}

post_upgrade() {

cat << EOF

ArangoDB has been upgraded to $1.

Take a look at the Changelog to see what is new:
https://github.com/arangodb/arangodb/blob/devel/CHANGELOG

EOF

}

pre_remove() {
systemctl stop arangodb3.service
}

post_remove() {

cat <<EOF

ArangoDB has been uninstalled.

Any data you had stored in ArangoDB is still available in /var/lib/arangodb3.
Installed Foxx applications are still available in /var/lib/arangodb3-apps.
Log files are left in /var/log/arangodb3.

EOF

}

安装

1
makepkg -si

/etc/arangodb3/arangosh.conf/etc/arangodb3/arangod.conf中的authentication = true给为authentication = false,进行免验证登录

设置密码

1
2
3
$> arangosh
127.0.0.1:8529@_system> require("org/arangodb/users").update("root","mypassword")
127.0.0.1:8529@_system> require("org/arangodb/users").save("myuser","mypassword");

authentication = false改回authentication = true,并重启一下服务

1
sudo systemctl restart arangodb3.service

再次使用arangosh登录即可


Archlinux 安装软件之 Arango
https://bubao.github.io/posts/a6c5735f.html
作者
一念
发布于
2019年12月11日
许可协议