在 CentOS 7 上安装开源 Wiki「Crowi」

乌鸦

系统需求

需要

    • Node.js (6.x)

 

    MongoDB

选择

    • Elasticsearch

 

    • Redis

 

    • Amazon S3

 

    • Google Project

 

    Slack App

系统配置示例

    • CentOS 7.3.1611 (minimal)

Node.js 6.10.2 (nodesource)
MongoDB 3.4.4 (mongodb-org-3.4)

请将其安装

更新

yum clean all && yum -y update && reboot

Node.js 可以被理解为一个运行在服务器端的 JavaScript 运行环境。

curl -sL https://rpm.nodesource.com/setup_6.x | bash - && yum -y install nodejs

MongoDB 是一种非关系型数据库管理系统。

cat << "_EOF_" > /etc/yum.repos.d/mongodb.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
_EOF_
yum -y install mongodb-org && systemctl start mongod && systemctl enable $_

Redis:重定向

yum -y install epel-release && yum -y install redis && systemctl start $_ && systemctl enable $_

弹性搜索

cat << "_EOF_" > /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
_EOF_
yum -y install elasticsearch && systemctl start $_ && systemctl enable $_

乌鸦

yum -y install git gcc-c++ krb5-devel
useradd crowi && su - crowi
git clone https://github.com/crowi/crowi.git && cd crowi
git checkout $(git tag | tail -n 1)
npm install
exit

如果没有安装 krb5-devel,将会出现致命错误: gssapi/gssapi.h: 找不到该文件或目录。

echo 'use crowi' | mongo
mongo crowi --eval 'db.createUser({user: "crowi", pwd: "P@ssw0rd", roles: [{role: "readWrite", db: "crowi"}]})'
mongo admin --eval "db.system.users.find()"
cat << "_EOF_" > /etc/systemd/system/crowi.service
[Unit]
Description=Crowi
After=network.target mongod.service

[Service]
WorkingDirectory=/home/crowi/crowi
EnvironmentFile=/etc/sysconfig/crowi
ExecStart=/usr/bin/node app.js

[Install]
WantedBy=multi-user.target
_EOF_
cat << _EOF_ > /etc/sysconfig/crowi
PORT=3000
NODE_ENV=production
MONGO_URI="mongodb://crowi:P%40ssw0rd@localhost/crowi"
REDIS_URL="redis://localhost:6379"
ELASTICSEARCH_URI="http://localhost:9200"
#SECRET_TOKEN=
PASSWORD_SEED="`openssl rand -base64 128 | head -1`"
FILE_UPLOAD=local
_EOF_

如果密码包含 @ 符号,则需要将其替换为 %40。

systemctl daemon-reload && systemctl start crowi && systemctl enable $_
firewall-cmd --add-port=3000/tcp
setenforce 0
广告
将在 10 秒后关闭
bannerAds