2012年6月29日金曜日

Mac の CLI から ISO イメージを作成する

Mac の CLI(Terminal.app)から ISO イメージを作成する方法です。思いっきり、[コマンド] マックでCDからISOイメージの作り方を参考にさせて頂きました。
$ drutil status
 Vendor   Product           Rev 
 TEAC     DV-W28S-W         L.0A

           Type: DVD-R                Name: /dev/disk2
       Sessions: 1                  Tracks: 1 
   Overwritable:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
     Space Free:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
     Space Used:   22:05:32         blocks:    99407 / 203.59MB / 194.15MiB
    Writability: 
      Book Type: DVD-R (v5)
       Media ID: SONY16D1

$ diskutil unmountDisk disk2
Unmount of all volumes on disk2 was successful

$ dd if=/dev/disk2 of=file.iso
397628+0 records in
397628+0 records out
203585536 bytes transferred in 49.532596 secs (4110133 bytes/sec)

$ diskutil mountDisk disk2
Volume(s) mounted successfully

2012年6月21日木曜日

Ubuntu 12.04LTS に Ruby on Rail 3 をインストールする

さくら VPS 上の Ubuntu 12.04LTS 上に Ruby + Rails3 をインストールした際のメモ書きです。

libyaml のインストール

先に書いてしまいますが、libyaml をインストールしないと以下のように yaml 関連のエラーが出てしまう為…
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
…予め libyaml をインストールしておきます。
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar -zxvf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4
$ ./configure
$ make
$ sudo make install

Ruby のインストール

次に Ruby 本体をインストールします。
$ cd
$ sudo apt-get -y install libssl-dev zlib1g-dev libreadline6-dev make
$ wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.9-stable.tar.bz2
$ tar -xjf ruby-1.9-stable.tar.bz2
$ cd ruby-1.9.3-p194
$ ./configure
$ make
    ・
    ・
    ・
Generating RI format into /home/enbutsu/ruby-1.9.3-p194/.ext/rdoc...

Files:        772

Classes:     1355 ( 701 undocumented)
Modules:      304 ( 151 undocumented)
Constants:   2249 ( 827 undocumented)
Attributes:  1010 ( 437 undocumented)
Methods:    10283 (3082 undocumented)

Total:      15201 (5198 undocumented)
 65.80% documented

Elapsed: 122.0s

$ sudo make install
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
RubyGems のバージョンを最新にしておきます。
$ sudo gem update --system
$ gem -v
1.8.24
gem 使用時に ri や rdoc をインストールしないように以下を記述します。
$ vi ~/.gemrc
install: --no-ri --no-rdoc
update: --no-ri --no-rdoc

Rail3 のインストール

Rails3 をインストールします。特にバージョンは指定せず、最新版をインストールしました。
$ sudo gem install rails
$ rails -v
Rails 3.2.6

SQLite3 のインストール

最後に SQLite3 をインストールします。
$ sudo apt-get -y install libsqlite3-dev
$ sudo gem install sqlite3

2012年6月19日火曜日

git&bitbucket でファイルのバージョン管理をする

会社の方に教えて頂いたのですが、bitbucket が便利そう。github とは違って、無料プランでもプライベート・リポジトリが作れるそうです。SSH の公開鍵を bitbucket アカウントの管理画面からアップロードしておき、後は git で push します。
$ cd code
$ git clone git@bitbucket.org:username/repository.git
$ git init
$ git add *
$ git commit -a -m "My first commit."
$ git remote add origin git@bitbucket.org:username/repository.git
$ git push origin master

2012年6月17日日曜日

Django 1.4 の syncdb でユーザ作成に関するエラー

ウン十の手習いで Python + Django をはじめてみました。環境は以下の通りです。

  • Mac OS X 10.7.4
  • Python 2.7.1.
  • Django 1.4
  • PyCharm 2.5.1
Getting Started with PyCharm as a Django Development を見ながら、ウンウン唸ってます… が、syncdb して superuser を作成しようとした際に以下のエラーが表示されてしまいました。
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Traceback (most recent call last):
  File "/Applications/PyCharm.app/helpers/pycharm/django_manage.py", line 20, in 

    -- snip --

line 85, in get_system_username
    return getpass.getuser().decode(locale.getdefaultlocale()[1])
TypeError: decode() argument 1 must be string, not None

Process finished with exit code 1
これは Django 1.4 に関する既知の問題だそうです。

確かに、上記サイトに書いてある対処でエラーは出なくなりました!

2012年6月14日木曜日

さくら VPS v2 で Windows を動かす夢を見た


世の中にはさくら VPS で、標準では用意されていない Windows を動作させている強者がいらっしゃるそうです。という夢を見ました。