leanote服务器搭建-搭建自己的云笔记服务器

前端之家收集整理的这篇文章主要介绍了leanote服务器搭建-搭建自己的云笔记服务器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

经测试,最新的版本已经更新的安装程序。
如果还想安装此版本,可以把邮箱留下。

0 需要下载的文件

1 说明

这里单独的创建了一个leanote文件夹,所有的配置等都放在这个文件夹中
/home/flannery/leanote

2 golang的安装

2.1 下载golang

国内访问外网比较慢,直接访问Golang中国就可以了.

在主页选择下载->Go便可以进入下载主页.

下载的结果请参照图0-1中的go1.6.4.linux-amd64.tar.gz

2.2 安装golang

2.2.1 解压文件

$> cd /home/flannery/leanote
$> tar -xzvf go1.6.4.linux-amd64.tar.gz

解压出一个go文件夹.

2.2.2 创建一个gopackage文件

$> mkdir -p /home/flannery/leanote/gopackage

# 并在gopackage中添加一个bin文件
$> mkdir -p /home/flannery/leanote/gopackage/bin

2.2.3 编辑系统的配置文件/etc/profile

sudo gedit /etc/profile

将下列代码加入到文件末尾
export GOROOT=/home/flannery/leanote/go
export GOPATH=/home/flannery/leanote/gopackage
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

2.2.4 加载最新的配置文件

source /etc/profile

2.2.5 查看是否配置成功

go version

2.2.6 显示如下信息说明配置成功

go version go1.6.4 linux/amd64

3 生成go项目

3.1 下载leanote-all-master.zip

$> wget https://github.com/leanote/leanote-all/archive/master.zip
$> unzip master.zip
$> cp -r ./master/src /home/user1/gopackage

3.2 生成revel项目

$> go install github.com/revel/cmd/revel

4 安装Mongodb

4.1 下载Mongodb

64-bit linux Mongodb 3.0.1: [https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz](https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz)

现在的Mongodb下载时64位的,上面的链接地址我是可以下载的, 如果不能下载请访问Mongodb官网

4.2 安装Mongodb

# 解压文件
$> cd /home/flannery/leanote/
$> tar -xzvf mongodb-linux-x86_64-3.0.1.tgz/

4.2 将命令路径写入配置文件

$> sudo gedit /etc/profile

export PATH=$PATH:/home/flannery/mongodb-linux-x86_64-3.0.1/bin

$> source /etc/profile

4.3 测试Mongodb

# 在此目录下 /home/flannery/leanote/mongodb-linux-x86_64-3.0.1/bin
$> ./mongod --dbpath /home/flannery/leanote/data/ &

开启两一个终端,测试是否连接成功

$> mongo
> show dbs

5 导入初始化数据

$> mongorestore -h localhost -d leanote --dir /home/$USER/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/

在我的配置中是

flannery@flannery ~/leanote/mongodb-linux-x86_64-3.0.1/bin $ ./mongorestore -h localhost -d leanote --dir /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/
2017-02-21T09:58:51.848+0800    building a list of collections to restore from /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/ dir
2017-02-21T09:58:51.850+0800    reading Metadata file from /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/note_content_histories.Metadata.json
2017-02-21T09:58:51.850+0800    restoring leanote.note_content_histories from file /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/note_content_histories.bson
2017-02-21T09:58:51.851+0800    reading Metadata file from /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/note_contents.Metadata.json
2017-02-21T09:58:51.851+0800    restoring leanote.note_contents from file /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/note_contents.bson
2017-02-21T09:58:51.851+0800    reading Metadata file from /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/configs.Metadata.json
2017-02-21T09:58:51.867+0800    restoring leanote.configs from file /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/configs.bson
2017-02-21T09:58:52.141+0800    restoring indexes for collection leanote.note_contents from Metadata
2017-02-21T09:58:52.141+0800    reading Metadata file from /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/attachs.Metadata.json
2017-02-21T09:58:52.142+0800    restoring leanote.attachs from file /home/flannery/leanote/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/attachs.bson
2017-02-21T09:58:52.142+0800    restoring indexes for collection leanote.note_content_histories from Metadata

~~~

6. 运行 Leanote

$> revel run github.com/leanote/leanote
# 有可能遇到这样的问题,其实我也很纳闷.其实是没有那个命令路径.
revel:未找到命令
# 解决方法
$>source /etc/profile就好了

7. 如果这时显示下面的界面说明成功了,如果没有请重新按上面的过程走一遍.

官网配置文件

猜你在找的Go相关文章