Ubuntu下搭建自己的雲筆記: 伺服器篇
老規矩,上來先更新軟體清單
sudo apt-get update
更新完清單後,我們開始安裝Mongodb資料庫
sudo apt-get install mongodb -y
通過"pgrep mongo -l "檢視程序是否已經啟動
pgrep mongo -l
root@iZwz92sZ:~# pgrep mongo -l
17624 mongod
下載下傳Leanote
wget https://nchc.dl.sourceforge.net/project/leanote-bin/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz
解壓壓縮包
tar -zxvf leanote-linux-amd64-v2.6.1.bin.tar.gz
使用vi打開檔案leanote/conf/app.conf
vi leanote/conf/app.conf
找到app.secret
# mongdb
db.host=127.0.0.1
db.port=27017
db.dbname=leanote # required
db.username= # if not exists, please leave it blank
db.password= # if not exists, please leave it blank
# or you can set the mongodb url for more complex needs the format is:
# mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb
# db.url=mongodb://root:root123@localhost:27017/leanote
# db.urlEnv=${MONGODB_URL} # set url from env. eg. mongodb://root:root123@localhost:27017/leanote
# You Must Change It !! About Security!!
app.secret=asdf #
找到該項位置後按下i鍵進入編輯模式,修改該項的值為任意字元串。
修改完成後,按下esc鍵退出編輯模式,輸入:wq儲存并退出vi
初始化資料庫
mongorestore -h localhost -d leanote --dir /root/leanote/mongodb_backup/leanote_install_data/
啟動服務
nohup bash /root/leanote/bin/run.sh > /root/leanote/run.log 2>&1 &
root@iZwz92sq8e1hle3inkc5jkZ:~# nohup bash /root/leanote/bin/run.sh > /root/leanote/run.log 2>&1 &
[1] 18211
在浏覽器中通路
http://公網IP:9000, 記得先在安全組放行
預設管理使用者為admin,密碼為abc123