Total Pageviews

Tuesday 1 April 2014

在Linux vps上搭建基于nodejs+mongodb的博客程序-scotch

首先安装mongodb
wget http://downloads.mongodb.org/linux/mongodb-linux-i686-2.4.9.tgz
tar zxvf mongodb-linux-i686-2.4.9.tgz
cd mongodb-linux-i686-2.4.9/bin/
不要马上运行./mongo,否则会出现错误Error: couldn't connect to server 127.0.0.1:127017
shell/mongo.js”
解决办法:
mkdir -p /data/db/
useradd mongodb
chown mongodb /data/db/
(You must create the mongodb user separately.)
nohup ~/mongodb-linux-i686-2.4.9/bin/mongod --dbpath /data/db/ > /dev/null &
(from http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/)

npm install -g scotch-blog
scotch create scotch-site (此命令会在当前目录下,生成scotch-site 目录)
cd scotch-site

as3:~/scotch-site# scotch --help
  Usage: scotch [options]
  Options:
    -h, --help     output usage information
    create <name>  create a new directory (<name>) and generate a new Scotch site in
it.
    serve [port]   start the server, defaults to 80
 as3:~/scotch-site# ls
app  config    node_modules  public     support
bin  Jakefile  package.json  readme.md  test
as3:~/scotch-site# nohup scotch serve 9030 > /dev/null & (9030是任意指定的端口,只要是未被占用的端口均可)
然后访问http://as3.brite.biz:9030,会跳到http://as3.brite.biz:9030/dashboard/install
,按照页面的提示,输入你的email地址和你的密码进行安装。然后访问
http://as3.brite.biz:9030/就可看到网站效果了。
登录地址:http://as3.brite.biz:9030/dashboard/login
发贴地址:http://as3.brite.biz:9030/dashboard/post,写完标题和内容后,点击published->
save this post.

演示站点:http://as3.brite.biz:9030/,
项目地址:https://github.com/Techwraith/scotch/