前面讲了如何在heroku中部署octopress,不过heroku毕竟不在自己的手上,对于用户来说是一个遗憾,贝多芬说了:要扼住命运的咽喉。因此自己的博客就要部署在自己的VPS上。下面讲一下如何在debian squeeze中部署git+ruby+nginx+octopress。
git
git的安装很简单:
ruby
ruby的版本众多,安装和管理比较复杂。另外,debian开发者对ruby的代码树管理很不满,
已经决定终止对ruby进行打包,这使得ruby在debian上的安装更为麻烦,目前squeeze中ruby的版本是1.9.1(用户通过apt-cache search
会看到一个ruby 1.9.2,但那是虚拟包,不是真正的1.9.2),然而ocotpress对ruby的版本要求是1.9.2,因此我先是采用rvm,但是遇到一些问题,最后决定手工编译的方式进行安装。
根据上面的提示,执行:
# source /etc/profile.d/rvm.sh
然后:
# rvm install 1.9.2
出现错误,根据/usr/local/rvm/1.9.2/extract.log
的错误提示,原来安装的过程中还需要用到make
和bzip2
这两个工具。
于是:
# aptitude install make bzip2
接着:
然后通过git将octopress克隆到本地:
也就是说要用bundle exec rake
创建第一篇博客
生成静态网站
google
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/https.rb:92:in
require': no such file to load — openssl (LoadError)`
依稀记得octopress推荐使用ruby-1.9.2-p290,于是
错误依旧,傻眼了,还得求助google,我换了一下关键字require': no such file to load -- openssl (LoadError)
这次有结果了:Setting Up Octopress
原来是还缺libssl-dev
这个软件包
# aptitude install libssl-dev
# rvm reinstall ruby-1.9.2-p290
终于成功了!归根结底,rvm在安装ruby时,即便缺乏依赖包也没有提示,看来用rvm来安装ruby不怎么靠谱啊。即便用rbenv
nginx
编译和安装
mkdir /var/log/nginx && chown nginx:nignix /var/log/nginx
mkdir /var/lib/nginx && chown nginx:nignix /var/lib/nginx
检测一下:
# lynx localhost