切换到/usr/local目录

cd /usr/local

下载leanote及mongodb数据库源码包

wget firl.zelt.cn/mongodb-linux-x86_64-3.0.1.tgz

wget file.zelt.cn/leanote-linux-amd64-v2.4.bin.tar.gz

解压两个包

tar -zxvf mongodb-linux-x86_64-3.0.1.tgz

tar -zxvf leanote-linux-amd64-v2.4.bin.tar.gz

添加mongodb变量,编辑变量文件,

vi /etc/profile

在末尾增加mongodb变量

export PATH=$PATH:/usr/local/mongodb-linux-x86_64-3.0.1/bin

或执行以下命令直接在文件末尾处添加文字

echo export PATH=$PATH:/usr/local/mongodb-linux-x86_64-3.0.1/bin >> /etc/profile

保存后使用命令刷新,使变量生效

source /etc/profile

启动mongodb数据库
mongod --bind_ip localhost --port 27017 --dbpath /data/db/ --logpath=/var/log/mongod.log --fork

导入leanote默认配置到数据库

mongorestore -h localhost -d leanote --dir /usr/local/leanote/mongodb_backup/leanote_install_data/

编辑leanote/conf目录下的app.conf

修改默认端口

http.port=10009

site.url=http://localhost:10009

如需添加域名 则改为

site.url=http://localhost:10009, http://XXX.cn, http://XXX.cn:10009

修改app.secret=参数 修改一个自己喜欢的名字即可

保存后启动leanote

nohup /bin/bash /usr/local/leanote/bin/run.sh >> /var/log/leanote.log 2>&1 &

启动完成后即可使用网页端或客户端

默认管理员用户名密码为admin,abc123

安全起见,请打开网页端登录后,到后台管理修改密码,并把dedmo测试账号密码修改

添加开机启动,个人直接使用命令开机启动

编辑/etc/rc.local文件

在末尾添加/etc/init.d/onboot.sh

保存后为此文件增加增加执行权限

chmod +x /etc/rc.local

新建一个shell脚本文件并增加执行权限

touch /etc/init.d/onboot.sh

chmod +x /etc/rc.local

添加启动命令到shell脚本文件

vi /etc/init.d/onboot.sh

添加以下内容

#!/bin/bash

/usr/local/mongodb-linux-x86_64-3.0.1/bin/mongod --bind_ip localhost --port 27017 --dbpath /data/db/ --logpath=/var/log/mongod.log --fork

nohup /bin/bash /usr/local/leanote/bin/run.sh >> /var/log/leanote.log 2>&1 &

保存后即可开机启动,后续有需要开机时执行的命令可直接在此文件添加