环境:Linux :CentOS 6.9 64位;阿里云服务器 ;高效云盘 40G;数据盘 60G
mkdir /usr/local/leanote cd /usr/local/leanote/ 3. wget https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz
4. tar -xzvf go<按tab键补全>
5. 在/usr/local/leanote/下新建一个防止go的包和编译后的文件的目录goPackage
mkdir /usr/local/leanote/goPackage
7. 使用vim编辑添加环境变量 vim /etc/profile
8. 在unset语句前的空行前添加如下几句
export GOROOT=/usr/local/leanote/go export GOPATH=/usr/local/leanote/gopackage export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
12. 使用source /etc/profile 命令来使环境变量生效
13. 接下来需要安装revel及leanote的源码,有两种方式:1)是在本地下载完成后,然后使用ftp服务上传到云服务器2)是使用git来clone在仓库里的源代码。这里采用第二种方式
1. 先安装依赖
yum install curl-devel expat-devel gettext-devel \ openssl-devel zlib-devel
2. 下载最新的git的tar.gz 源码:
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
3. 解压:
tar -xzvf git<使用tab键补全> -C /usr/local/
4.
cd git<...>
5.
make prefix=/usr/local all
6. 上一步发现没有安装gcc,下面安装gcc : yum install gcc
7. 安装完gcc 继续第5部,出现错误:Can’t locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 1.
8. 解决上面的错误:
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
9. 继续第5部 成功
10.
make prefix=/usr/local install
11. 成功安装git
参考资料:安装git:【https://git-scm.com/book/zh/v1/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git】
参考资料:解决git安装错误:【http://blog.51cto.com/212395/1582370】
1. go get github.com/revel/cmd/revel(失败)
2. go get github.com/leanote/leanote/app(失败)
3. wget https://github.com/leanote/leanote-all/archive/master.zip 下载到/usr/local/leanote/
4. 解压:unzip leanote<…>
5. 将里面的src文件夹粘贴到goPackage目录下
6. 使用如下命令生成revel二进制命令:go install github.com/revel/cmd/revel
1.下载:
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-3.6.3.tgz
2. 解压
tar -zxvf mongodb-linux-x86_64-amazon-3.6.3.tgz
3. 配置环境变量, 编辑/etc/profile文件 加入
export PATH=$PATH:/usr/local/leanote/mongodb-linux-x86_64-amazon-3.6.3/bin
4. 在终端运行以下命令使环境变量生效:
source /etc/profile
5. 先在 /usr/local/leanote下新建一个目录 data 存放Mongodb数据:
mkdir /usr/local/leanote/data
6. 用以下命令启动 mongodb :
mongod --dbpath /usr/local/leanote/data
7. 打开终端, 输入以下命令导入数据
mongorestore -h localhost -d leanote --dir /usr/local/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data
9. Leanote的配置存储在文件 /usr/local/leanote/goPackage/src/github.com/leanote/leanote/conf/app.conf
10. 修改app.secret=ChroblertJerrybird
mongo v3数据库
use leanote
db.createUser({
user:'root',
pwd:'xxxxxxxx',
roles:[{role:'dbOwner',db:'leanote'}]
});
8. 数据库用户添加完毕,下面验证是否添加成功:db.auth(‘root’,’xxxxxxxx’);若返回为1,则成功
9. 启动数据库:screen mongod –dbpath /usr/local/data –auth
db.host=127.0.0.1 db.port=27017 db.dbname=leanote db.username=root db.password=xxxxxxxx
7. 配置文件修改完毕,重新启动leanote。先将之前开启的关闭,然后重新启动 revel run github.com/leanote/leanote
1. 在后台运行,启动时只需添加 –fork 函数即可。可以在日志路径后面添加 –logappend,防止日志被删除。
mongod --fork --dbpath=/usr/local/leanote/data --logpath=/usr/local/leanote/mongoDBLog/mongodb.log --logappend --auth
2. 或者
screen mongod --dbpath /usr/local/leanote/data --auth
1. 将(七).1中的代码添加至 /etc/rc.local文件中即可
(1)生成ssl脚本
#!/bin/sh # create self-signed server certificate: read -p "Enter your domain [www.example.com]: " DOMAIN echo "Create server key..." openssl genrsa -des3 -out $DOMAIN.key 1024 echo "Create server certificate signing request..." SUBJECT="/C=US/ST=Mars/L=iTranswarp/O=iTranswarp/OU=iTranswarp/CN=$DOMAIN" openssl req -new -subj $SUBJECT -key $DOMAIN.key -out $DOMAIN.csr echo "Remove password..." mv $DOMAIN.key $DOMAIN.origin.key openssl rsa -in $DOMAIN.origin.key -out $DOMAIN.key echo "Sign SSL certificate..." openssl x509 -req -days 3650 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt
(2)设置nginx /usr/local/nginx/conf/nginx.conf
# 本配置只有http部分, 不全 http { include /etc/nginx/mime.types; default_type application/octet-stream; upstream leanote_app { server localhost:9000; } # http server { listen 80; server_name notebook.isdevil.com; # 强制https # 如果不需要, 请注释这一行rewrite #rewrite ^/(.*) https://jp_linode2.com/$1 permanent; location / { proxy_pass http://notebook.isdevil.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 notebook.isdevil.com; ssl_certificate ../cert/leanote/notebook.isdevil.com.crt; # 修改路径, 到a.com.crt, 下同 ssl_certificate_key ../cert/leanote/notebook.isdevil.com.key location / { proxy_pass http://notebook.isdevil.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; } } }
1. 在/etc/rc.local中加入一行
nohup revel run github.com/leanote/leanote 2>&1 &
参考资料:【https://blog.csdn.net/yori_chen/article/details/79800853】
参考资料:官方:
【https://github.com/leanote/leanote/wiki/Leanote-%E6%BA%90%E7%A0%81%E7%89%88%E8%AF%A6%E7%BB%86%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B—-Mac-and-Linux】
参考资料:【http://www.bioinit.com/post/ecs-leanote】
转载请注明:大魔王ISDevil's Blog » leanote安装配置