Virink's Blog logo

Virink's Blog

Let life be beautiful like summer flowers, and death like autume leaves.

 Leanote環境搭建小记

Install Golang and revel

下載安裝Golang

cd /tmp
//到官網下載
tar -C /usr/local -xzf go*.tar.gz

設置環境變量

cat >> ~/.profile <<EOF
export GOROOT=/usr/local/go
export GOPATH=$HOME/gocode
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
EOF

source ~/.profile

Install revel & leanote

go get github.com/revel/cmd/revel
go get github.com/leanote/leanote/app

安裝Mongdo

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install -y mongodb-org

設置環境變量(可有可無)

cat >> ~/.profile <<EOF
export MONGOPATH=/usr/bin
export PATH=$PATH:$MONGOPATH
EOF

source ~/.profile

新建一个目录data存放mongodb数据:

mkdir /path/data

用以下命令启动mongod:

mongod --dbpath /path/data

这时mongod已经启动,重新打开一个终端, 键入mongo进入交互程序:

$> mongo
> show dbs
...数据库列表

mongodb安装到此为止

安裝Leanote

请务必修改app.secret一项, 在若干个随机位置处,将字符修改成一个其他的值, 否则会有安全隐患!

修改配置

$GOPATH/src/github.com/leanote/leanote/conf/app.conf

導入初始數據

mongorestore -h localhost -d leanote --directoryperdb ~/gocode/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data

运行leanote

注意: 在此之前请确保mongodb已在运行!

新开一个窗口, 运行:

$> revel run github.com/leanote/leanote

恭喜你, 打开浏览器输入: http://localhost:9000 体验leanote吧!

啟動管理

apt-get install supervisor

創建配置文件

/etc/supervisor/conf.d/{filename}.conf

mongodb.conf

[program:mongodb]
command=/usr/bin/mongod --dbpath /path/data
autorestart=true
user=root

leanote.conf

[program:leanote]
command=revel run github.com/leanote/leanote
user=root
autorestart=true

運行

supervisord -c /etc/supervisor/supervisor.conf
本文标题 : Leanote環境搭建小记
文章作者 : Virink
发布时间 :  
最后更新 :  
本文链接 : https://www.virzz.com/2016/10/16/build_leanote_server.html
转载声明 : 转载请保留原文链接及作者。
转载说明 : 本卡片有模板生成,本人转载来的文章请忽略~~