如何在 AlmaLinux 8 上安裝 Etherpad

在本教程中,我們將向您展示如何在 AlmaLinux 8 上安裝 Etherpad。對於那些不知道的人,EtherPad 是一個基於 Web 的實時協作文本編輯器,多人可以在其中在線協作處理一個文檔。 . 它是用 Node.js 編寫的,可以自託管以與 WordPress、Drupal、Odoo、Joomla 等各種平台一起使用。

本文假設您至少對 Linux 有基本的了解,您知道如何使用 shell,最重要的是,您在自己的 VPS 上託管您的站點。 安裝非常簡單,它假定您在 root 帳戶下運行,如果不是,您可能需要添加 'sudo' 獲取 root 權限的命令。 我將向您展示如何在 AlmaLinux 8 上逐步安裝開源在線編輯器 Etherpad。對於 CentOS 和 Rocky Linux,您可以按照相同的說明進行操作。

在 AlmaLinux 8 上安裝 Etherpad

第 1 步。首先,讓我們首先確保您的系統是最新的。

sudo dnf update
sudo dnf install epel-release

步驟 2. 在 AlmaLinux 8 上安裝 Git。

Git 在默認的 Almalinux 存儲庫中可用。 現在運行以下命令來安裝它:

sudo dnf install git

通過運行以下命令確認安裝並檢查版本:

git --version

接下來,添加初始配置:

git config --global user.name "YourName"
git config --global user.email "[email protected]"

步驟 3. 在 AlmaLinux 8 上安裝 MariaDB。

MariaDB 是一種流行的數據庫服務器。 現在我們使用以下命令安裝 MariaDB 數據庫服務器:

sudo dnf install mariadb-server mariadb

安裝完成後,開始使用以下命令使其在系統啟動時啟動:

sudo systemctl restart mariadb
sudo systemctl status mariadb
sudo systemctl enable mariadb

默認情況下,MariaDB 未加固。 您可以使用以下方法保護 MariaDBmysql_secure_installation文本。 您應該仔細閱讀下面的每個步驟,這將設置 root 密碼、刪除匿名用戶、禁止遠程 root 登錄、刪除測試數據庫並訪問安全的 MariaDB:

mysql_secure_installation

像這樣設置:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

要登錄 MariaDB,請使用以下命令(請注意,這與您用來登錄 MariaDB 數據庫的命令相同):

mysql -u root -p

現在我們為 Etherpad 創建一個新的數據庫:

create database `etherpad_db`;
CREATE USER 'etherpaduser'@'localhost' identified by 'your-strong-password';
grant CREATE,ALTER,SELECT,INSERT,UPDATE,DELETE on `etherpad_db`.* to '<etherpaduser>'@'localhost';
exit

步驟 4. 在 AlmaLinux 8 上安裝 Etherpad。

首先,我們使用以下命令創建一個新的 Etherpad 用戶:

sudo adduser --system --home /opt/etherpad --create-home --user-group etherpad

接下來,我們將二進製文件克隆到/opt/etherpad一個目錄:

cd /opt/etherpad
git clone --branch master git://github.com/ether/etherpad-lite.git
cd etherpad-lite

最後,運行安裝腳本:

src/bin/run.sh

步驟 5. 配置 Etherpad。

Etherpad 將其配置存儲在settings.json安裝目錄中的文件,我們需要設置一些設置並配置它:

nano settings.json

找到以下代碼並將其註釋掉//在它前面:

//  "dbType": "dirty",
//  "dbSettings": {
//    "filename": "var/dirty.db"
//  },

接下來,找到下面的代碼並將其值更改如下。 一定要刪除/**/在開頭和結尾:

"dbType" : "mysql",
  "dbSettings" : {
  "user":     "etherpaduser",
  "host":     "localhost",
  "port":     3306,
  "password": "your-strong-password",
  "database": "etherpad_db",
  "charset":  "utf8mb4"
  },

之後,向下滾動一點找到trustProxy設置和更改其值false為了true:

"trustProxy": true,

步驟 6. 創建 Etherpad 服務。

現在我們創建一個 Etherpadsystemd服務文件:

sudo nano /etc/systemd/system/etherpad.service

添加以下行:

[Unit]
Description=Etherpad, a collaborative web editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad
Environment=NODE_ENV=production
ExecStart=/usr/bin/node --experimental-worker /opt/etherpad/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js
Restart=always

[Install]
WantedBy=multi-user.target

保存並關閉文件,然後啟動 Etherpad 服務:

sudo systemctl daemon-reload
sudo systemctl enable etherpad --now

步驟 7. 配置防火牆

不要忘記在防火牆中允許端口:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=9001/tcp

步驟 8. 訪問 Etherpad Web 界面。

成功安裝後,打開您喜歡的瀏覽器並導航至https://your-ip-address:9001. 您將看到以下屏幕:

恭喜! 您已成功安裝 Etherpad。 感謝您使用本教程在您的 AlmaLinux 8 系統上安裝基於 Web 的 Etherpad 協作在線文檔編輯器。有關其他幫助或有用信息,我們建議您參考官方網站.

相關文章