如何以non root帐号运行VirtualBox

在openSUSE 11.3中,root帐号可以正常地创建、注册、启动、停止和注销VM,然而non-root帐号就不行,使用vboxmanage的时候提示:

ERROR: failed to initialize COM!

请教了google大神,该问题得以解决:

如何在VirtualBox中安装和克隆windows VM

上回讲了如何安装和克隆Debian VM,本回说说Windows
VM。

1. 创建windows VM

# VBoxManage createvm --name "win2k3-template" --register
# VBoxManage modifyvm "win2k3-template" --memory 512 --acpi on --boot1 dvd --nic1 bridged --nictype1 virtio --bridgeadapter1 eth0
# VBoxManage createhd --filename /vbox.images/win2k3-template/win2k3-template.vdi --size 20000
# VBoxManage storagectl "win2k3-template" --name "IDE Controller" --add IDE --controller IntelAhci
# VBoxManage storageattach "win2k3-template" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /vbox.images/win2k3-template/win2k3-template.vdi
# VBoxManage storageattach "win2k3-template" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /home/software/Windows.Server.2003.SP2.ent.iso

如何在openSUSE中安装最新版VirtualBox

上一回讲到如何将openSUSE从11.1升级到11.3,下面讲讲如何安装最新版的VirtualBox。

一、安装

1、导入VirtualBox的public rpm key

# wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
# rpm --import oracle_vbox.asc

2、添加VirtualBox的repos

# cd /etc/zypp/repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/opensuse/11.3/virtualbox.repo

3、安装必需的组件

# zypper in kernel-source kernel-syms gcc make Xerces-c

4、安装VirtualBox

# zypper in VirtualBox-4.1

5、安装Extension Pack

VirtualBox将VRDP、sharefolder等功能特性打包成Extension Pack。其中,VRDP最具吸引力,透过该功能,即便host不安装Xdesktop环境,用户也能通过RDP客户端也连接vm。

# cd /home/software
# wget http://download.virtualbox.org/virtualbox/4.1.16/Oracle_VM_VirtualBox_Extension_Pack-4.1.16-78094.vbox-extpack
# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.16-78094.vbox-extpack

二、配置

VirtualBox默认的配置中,vm的vdi和config文件分开存放,而我更倾向于以下的目录组织方式:

# tree -A -S /vbox.images/
/vbox.images/
+-- archive
|   +-- tinycore-2.1-x86.7z
+-- deb6-template
|   +-- Logs
|   |   +-- VBox.log
|   |   +-- VBox.log.1
|   |   +-- VBox.log.2
|   |   +-- VBox.log.3
|   +-- deb6-template.vbox
|   +-- deb6-template.vbox-prev
|   +-- deb6-template.vdi
+-- netmgmt-deb6
|   +-- Logs
|   |   +-- VBox.log
|   |   +-- VBox.log.1
|   |   +-- VBox.log.2
|   |   +-- VBox.log.3
|   +-- netmgmt-deb6.vbox
|   +-- netmgmt-deb6.vbox-prev
|   +-- netmgmt-deb6.vdi
+-- win2k3-template
    +-- Logs
    |   +-- VBox.log
    |   +-- VBox.log.1
    |   +-- VBox.log.2
    +-- win2k3-template.vbox
    +-- win2k3-template.vbox-prev
    +-- win2k3-template.vdi

vm的config、vdi和log放在同一个目录下,方便管理。因此,需要重新对machinefolder进行配置:

# vboxmanage setproperty machinefolder /vbox.images/

至此完成了最新版VirtualBox的安装。

接下来,该如何创建和克隆vm呢?且听下回分解

如何将openSUSE从11.1升级到11.3

最近需要在一台openSUSE 11.1上安装virtualbox,死活装不上去,请教google大神后发现,大多数成功的案例都是在11.3下发生的,于是便开始了我下面的11.1到11.3的升级之旅。

openSUSE官方forum上看到不少跨版本升级失败的例子,因此决定采用步步为营的升级法,也很简单,就是先从11.1升级到11.2,然后再从11.2升级到11.3,虽然啰嗦了一些,但是安全。

小VPS能干什么?

作为一名网络/系统工程师,接触最多的就是console界面,tcpdump、nmap、iftop、pftop、systat等等工具都是在终端下才能来去自如,所以虽然现在的GUI是越来越华丽,但是仍然取代不了console,简捷是最大的优点。

  1. 美化使用环境:统一使用solarized作为主题,包括PuTTY、zsh、vim和mutt
  2. 搭建博客;
    2.1 octopress;
    2.2 wordpress;
  3. 使用vim+markdown+octopress记录文档;
  4. 使用mutt管理邮件列表;
  5. 安装VPN、radius,正常访问互联网;

  6. mutt

  7. getmail4
  8. procmail
  9. msmtp-mta

aptitude mutt getmail4 procmail msmtp-mta

Q1. 为什么用getmail而不用大名鼎鼎的fetchmail?

http://pyropus.ca/software/getmail/faq.html#faq-about-why

mutt

“All mail clients suck. This one just sucks less.” Michael Elkins, ca. 1995

mutt是一个高效、高度可配置的基于console的邮件用户代理(MUA)

debian中提供了mutt-patched这个包,包含了sidebar功能。

solarized

solarize是一个非常流行的配色,目前已移植到多个应用程序中。

putty

terminal emulator,这个是前提,tmux、vim、mutt都依赖于terminal emulator的底色,所以首先要搞定这个。

xterm-256color由ncurse-term提供,因此假如没有安装该软件包的化,就没有xterm-color256这个terminfo

vim without gui

set t_Co=16

mutt 配色

mutt-colors-solarized-256.muttrc
mutt-colors-solarized-16.muttrc

默认情况下,term的颜色仅支持8色,

# tput colors
8

需要安装ncurse-term这个软件包来解决

# aptitude install ncurse-term

然后重新登录

# tput colors
256

再执行mutt就不会出现

color not supported的错误了。

参考:

  1. Getting 256 color support working for mutt in xfce4-terminal
  2. http://www.robmeerman.co.uk/unix/256colours

mail storage
Maildir

The advantages of Maildir are that no locking is required, so multiple applications can work on the same mailfolder at the same time without messing up. Plus, having one file per message makes manipulating mail with scripts much simpler

The disadvantages are that some file-systems are very inefficient with both small-files and with thousands of files in one directory.

mbox

There are advantages and disadvantages with mbox format. It is slow when removing messages, as the whole thing has to be rewritten, and it can be a mess when several applications want to write to an mbox at the same time. Advantages are that the mbox format is universal and can be read by many other programs (even some in the Windows world).

IMAP
Use IMAP mail storage in these situations:

  • When you have a reliable network connection to your mailserver.
  • For accessing your mail from different locations.
  • When you need to be able to read your mail using different mail user agents.

建议用IMAP作为邮件存储方式,一来有gmail作为备份,二来还需依赖gmail做全文搜索、三呢是节省存储空间。
我想最终会选择IMAP,因为全文检索不是mutt的强项,还得依赖gmail。

mutt + gmail(imap) + msmtp

.muttrc

这个配置是没问题了,即便配置了缓存还是无法解决快速打开邮件的问题,唯一的问题是每次打开都要evaluate cache 27703多的邮件,也不是通过cache就可以迅速能够装载得了的,还是慢,所以就有了offlineimap这个工具。

mutt + gmail(imap) + msmtp + offlineimap

.muttrc

getmail

procmail

msmtp-mta

msmtp msa??

Tiny mail sending agents

If you think that installing a full-featured server-mta is overkill, there are some tiny alternatives that use less resources and that don't listen for incoming connections. Such as: the MasqMail msa, msmtp msa, esmtp msa, smtppush msa and nullmailer msa

在debian中安装octopress

前面讲了如何在heroku中部署octopress,不过heroku毕竟不在自己的手上,对于用户来说是一个遗憾,贝多芬说了:要扼住命运的咽喉。因此自己的博客就要部署在自己的VPS上。下面讲一下如何在debian squeeze中部署git+ruby+nginx+octopress。

git

git的安装很简单:

# apt-get update
# apt-get install git-core
# git config --global user.name "alfie chan"
# git config --global user.email admin@linuxabc.net.cn

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,但是遇到一些问题,最后决定手工编译的方式进行安装。

# bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  994k  100  994k    0     0  45792      0  0:00:22  0:00:22 --:--:-- 41842

Installing RVM to /usr/local/rvm/
    Creating RVM system user group 'rvm'

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm/
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'

Installation of RVM in /usr/local/rvm/ is almost complete:

  * First you need to add all users that will be using rvm to 'rvm' group,
    and logout - login again, anyone using rvm will be operating with `umask g+w`.

  * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# root,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne


rvm 1.13.0 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [h
ttps://rvm.io/]

根据上面的提示,执行:

# source /etc/profile.d/rvm.sh

然后:

# rvm install 1.9.2

出现错误,根据/usr/local/rvm/1.9.2/extract.log的错误提示,原来安装的过程中还需要用到makebzip2这两个工具。

于是:

# aptitude install make bzip2

接着:

# rvm install 1.9.2
Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives
Extracting yaml-0.1.4.tar.gz to /usr/local/rvm/src
Configuring yaml in /usr/local/rvm/src/yaml-0.1.4.
Compiling yaml in /usr/local/rvm/src/yaml-0.1.4.
Installing yaml to /usr/local/rvm/usr
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.2-p320, this may take a while depend
ing on your cpu(s)...

ruby-1.9.2-p320 - #fetching
ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /usr/local/rvm/src/ruby-1.9.2-p320
ruby-1.9.2-p320 - #extracted to /usr/local/rvm/src/ruby-1.9.2-p320
ruby-1.9.2-p320 - #configuring
ruby-1.9.2-p320 - #compiling
ruby-1.9.2-p320 - #installing
Retrieving rubygems-1.8.24
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  371k  100  371k    0     0  35412      0  0:00:10  0:00:10 --:--:-- 51058
Extracting rubygems-1.8.24 ...
Removing old Rubygems files...
Installing rubygems-1.8.24 for ruby-1.9.2-p320 ...
Installation of rubygems completed successfully.
ruby-1.9.2-p320 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.2-p320 - #importing default gemsets (/usr/local/rvm/gemsets/)
Install of ruby-1.9.2-p320 - #complete

然后通过git将octopress克隆到本地:

# git clone git://github.com/imathis/octopress.git octopress
# cd octopress
====================================================================================
= NOTICE                                                                           =
====================================================================================
= RVM has encountered a new or modified .rvmrc file in the current directory       =
= This is a shell script and therefore may contain any shell commands.             =
=                                                                                  =
= Examine the contents of this file carefully to be sure the contents are          =
= safe before trusting it! ( Choose v[iew] below to view the contents )            =
====================================================================================
Do you wish to trust this .rvmrc file? (/home/chenr/octopress/.rvmrc)
y[es], n[o], v[iew], c[ancel]> y
Using /usr/local/rvm/gems/ruby-1.9.2-p320
# rake install
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.

(See full trace by running task with --trace)

也就是说要用bundle exec rake

root@deb600-64-mgmt:/home/chenr/octopress# bundle exec rake install
## Copying classic theme into ./source and ./sass
root@deb600-64-mgmt:/home/chenr/octopress#

创建第一篇博客

# bundle exec rake new_post["hello-octopress"]
# vim ./source/_post/2012-04-30-hello-octopress.markdown

生成静态网站

deb600-64-mgmt:/home/chenr/octopress/source/_posts# bundle exec rake generat
(in /home/chenr/octopress)
## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/chenr/octopress/_config.yml
/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)
        from /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/https.rb:92:in `<top (required)>'
        from /home/chenr/octopress/plugins/gist_tag.rb:10:in `require'
        from /home/chenr/octopress/plugins/gist_tag.rb:10:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:76:in `require'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:76:in `block in setup'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:75:in `each'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:75:in `setup'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:30:in `initialize'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/bin/jekyll:224:in `new'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/bin/jekyll:224:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/jekyll:23:in `load'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/jekyll:23:in `<main>'

google
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/https.rb:92:inrequire': no such file to load — openssl (LoadError)`

依稀记得octopress推荐使用ruby-1.9.2-p290,于是

# rvm install ruby-1.9.2-p290
# rvm use ruby-1.9.2-p290
# bundle exec rake generate

错误依旧,傻眼了,还得求助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

编译和安装

# ./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf \
 --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid \
 --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log \
 --http-client-body-temp-path=/var/lib/nginx/body \
 --http-proxy-temp-path=/var/lib/nginx/proxy \
 --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug \
 --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module \
 --with-http_dav_module


Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/sbin"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/lib/nginx/body"
  nginx http proxy temporary files: "/var/lib/nginx/proxy"
  nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

# make & make install

mkdir /var/log/nginx && chown nginx:nignix /var/log/nginx

mkdir /var/lib/nginx && chown nginx:nignix /var/lib/nginx

/etc/init.d/nginx

检测一下:

# lynx localhost

在debian中安装octopress

前面讲了如何在heroku中部署octopress,不过heroku毕竟不在自己的手上,对于用户来说是一个遗憾,贝多芬说了:要扼住命运的咽喉。因此自己的博客就要部署在自己的VPS上。下面讲一下如何在debian squeeze中部署git+ruby+nginx+octopress。

git

git的安装很简单:

# apt-get update
# apt-get install git-core
# git config --global user.name "alfie chan"
# git config --global user.email admin@linuxabc.net.cn

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,但是遇到一些问题,最后决定手工编译的方式进行安装。

# bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  994k  100  994k    0     0  45792      0  0:00:22  0:00:22 --:--:-- 41842

Installing RVM to /usr/local/rvm/
    Creating RVM system user group 'rvm'

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm/
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'

Installation of RVM in /usr/local/rvm/ is almost complete:

  * First you need to add all users that will be using rvm to 'rvm' group,
    and logout - login again, anyone using rvm will be operating with `umask g+w`.

  * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# root,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne


rvm 1.13.0 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [h
ttps://rvm.io/]

根据上面的提示,执行:

# source /etc/profile.d/rvm.sh

然后:

# rvm install 1.9.2

出现错误,根据/usr/local/rvm/1.9.2/extract.log的错误提示,原来安装的过程中还需要用到makebzip2这两个工具。

于是:

# aptitude install make bzip2

接着:

# rvm install 1.9.2
Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives
Extracting yaml-0.1.4.tar.gz to /usr/local/rvm/src
Configuring yaml in /usr/local/rvm/src/yaml-0.1.4.
Compiling yaml in /usr/local/rvm/src/yaml-0.1.4.
Installing yaml to /usr/local/rvm/usr
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.2-p320, this may take a while depend
ing on your cpu(s)...

ruby-1.9.2-p320 - #fetching
ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /usr/local/rvm/src/ruby-1.9.2-p320
ruby-1.9.2-p320 - #extracted to /usr/local/rvm/src/ruby-1.9.2-p320
ruby-1.9.2-p320 - #configuring
ruby-1.9.2-p320 - #compiling
ruby-1.9.2-p320 - #installing
Retrieving rubygems-1.8.24
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  371k  100  371k    0     0  35412      0  0:00:10  0:00:10 --:--:-- 51058
Extracting rubygems-1.8.24 ...
Removing old Rubygems files...
Installing rubygems-1.8.24 for ruby-1.9.2-p320 ...
Installation of rubygems completed successfully.
ruby-1.9.2-p320 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.2-p320 - #importing default gemsets (/usr/local/rvm/gemsets/)
Install of ruby-1.9.2-p320 - #complete

然后通过git将octopress克隆到本地:

# git clone git://github.com/imathis/octopress.git octopress
# cd octopress
====================================================================================
= NOTICE                                                                           =
====================================================================================
= RVM has encountered a new or modified .rvmrc file in the current directory       =
= This is a shell script and therefore may contain any shell commands.             =
=                                                                                  =
= Examine the contents of this file carefully to be sure the contents are          =
= safe before trusting it! ( Choose v[iew] below to view the contents )            =
====================================================================================
Do you wish to trust this .rvmrc file? (/home/chenr/octopress/.rvmrc)
y[es], n[o], v[iew], c[ancel]> y
Using /usr/local/rvm/gems/ruby-1.9.2-p320
# rake install
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.

(See full trace by running task with --trace)

也就是说要用bundle exec rake

root@deb600-64-mgmt:/home/chenr/octopress# bundle exec rake install
## Copying classic theme into ./source and ./sass
root@deb600-64-mgmt:/home/chenr/octopress#

创建第一篇博客

# bundle exec rake new_post["hello-octopress"]
# vim ./source/_post/2012-04-30-hello-octopress.markdown

生成静态网站

deb600-64-mgmt:/home/chenr/octopress/source/_posts# bundle exec rake generat
(in /home/chenr/octopress)
## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/chenr/octopress/_config.yml
/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)
        from /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/https.rb:92:in `<top (required)>'
        from /home/chenr/octopress/plugins/gist_tag.rb:10:in `require'
        from /home/chenr/octopress/plugins/gist_tag.rb:10:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:76:in `require'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:76:in `block in setup'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:75:in `each'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:75:in `setup'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/lib/jekyll/site.rb:30:in `initialize'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/bin/jekyll:224:in `new'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/jekyll-0.11.0/bin/jekyll:224:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/jekyll:23:in `load'
        from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/jekyll:23:in `<main>'

google
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/https.rb:92:inrequire': no such file to load — openssl (LoadError)`

依稀记得octopress推荐使用ruby-1.9.2-p290,于是

# rvm install ruby-1.9.2-p290
# rvm use ruby-1.9.2-p290
# bundle exec rake generate

错误依旧,傻眼了,还得求助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

编译和安装

# ./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf \
 --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid \
 --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log \
 --http-client-body-temp-path=/var/lib/nginx/body \
 --http-proxy-temp-path=/var/lib/nginx/proxy \
 --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug \
 --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module \
 --with-http_dav_module


Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5: using OpenSSL library
  + sha1: using OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/sbin"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/var/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/lib/nginx/body"
  nginx http proxy temporary files: "/var/lib/nginx/proxy"
  nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

# make & make install

mkdir /var/log/nginx && chown nginx:nignix /var/log/nginx

mkdir /var/lib/nginx && chown nginx:nignix /var/lib/nginx

/etc/init.d/nginx

检测一下:

# lynx localhost

octopress customization

  • about分页

    1. source下新建about目录,并在里面添加index.markdown文件。
    2. 编辑导航条source/_includes/custom/navigation.html
    3. 注意:index.markdown文件需要加上头,否则会找不到。
  • 摘要

    1. 在文中加入<!--more-->来控制摘要截取位置
    2. 修改_config.yml里的excerpt_link控制连接文字,默认是readon->