Installing crowi-plus on AWS from scratch Amazon Linux.
This is just a reference. Check the available versions of the middlewares.
Installation Steps:
1. Install and run MongoDB
2. Install and run redis
3. Install Java8
4. Install elasticsearch
5. Install git
6. Install node.js(npm, yarn)
7. Build and run crowi-plus
Environment:
AWS EC2 t2.micro
1 2 3 4 5 6 7 8 9 10 |
$ cat /etc/os-release NAME="Amazon Linux AMI" VERSION="2017.03" ID="amzn" ID_LIKE="rhel fedora" VERSION_ID="2017.03" PRETTY_NAME="Amazon Linux AMI 2017.03" ANSI_COLOR="0;33" CPE_NAME="cpe:/o:amazon:linux:2017.03:ga" HOME_URL="http://aws.amazon.com/amazon-linux-ami/" |
Install MongoDB
1 2 |
$ sudo vi /etc/yum.repos.d/mongodb.repo $ sudo yum install -y mongodb-org |
mongodb.repo must be like below; official won’t work as variable $releasver is not set properly.
1 2 3 4 5 6 |
[mongodb-org-3.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/6/mongodb-org/3.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc |
Start MongoDB
1 |
$ sudo /etc/init.d/mongod start |
Install Redis
1 2 |
$ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm $ sudo yum --enablerepo=remi -y install redis |
Start redis
1 |
$ sudo /etc/init.d/redis start |
Install Java8
1 |
$ sudo yum install -y java-1.8.0-openjdk |
Change default java
1 2 |
$ sudo mv /etc/alternatives/java /etc/alternativees/java7 $ sudo ln -s /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java /etc/alternatives/java |
Check java version
1 2 3 4 |
$ java -version openjdk version "1.8.0_141" OpenJDK Runtime Environment (build 1.8.0_141-b16) OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode) |
Install elasticsearch
1 2 |
$ sudo rpm -i https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.rpm $ sudo chkconfig --add elasticsearch |
Setup elasticsearch
set initial and max heap as the system requires. ( on my ridiculously small server I set both values to 256m. Defaults are both 2g. )
1 |
$ sudo vi /etc/elasticsearch/jvm.options |
Start elasticsearch
1 |
$ sudo /etc/init.d/elasticsearch start |
Install elasticsearch plug-ins
1 2 |
$ sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-kuromoji $ sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu |
Restart elasticsearch
1 |
$ sudo /etc/init.d/elasticsearch restart |
Install git
1 |
$ sudo yum install -y git |
Install node.js
1 2 3 4 5 6 7 8 |
$ git clone https://github.com/creationix/nvm.git ~/.nvm $ . ~/.nvm/nvm.sh $ sudo ./.nvm/install.sh $ nvm ls-remote #インストール可能なnode.jsのバージョンの確認 $ nvm install 6.11.3 $ node -v v6.11.3 $ vi ~/.bash_profile #. ~/.nvm/nvm.shを最後に追加 |
npmのアップデート
1 2 3 4 5 6 |
$ npm -v 3.10.10 $ npm install -g npm $ npm -v 5.4.1 $ npm install -g options@latest |
yarnのインストール
1 2 3 |
$ npm install -g yarn $ yarn -v 1.0.1 |
スワップ領域を作成
1 2 3 4 |
$ sudo dd if=/dev/zero of=/swapfile1 bs=2M count=1024 $ sudo chmod 600 /swapfile1 $ sudo mkswap /swapfile1 $ sudo swapon /swapfile1 |
gitからcrowi-plusを取得してビルドと起動
1 2 3 4 5 6 7 |
$ git clone https://github.com/weseek/crowi-plus.git $ cd ~/crowi-plus $ yarn $ export MONGO_URI=mongodb://localhost:27017/crowi $ export REDIS_URL=redis://localhost:6379/crowi $ export ELASTICSEARCH_URI=http://localhost:9200/crowi $ npm start & |
References:
最強のWiki「Crowi」のフォーク、「crowi-plus」を公開した話
crowi-plusをEC2(t2.micro)で動かす