LoginSignup
2
0

More than 1 year has passed since last update.

FESS(ver13.16.0)環境の構築 for WSL2

Last updated at Posted at 2022-02-11

WSL2上にFESSの環境を構築しようと思い立った。前記事にてUbuntu20.04(WSL2)に対してDockerの環境を構築する備忘録を残した。
本記事ではDockerインストール後の環境に対して、FESSをインストールした備忘録を示す。

WSL上にDockerを構築する記事はこちら
https://qiita.com/YUKI-SOKENDAI/items/8fd0d3ab9ace6ee0c241

環境構築のバージョン

  • Elasticsearch ver7.16.2
  • FESS ver13.16.0
  • Java JDK ver11

docker composeを使って全文検索システム「FESS」を構築する方法もある。こちらの方が手軽。
https://mebee.info/2020/07/31/post-13168/

目次

  1. 開発環境
  2. インストール
    1. インストール手順
    2. Java JDKのインストール
    3. Elasticsearchのインストール
    4. Elasticsearch pluginのインストール
    5. FESSのインストール
    6. FESSの起動と動作確認
  3. セットアップ用シェルスクリプト
  4. おわりに
  5. 参考記事

開発環境

  • Windows10 home
  • Ubuntu 20.04 on WSL2

インストール

インストール手順

  1. Java JDKのインストール
  2. Elasticsearchのインストール
  3. Elasticsearch pluginのインストール
  4. FESSのインストール
  5. FESSの起動と動作確認

Java JDKのインストール

sudo apt-get install -y openjdk-11-jdk
sudo apt-get install -y openjfx

Elasticsearchのインストール

apt-getでインストールできない。apt-getのインストールリストを更新する。

# install Elasticsearch
sudo wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install -y apt-transport-https
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update

以下のコマンドを実行することでapt-getでインストール可能なelasticsearchの一覧を表示する。

sudo apt-cache madison elasticsearch

ver7.16.2もインストール可能であるはずである。
apt-getでelasticsearchをインストールする。
elasticsearch=7.16.2とするとバージョン7.16.2がインストールできる。

sudo apt-get install -y elasticsearch=7.16.2

Elasticsearch pluginのインストール

FESSを使う上でElasticsearchを使用する訳だが、使用に当たり、いくつかのプラグインが必要。Elasticsearch ver7.16.2に必要なプラグインをインストール。

sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install org.codelibs:elasticsearch-analysis-fess:7.16.0
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install org.codelibs:elasticsearch-analysis-extension:7.16.0
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install org.codelibs:elasticsearch-minhash:7.16.0

configsyncのみelasticsearch-pluginでインストールが出来なかったので、zipファイルをダウンロードし、unzipで展開した。

sudo mkdir -p /usr/share/elasticsearch/modules/configsync
sudo curl -o /usr/share/elasticsearch/modules/configsync/configsync.zip https://repo.maven.apache.org/maven2/org/codelibs/elasticsearch-configsync/7.16.0/elasticsearch-configsync-7.16.0.zip
sudo unzip /usr/share/elasticsearch/modules/configsync/configsync.zip
sudo rm /usr/share/elasticsearch/modules/configsync/configsync.zip

FESSのインストール

githubからdebファイルをcloneする。
debファイルをdpkgコマンドで展開。

wget https://github.com/codelibs/fess/releases/download/fess-13.16.0/fess-13.16.0.deb
sudo dpkg -i fess-13.16.0.deb

configファイルなどの編集

Elasticsearch

/etc/elasticsearch/elasticsearch.ymlにconfigsync.config_path: /var/lib/elasticsearch/configを追加。nanoかパイプラインで追加する。

方法1

sudo nano /etc/elasticsearch/elasticsearch.yml

方法2

echo "configsync.config_path: /var/lib/elasticsearch/config" >> /etc/elasticsearch/elasticsearch.yml

FESS

/usr/share/fess/bin/fess.in.shを編集する。

sudo nano /usr/share/fess/bin/fess.in.sh

/usr/share/fess/bin/fess.in.shを以下のように編集。

# ES_HTTP_URL=http://localhost:9200
# ES_TRANSPORT_URL=localhost:9300
FESS_DICTIONARY_PATH=/var/lib/elasticsearch/config/
FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.port=8080"

FESSの起動と動作確認

ElasticsearchとFESSの起動。
先にElasticsearchを起動する。

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo /bin/systemctl enable fess.service
sudo /bin/systemctl restart elasticsearch.service
sudo /bin/systemctl restart fess.service

ブラウザでhttp://localhost:8080/にアクセスしてみる。
FESSの画面が表示されれば環境構築完了である。

セットアップ用シェルスクリプト

以上のセットアップを行うシェルスクリプトを以下にまとめた。

# FESS installation shell scripts
# written by Y.Abe

sudo apt-get install -y unzip

# install java
sudo apt-get install -y openjdk-11-jdk
sudo apt-get install -y openjfx

# install Elasticsearch
## Updatet apt-get list
## Import the Elasticsearch PGP Keyedit
sudo wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
## Installing from the APT repositoryedit
sudo apt-get install -y apt-transport-https
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update
sudo apt-cache madison elasticsearch

# install elasticsearch ver. 7.16.2
sudo apt-get install -y elasticsearch=7.16.2

# auto booting elasticsearch after OS booting
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
# elasticsearch check
sudo systemctl start elasticsearch.service
sudo systemctl status elasticsearch.service
sudo systemctl stop elasticsearch.service


### 2022/02/09 stacked install elasticsearch plugins->Solved ###
# install elasticsearch(ver.7.16.2) plugins for FESS(ver.13.16.0)
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install org.codelibs:elasticsearch-analysis-fess:7.16.0
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install org.codelibs:elasticsearch-analysis-extension:7.16.0
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install org.codelibs:elasticsearch-minhash:7.16.0

#sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install org.codelibs:elasticsearch-configsync:7.16.0
sudo mkdir -p /usr/share/elasticsearch/modules/configsync
sudo curl -o /usr/share/elasticsearch/modules/configsync/configsync.zip https://repo.maven.apache.org/maven2/org/codelibs/elasticsearch-configsync/7.16.0/elasticsearch-configsync-7.16.0.zip
sudo unzip /usr/share/elasticsearch/modules/configsync/configsync.zip
sudo rm /usr/share/elasticsearch/modules/configsync/configsync.zip

#sudo nano /etc/elasticsearch/elasticsearch.yml
echo "configsync.config_path: /var/lib/elasticsearch/config" >> /etc/elasticsearch/elasticsearch.yml

# install FESS ver.13.16.0
wget https://github.com/codelibs/fess/releases/download/fess-13.16.0/fess-13.16.0.deb
sudo dpkg -i fess-13.16.0.deb

# edit FESS config file
sudo nano /usr/share/fess/bin/fess.in.sh
## # ES_HTTP_URL=http://localhost:9200
## # ES_TRANSPORT_URL=localhost:9300
## FESS_DICTIONARY_PATH=/var/lib/elasticsearch/config/
## FESS_JAVA_OPTS="$FESS_JAVA_OPTS -Dfess.port=8080"
# read config file
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo /bin/systemctl enable fess.service
sudo /bin/systemctl restart elasticsearch.service
sudo /bin/systemctl restart fess.service

おわりに

本記事ではWSL2上のUbuntu 20.04にFESSのインストール、環境構築を行う備忘録を残した。FESSはバージョン7.16.2、Elasticsearchはバージョン13.10.0を使用した。別記事でdocker-composeを使ったFESSの環境構築方法なども紹介されている。そちらも参考にすると良いと思う。

本記事にて示した方法に不備、間違いがあればじゃんじゃんコメントください。

参考記事

  1. Ubuntu 18.04 に Fess 13.7 をインストールしてみる
  2. Elasticsearchの簡単インストール【Ubuntu 20.04】
  3. FESSとElasticsearchのバージョン
  4. FESSインストール
  5. Ubuntu 18.04 に fess をインストールする
  6. Elasticsearch plugins
  7. Elasticsearch pluginsインストール
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0