在搭建自己線上筆記Leanote
前言
相信很多人都有多使用雲筆記的經歷,像印象筆記,有道筆記。無論是學習還是工作,這些工具都幫助我們提高了效率。Leanote作為開源的一股清流,讓我們這些不願被金錢束縛的人可以搭建屬於自己的雲筆記,無需月租,什麼都是超級VIP體驗。
那麼說到Leanote,其具備的功能:
- PC ,移動,web端同步支援,這就帶來極大方便了
- 資料匯入和匯出,印象筆記的資料可以無縫匯入到自己的筆記,方便遷移。匯出PDF功能也是很實用。
- 支援思維導圖功能,這也是一大亮點
- Leanote的風格很適合程式設計師使用,甚至可以將筆記直接釋出到Leanote部落格。
環境
- Centos7
- Leanote 二進位制包
- MongoDB環境
MongoDB 安裝
1.官網下載monogoDB
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.5.tgz
2. 解壓縮
gunzip mongodb-linux-x86_64-3.6.5.tgz tar -xvf mongodb-linux-x86_64-3.6.5.tar
3. 設定環境變數
vi ~/.bashrc # 只對當前使用者生效
./bashrc
.... PATH=/mongodb-linux-x86_64-3.6.5/bin:$PATH export PATH
4. 配置mongodb.conf
vi mongodb.conf
mongodb.conf
# idae - MongoDB config start # 設定資料檔案的存放目錄(根據實際的db資料夾的路徑填寫) dbpath = /usr/local/mongodb/db # 設定日誌檔案的存放目錄及其日誌檔名(根據實際的logs資料夾的路徑填寫) logpath = /usr/local/mongodb/logs/mongodb.log # 設定埠號(預設的埠號是 27017) port = 27017 # 設定為以守護程序的方式執行,即在後臺執行 fork = true nohttpinterface = true # idae - MongoDB config end
5.啟動MongoDB
mongodb -f mongodb.conf
Leanote安裝配置
1.下載並解壓Leanote二進位制包
wget https://sourceforge.net/projects/leanote-bin/files/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz tar -xvf leanote-linux-amd64-v2.6.1.bin.tar.gz
2.MongoDB 匯入Leanote資料
mongorestore -h 127.0.0.1 -d leanote --dir/leanote/mongodb_backup/leanote_install_data/
3.配置leanote,修改leanote/conf/app.conf
db.host=127.0.0.1 db.port=27017 db.dbname=leanote # required db.username=root # if not exists, please leave blank db.password=abc123 # if not exists, please leave blank
4.啟動Leanote
cd/leanote/bin chmod x ./run.sh && ./run.sh # 給執行許可權並啟動執行
5. 配置外網訪問
firewall-cmd --permanant --add-port=9000/tcp # Centos 防火牆開啟9000埠出入 firewall-cmd --reload #重新載入firwall規則
Option: Nginx 設定
# 本配置只有http部分, 不全 http { include /etc/nginx/mime.types; default_type application/octet-stream; upstream a.com { server localhost:9000; } # http server { listen 80; server_name a.com; # 強制https # 如果不需要, 請註釋這一行rewrite rewrite ^/(.*) https://jp_linode2.com/$1 permanent; location / { proxy_pass http://a.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } # https server { listen 443 ssl; server_name a.com; ssl_certificate /root/a.com.crt; # 修改路徑, 到a.com.crt, 下同 ssl_certificate_key /root/a.com.key; location / { proxy_pass http://a.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } }
官方QA
https://github.com/leanote/leanote/wiki/QA#不能通過ip訪問