[Ubuntu系统] Ubuntu中octopress安装

425 0
Honkers 2026-5-27 15:26:23 来自手机 | 显示全部楼层 |阅读模式

这是一篇按官方说明进行安装的说明,但后记中记录了如何使用Ubuntu自己的包管理系统中包含的ruby版本进行安装的方法。

  • 安装条件
  • Octopress的安装
    • 后记——使用UBUNTU自带版本安装

安装条件

要有git,要有ruby1.9.3版,要有rvm或者rbenv。

不过rvm似乎只是用来安装ruby,所以不清楚如果已经安装配置了ruby1.9.3版,是不是就不用它了呢?

RVM的安装方法参考Octopress的说明是这样的:

在命令行下执行:

  • list element with functor item
  1. curl -L https://get.rvm.io | bash -s stable --ruby <!-- more -->
复制代码
  • list element with functor item
  • list element with functor item

安装过程中会自动安装ruby2.1.2:

  1. ruby-2.1.2 - #validate archive
  2. ruby-2.1.2 - #extract
  3. ……
  4. $ ruby --version
  5. ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
复制代码

所以应该需要:

  1. rvm install 1.9.3
  2. rvm use 1.9.3
  3. rvm rubygems latest
复制代码

最后会告诉你:

  1. * To start using RVM you need to run `source /home/pangyi/.rvm/scripts/rvm`
  2. in all your open shell windows, in rare cases you need to reopen all shell windows.
复制代码

还要装一下rake,需要使用gem:

  1. sudo gem install rake
复制代码

Octopress的安装

首先:

  1. git clone git://github.com/imathis/octopress.git octopress
  2. cd octopress
复制代码

然后安装主题:

  1. sudo gem install bundler
  2. bundle install
  3. rake install
复制代码

在UBUNTU中需要加sudo。如果rake没装,请看上面。

后记——使用UBUNTU自带版本安装

UBUNTU自带版本为:

  1. $ ruby -v
  2. ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
复制代码

为了迁就octoeditor等VIM插件(从gvim启动时,无法用rvm use指定ruby版本),就需要以这个版本来安装了。安装时报了一些错误:

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
复制代码
  1. $ bundle install
  2. Fetching gem metadata from https://rubygems.org/.......
  3. Using rake 10.3.2
  4. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
  5. /usr/bin/ruby1.9.1 extconf.rb
  6. /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
  7. from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
  8. from extconf.rb:1:in `<main>'
  9. Gem files will remain installed in /tmp/bundler20141115-3546-1wbtw8p/RedCloth-4.2.9/gems/RedCloth-4.2.9 for inspection.
  10. Results logged to /tmp/bundler20141115-3546-1wbtw8p/RedCloth-4.2.9/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
  11. An error occurred while installing RedCloth (4.2.9), and Bundler cannot
  12. continue.
  13. Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
复制代码

查了一下,问题是一些相关的包,如dev包没有安装,最简单也比较土的办法是安装完全版本:

  1. sudo apt-get install ruby1.9.1-full
复制代码

之后bundle install就没有报错了。

由于是重新安装,只要做bundle install就行了,不需要重新安装主题。此时rake的相关操作都可以正常执行,在vim中使用octoeditor插件时就不会出问题了。

转载于:https://www.cnblogs.com/maoxiong/p/4298204.html

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行