有馬総一郎のブログ

(彼氏の事情)

2017年02月03日 02:24:29 JST - 3 minute read - Comments - Octopress

Octopressをセットアップする

まずは、公開するブログを生成するためのツール(という呼称が正しいかは知らんが) Octopressを導入する。

どうも、 Octopress 3.0 Is Comingとか言っちゃって、バージョンアップされる過渡期っぽいのだが、3.0に対する情報は少すぎるので、無視。そもそも公式ページの導入案内から3.0ではなく、古い?まんまだ。

やり方はWindows環境でなければ、難しくないはず。Windows環境でも一時期、自分も動けるようにしていたのだが、themeなど導入してたら、いつのまにか動かなくなってしまった…今はやりの Bash on Ubuntu on Windowsでの導入もやってみたのだけど、どうも上手くいかないので諦め。Ruby周りの環境設定が素人には鬼なので、大人しく仮想環境での導入をオススメしたい。遠回りのようので一番、それが安定して近道な気がする。

自分のとき(Ubuntu 16.04.01)は、すんなり上手くいったのだが、その後、手順の確認するために Oracle VM VirtualBoxの仮想環境に Lubuntu 16.04(32bit) をインストールするも上手くいったりいかなかったりで、よく分からないので、ここでは Lbuntu 14.04(32bit) で成功した手順を載せておく。

Octopress Setup - Octopress
↑基本はこのまんま。

lubuntu32@VirtualBox:~/$ sudo apt install git
lubuntu32@VirtualBox:~/$ sudo apt install ruby1.9.3 ruby-dev
lubuntu32@VirtualBox:~/$ sudo apt install nodejs
lubuntu32@VirtualBox:~/$ sudo apt install rbenv
lubuntu32@VirtualBox:~/$ git clone git://github.com/imathis/octopress.git octopress
lubuntu32@VirtualBox:~/octopress$ cd octopress
lubuntu32@VirtualBox:~/octopress$ rbenv rehash
lubuntu32@VirtualBox:~/octopress$ sudo gem install bundler
lubuntu32@VirtualBox:~/octopress$ bundle install
lubuntu32@VirtualBox:~/octopress$ rake install

追記: 2017-08-06
あれこれ試行錯誤した結果としてrubyのバージョンは2.3.1だとすんなりうまく行くようだ。

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install gcc build-essential libssl-dev libreadline-dev zlib1g-dev
rbenv versions
rbenv install 2.3.1
rbenv versions
history
sudo apt install nodejs
sudo apt install python-minimal
sudo apt update
sudo apt upgrade -y
git clone git://github.com/imathis/octopress.git octopress
cd octopress/
rbenv local 2.3.1
rbenv rehash
gem install bundler
bundle install
rake install

追記ここまで

これで初期設定、完了。記事を新規投稿するにはrake new_post["タイトル"]を打つ。すると、sorce/_posts/配下に yyyy-mm-dd-title.markdownのファイルが作成されるので、それをmarkdown記法で記述する。

lubuntu32@VirtualBox:~/git/octopress$ rake new_post["test post"]
mkdir -p source/_posts
Creating new post: source/_posts/2016-12-09-test-post.markdown

ブログの確認はrake previewをコマンドで打ち。ブラウザで http://localhost:4000/ にアクセルすれば、ブログが閲覧できる。

lubuntu32@VirtualBox:~/git/octopress$ rake preview
Starting to watch source with Jekyll and Compass. Starting Rack on port 4000
DEPRECATION WARNING:
Sass 3.5 will no longer support Ruby 1.9.3.
Please upgrade to Ruby 2.0.0 or greater as soon as possible.

directory source/stylesheets
DEPRECATION WARNING on line 87 of /var/lib/gems/1.9.1/gems/compass-core-1.0.3/stylesheets/compass/css3/_deprecated-support.scss: #{} interpolation near operators will be simplified
in a future version of Sass. To preserve the current behavior, use quotes:

    unquote('"$moz-"#{$experimental-support-for-mozilla} "$webkit-"#{$experimental-support-for-webkit} "$opera-"#{$experimental-support-for-opera} "$microsoft-"#{$experimental-support-for-microsoft} "$khtml-"#{$experimental-support-for-khtml}')

You can use the sass-convert command to automatically fix most cases.

DEPRECATION WARNING on line 92 of /var/lib/gems/1.9.1/gems/compass-core-1.0.3/stylesheets/compass/css3/_deprecated-support.scss: #{} interpolation near operators will be simplified
in a future version of Sass. To preserve the current behavior, use quotes:

    unquote('"$ie6-"#{$legacy-support-for-ie6} "$ie7-"#{$legacy-support-for-ie7} "$ie8-"#{$legacy-support-for-ie8}')

You can use the sass-convert command to automatically fix most cases.

        write source/stylesheets/screen.css
[2017-02-03 02:03:40] INFO  WEBrick 1.3.1
[2017-02-03 02:03:40] INFO  ruby 1.9.3 (2013-11-22) [i686-linux]
[2017-02-03 02:03:40] INFO  WEBrick::HTTPServer#start: pid=9691 port=4000
DEPRECATION WARNING:
Sass 3.5 will no longer support Ruby 1.9.3.
Please upgrade to Ruby 2.0.0 or greater as soon as possible.

>>> Compass is watching for changes. Press Ctrl-C to Stop.
directory public/stylesheets
DEPRECATION WARNING:
Sass 3.5 will no longer support Ruby 1.9.3.
Please upgrade to Ruby 2.0.0 or greater as soon as possible.

Configuration file: /home/lu/octopress/_config.yml
                        Source: source
             Destination: public
            Generating... 
                                        done.
 Auto-regeneration: enabled for 'source'
        write public/stylesheets/screen.css
127.0.0.1 - - [03/Feb/2017:02:04:00 +0900] "GET / HTTP/1.1" 200 3198 0.0794
127.0.0.1 - - [03/Feb/2017:02:04:00 +0900] "GET /stylesheets/screen.css HTTP/1.1" 200 40215 0.0029
127.0.0.1 - - [03/Feb/2017:02:04:00 +0900] "GET /javascripts/modernizr-2.0.js HTTP/1.1" 200 7020 0.0027
127.0.0.1 - - [03/Feb/2017:02:04:00 +0900] "GET /javascripts/octopress.js HTTP/1.1" 200 8357 0.0038
127.0.0.1 - - [03/Feb/2017:02:04:00 +0900] "GET /favicon.png HTTP/1.1" 200 211 0.0009
127.0.0.1 - - [03/Feb/2017:02:04:00 +0900] "GET /images/line-tile.png?1486055006 HTTP/1.1" 200 566 0.0007
127.0.0.1 - - [03/Feb/2017:02:04:00 +0900] "GET /images/noise.png?1486055006 HTTP/1.1" 200 16921 0.0027

警告がでるかも知れないが、取り敢えず今は無視

有馬総一郎のブログ

Tags: AWS ameblo Octopress

Firefox 51でvimperatorのtabopenを動くようにする Octopress導入ではまったこと

comments powered by Disqus