開發與維運

Ubuntu下搭建自己的雲筆記: 服務器篇

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

捕獲.PNG

Leave a Reply

Your email address will not be published. Required fields are marked *