Etherpad 是一套網頁版即時協作編輯器。三四個人各自坐在自己的電腦前,卻能同時編輯同一份文件,而且彼此的修改會即時呈現、以不同顏色區分,非常適合會議記錄與共同起草。
yum install curl vim gcc-c++ make
yum install mariadb-server
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
首次安裝時 root 密碼為空,初始化腳本會引導你設定。
mysql -u root -p
CREATE DATABASE etherpad;
GRANT ALL PRIVILEGES ON etherpad.* TO 'etherpad'@'localhost' IDENTIFIED BY 'test1234';
FLUSH PRIVILEGES;
\q
curl -sL https://rpm.nodesource.com/setup | sudo bash -
yum install nodejs
node --version
以 root 直接跑應用程式並不妥,建立獨立帳號較安全:
adduser --home /opt/etherpad --shell /bin/bash etherpad
install -d -m 755 -o etherpad -g etherpad /opt/etherpad
su - etherpad
cd
git clone https://github.com/ether/etherpad-lite
cp ~/etherpad-lite/settings.json.template ~/etherpad-lite/settings.json
編輯 settings.json 時有幾個要點:
若打算用 Nginx 做反向代理,把 IP 改為 127.0.0.1 並將 trustProxy 設為 true,同時把預設的 "dbType": "dirty" 註解掉。
資料庫設定:
"dbType" : "mysql",
"dbSettings" : {
"user" : "etherpad",
"host" : "localhost",
"password": "test1234",
"database": "etherpad"
},
管理員帳號:
"users": {
"admin": { "password": "admin123", "is_admin": true }
},
存檔後安裝相依元件並啟動:
~/etherpad-lite/bin/installDeps.sh
~/etherpad-lite/bin/run.sh
瀏覽器開啟 https://your_server_ip:9001 建立一個 New Pad,把產生的網址(形如 https://ip:9001/p/xxxx)寄給協作者即可共同編輯。
正式使用時還建議兩件事:一是把 Etherpad 註冊為 systemd 服務,避免程序結束後無法自動重啟;二是用 Nginx 反向代理把 9001 埠隱藏在網域之後,並加上 HTTPS。另外,範例中的 admin123 與 test1234 都是示意用的弱密碼,上線前請替換。