Jump to content
View in the app

A better way to browse. Learn more.

PHP论坛人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

安裝 Elasticsearch 8.17 強化中文搜尋 (Invision Community 5.0.5 開始採用新版本)

Featured Replies

 

自 Invision Community 5.0.5 起,搜尋功能需使用 Elasticsearch 8.0 ~ 9.0 版本

------------------------------------------------------------
安裝套件、依賴包
------------------------------------------------------------

檢查是否已有Java
which java

java -version



安裝 Java
apt update

apt install -y default-jdk



安裝必要的依賴包
apt install -y wget gnupg apt-transport-https



確認版本,已安裝 openjdk version "21.0.9" 2025-10-21
java -version




------------------------------------------------------------
安裝 Elasticsearch
------------------------------------------------------------


Elasticsearch官網 歷史版本
https://www.elastic.co/downloads/past-releases/


IPS論壇後端有寫,Invision Community 5.0.5 至少執行 Elasticsearch 8.0 ~ 9.0版本


下載 elasticsearch 8.17.4
wget  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.17.4-amd64.deb


安裝
dpkg -i elasticsearch-8.17.4-amd64.deb



啟用服務,注意:Elasticsearch第一次啟動可能需要幾分鐘
systemctl daemon-reload

systemctl enable elasticsearch

systemctl start elasticsearch



---------------------------------------
查詢RAM占用情況
---------------------------------------

free -h

1.VPS 4C/8G RAM
Mem:  5G used (elasticsearch已占用5GB RAM)

2.VPS 2C/2G RAM
Mem:  1.8G used



---------------------------------------
修改設定檔
---------------------------------------

修改 elasticsearch.yml
vi /etc/elasticsearch/elasticsearch.yml


建議設定 (小論壇、單機)

#network.host: 192.168.0.1
修改為
network.host: 127.0.0.1



# http.port: 9200
修改為
http.port: 9200



若你確定只在localhost 本機使用,則可以關閉

搜尋
xpack.security.enabled: true
改為
xpack.security.enabled: false





ESC儲存並離開
:wq






------------------
調整 JVM 記憶體
------------------

建立自訂 JVM 設定檔
vi /etc/elasticsearch/jvm.options.d/RAM.options


小論壇可依需求調整,通常建議 Xms 與 Xmx 設為相同值

-Xms128m
-Xmx128m





ESC儲存並離開
:wq





---------------------------------------
重新啟動 Elasticsearch 並測試
---------------------------------------

重新啟動
systemctl restart elasticsearch


確認狀態
systemctl status elasticsearch


重開機
reboot




重開機後,確認Elasticsearch是否正常
systemctl status elasticsearch


curl http://127.0.0.1:9200


成功應回傳包含 "tagline" : "You Know, for Search" 的 JSON 訊息




---------------------------------------
查詢RAM占用情況
---------------------------------------

free -h

1.VPS 4C/8G RAM
Mem:  2.1 G used (elasticsearch已占用2GB RAM)

2.VPS 2C/2G RAM
Mem:  1.2G used





移除 Elasticsearch (更換版本用)

systemctl stop elasticsearch

dpkg -r elasticsearch

重開機,回到上面的教學,再安裝Elasticsearch其他版本
reboot

Edited by Jack

Create an account or sign in to comment

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.