Introduced GROWI to Raspberry Pi 4 Model B (Ubuntu)

Introduction

This article summarizes the work procedure when GROWI was previously built as a private Wiki on Raspberry Pi 4 Model B (hereinafter RP4B). The introduction using the official Docker image didn't work, so I tried it manually.

The initial setup of RP4B itself is not treated in this article as it is assumed to have been completed in advance.

environment

In this article, we assume the following for various network addresses.

--The IP address range of the local network is 192.168.1.0/24. --The IP address of the target RP4B is 192.168.1.10.

Reference page

-GROWI Official Document -RP3 Elasticsearch case study -Elasticsearch official document

nodejs

(I have a vague memory around here) Basically, if you follow the procedure of Official document It should have been good. However, since GROWI 3.6 or later, the version of nodejs needs to be 10.x or 12.x, so read only that.

$ cd ~
$ curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
$ sudo bash nodesource_setup.sh
$ sudo apt install nodejs
$ sudo npm install -g yarn #Global installation

If nodejs setup is successful, the following files will be created and the repository will be added.

:/etc/apt/sources.list.d/nodesource.list


deb https://deb.nodesource.com/node_12.x eoan main
deb-src https://deb.nodesource.com/node_12.x eoan main

Elasticsearch

I did it with reference to here.

First, introduce Java.

$ sudo apt install openjdk-8-jre

If you have multiple versions of Java installed, switch with the following command (may not be necessary) (Reference site: http://note.kurodigi.com/post-0-2/)

$ sudo update-alternatives -config java
#The installed versions are listed.
#Enter the version number you want to use and press Enter.

Download the Elasticsearch archive file and extract it. Check the Official site for the version to be installed, and make it the latest version of the 6.x series. Goodness.

Elasticsearch [trap that cannot be started by root user](https://confluence.atlassian.com/bitbucketserverkb/when-using-the-root-user-elasticsearch-cannot-be-started-due-to-don-t- There is run-elasticsearch-as-root-847751401.html). Therefore, it seems better to extract it under the home directory of a user other than the appropriate root. This time, it was expanded as /home/{username}/.local/elasticsearch-6.8.8/.

$ cd ~
$ mkdir .local
$ chmod 755 .local
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.8.tar.gz
$ tar zxvf elasticsearch-6.8.8.tar.gz -C .local
$ cd .local
$ ln -s elasticsearch-6.8.8 elasticsearch #Create symbolic links
$ echo "xpack.ml.enabled: false" >> elasticsearch/config/elasticsearch.yml # X-Disable Pack Machine Learning as it does not work under ARM environment.

Test the operation.

$ cd ~
$ cd .local/elasticsearch
$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64
$ ./bin/elasticsearch & #Start as a background process
$ curl http://localhost:9200

Service conversion

Register as a service by referring to here. First, create an elasticsearch.service file with su privileges.

/etc/systemd/system/elasticsearch.service


[Unit]
After=syslog.target network.target

[Service]
Environment="JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64"
ExecStart=/home/{username}/.local/elasticsearch/bin/elasticsearch
WorkingDirectory=/home/{username}/.local/elasticsearch
User={username}
Group={groupname}
Nice=10
SyslogIdentifier=Elasticsearch
StandardOutput=syslog
Restart=on-failure
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target

After confirming that it can be started, set automatic start.

$ sudo systemctl start elasticsearch  #Manual startup
$ sudo systemctl status elasticsearch #Check if it is working properly
$ sudo systemctl enable elasticsearch #Autostart settings

Plug-in introduction

$ cd ~
$ cd .local/elasticsearch
$ bin/elasticsearch-plugin install analysis-kuromoji
$ bin/elasticsearch-plugin install analysis-icu
$ ls -la plugin #Check the DL plug-in
$ sudo systemctl restart elasticsearch #Reboot

MongoDB

$ sudo apt install mongodb-server
$ sudo systemctl start mongodb
$ sudo systemctl status mongodb
$ sudo systemctl enable mongodb

GROWI

Follow the steps in Official Documentation. Note that it will take some time to build.

$ cd /opt
$ sudo git clone https://github.com/weseek/growi /opt/growi
$ cd /opt/growi
$ sudo git tag -l #Check the latest version without RC
$ sudo git checkout -b v3.7.5 refs/tags/v3.7.5 #Check out by branching from tag
$ sudo yarn #It took about 12 minutes

Test the operation. After starting, use ctrl + z to create a background process and check.

$ sudo ufw allow from 192.168.1.0/24 to any port 3000 #Open port 3000 on your local network
$ sudo \
  MONGO_URI=mongodb://localhost:27017/growi \
  ELASTICSEARCH_URI=http://localhost:9200/growi \
  npm start
#Wait until the following message is displayed (it takes some time)
> [email protected] server:prod /opt/growi
> env-cmd -f config/env.prod.js node src/server/app.js

Try accessing http://192.168.1.10:3000/ and check if the initial setup screen is displayed.

Service conversion

Please refer to the Official Document and read it appropriately. First, create a growi.service file with su privileges. File upload should be MongoDB GridFS.

/etc/systemd/system/growi.service


[Unit]
Description=Growi
After=network.target mongodb.service elasticsearch.service

[Service]
WorkingDirectory=/opt/growi
Environment=PORT=3000 \
            MONGO_URI=mongodb://localhost:27017/growi \
            ELASTICSEARCH_URI=http://localhost:9200/growi \
            FILE_UPLOAD=mongodb \
            MATHJAX=1
ExecStart=/usr/bin/npm start

[Install]
WantedBy=multi-user.target

After confirming that it can be started, set automatic start.

$ sudo systemctl start growi
$ sudo systemctl status growi
$ sudo systemctl enable growi

Plug-in introduction

[Official Documents](https://docs.growi.org/ja/admin-guide/management-cookbook/app-settings.html#%E3%83%97%E3%83%A9%E3%82%B0% E3% 82% A4% E3% 83% B3% E8% A8% AD% E5% AE% 9A) and proceed while checking the plugin GitHub. It takes a lot of time.

$ sudo npm install --save growi-plugin-lsx
$ sudo npm install --save growi-plugin-pukiwiki-like-linker
$ cd /opt/growi
$ sudo systemctl stop growi
$ sudo yarn
$ sudo systemctl start growi

Recommended Posts

Introduced GROWI to Raspberry Pi 4 Model B (Ubuntu)
Install Ubuntu Core 18 on Raspberry Pi 2 Model B
Install CentOS 7 on Raspberry pi 4 Model B
Serially connect to Ubuntu on Raspberry Pi
Put Ubuntu 20.04.1 on Raspberry Pi 4
Put Redmine docker container in Raspberry Pi 4 Model B 2GB
20.10 is better than 20.04 for USB booting Ubuntu on Raspberry Pi 4B
Headless install of Ubuntu 20.10 on Raspberry Pi
I couldn't install docker with raspberry pi2 b +.
[Raspberry Pi] Try to link Apache2 and Tomcat
Just plug in the storage and power to run the Raspberry Pi (Ubuntu Server Edition)
Build Ubuntu 20.04 LTS desktop environment on Raspberry Pi 4 (+ Japanese)
How to run javafx with Raspberry Pi Posted on 2020/07/12