Ubuntu24.04LTSにGROWIをインストールする方法をメモする。
参考サイトにしたサイトの方法だと躓くポイントがあったので、もううまくいったコマンド全部ここに残しておこうかなと。
インストール過程で使うgitとcurlをインストール。
sudo apt update && sudo apt -y install git curl
node.js 20.x & npm のインストール
curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
node.jsをインストール
sudo apt -y install nodejs
pnpmコマンドをインストール
sudo npm install -g pnpm
pnpmでturboをインストールする。
pnpm install turbo --global
ここまでで一度、必要なものがインストールできたか確認する。
nodejs -v
npm -v
pnpm -v
turbo --version
Elasticsearch
JDK17 をインストール
sudo apt -y install openjdk-17-jdk
Elasticsearch レポジトリの GPG キーを追加
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
Elasticsearch のレポジトリを追加する。
sudo echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/9.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-9.x.list
elasticsearchをインストールする。
sudo apt update && sudo apt -y install elasticsearch
パスワードが表示されるのでメモしておこう。
--------------------------- Security autoconfiguration information ------------------------------
Authentication and authorization are enabled.
TLS for the transport and HTTP layers is enabled and configured.
The generated password for the elastic built-in superuser is : *******
Elasticsearch に割り当てるメモリを調整する。
sudo nano /etc/elasticsearch/jvm.options
IMPORTANT: JVM heap size のコメントブロックの後に以下を追記
参考サイトが1GB指定だったので、とりあえず真似ておく。
-Xms1G
-Xmx1G
TLS の無効化
/etc/elasticsearch/elasticsearch.ymlを編集し、3箇所をtrueからfalseに変更する。該当項目がないならファイルの最後に追記する。
sudo nano /etc/elasticsearch/elasticsearch.yml
# Enable security features
-xpack.security.enabled: true
+xpack.security.enabled: false
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
- enabled: true
+ enabled: false
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
- enabled: true
+ enabled: false
GROWI に必要な Elasticsearch プラグインのインストール
まずはコマンドを検索する
dpkg -L elasticsearch | grep bin | grep plugin
出力されたコマンドを利用して、 analysis-kuromoji plugin と analysis-icu plugin をインストール
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-kuromoji
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu
Elasticsearch の起動と自動起動設定の有効化
sudo systemctl enable --now elasticsearch
MongoDB
MongoDB 公開 GPG キーをインポート
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor
リスト ファイルを作成
※Ubuntuのバージョンで違うようなので24.04以外は調べて
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.2.list
パッケージデータベースをリロード
sudo apt-get update
MongoDB Community Server をインストール
sudo apt-get install -y mongodb-org
systemctl コマンドを使って、MongoDB の自動起動設定を有効化
sudo systemctl enable --now mongod
GROWI
/opt/growi 配下にインストールする<username>
と <usergroup>
は適宜変更
sudo mkdir -p /opt/
sudo chown <username>:<usergroup> /opt/
cd /opt/
git clone https://github.com/growilabs/growi growi
cd growi
バージョン確認して最新版を利用する
git tag --sort=-version:refname | head -10
git checkout -b v7.3.3 refs/tags/v7.3.3
GROWI に必要なパッケージをインストール
pnpm install
ビルド
pnpm run app:build
systemdによる自動起動の設定
/etc/systemd/system/にgrowi.serviceを追加する。
sudo nano /etc/systemd/system/growi.service
growi.serviceの中身は以下
[Unit]
Description=Growi
After=network.target mongod.service
[Service]
WorkingDirectory=/opt/growi
Environment=PORT=3000\
MONGO_URI=mongodb://localhost:27017/growi\
ELASTICSEARCH_URI=http://localhost:9200/growi
ExecStart=/usr/bin/npm run app:server
[Install]
WantedBy=multi-user.target
GROWIの起動
sudo systemctl start growi
自動起動の有効化
sudo systemctl enable growi
起動の確認
sudo MONGO_URI=mongodb://localhost:27017/growi ELASTICSEARCH_URI=http://localhost:9200/growi
pnpm app:server
以下のようなメッセージが出ると成功
{"name":"growi:crowi","hostname":"growi-server","pid":29259,"level":30,"msg":"[production] Express server is listening on port 3000","time":"2025-10-18T10:59:35.500Z","v":0}
ブラウザを使って「http://localhost:3000」にアクセスし、初回セットアップが表示されるか確認する。