William's Blog with Octopress

Octopress is A blogging framework for hackers.

用rvm安装ruby-1.9.3

| Comments

Octopress已经可以使用最新的ruby-1.9.3了,每次安装都会遇到一些问题,自己又记不住,每次都要Google,所以在这里简单的记录一下

首先安装curl

1
sudo apt-get -y install curl

安装rvm

1
curl -L https://get.rvm.io | bash -s stable

这时你还不能执行rvm这个命令,需要重新打开一个终端或者source ~/.bashrc

安装依赖包

1
rvm requirements

输出中会看到类似这样的一行

1
2
3
Additional Dependencies:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
  ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

按提示安装这些依赖包

1
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

安装python-dev,不然rake generate的时候会报Could not open library 'lib.so'的错

1
sudo apt-get install python-dev

如果你要使用tk,安装ruby前安装tk-dev可以省去好多麻烦

1
sudo apt-get install tk-dev

如果要使用rails,安装这些可以省去好多麻烦

1
sudo apt-get install build-essential git-core curl libmysqlclient-dev nodejs

最后安装ruby

1
rvm install 1.9.3

指定默认使用1.9.3

1
2
source ~/.rvm/scripts/rvm
rvm use 1.9.3 --default

打完收工

Comments