2010/09/27
"extconf failure: need libm"
chef-serverをインストールしようと思ったら、"extconf failure: need libm"で失敗したメモ。
ググっても出てこなかったので書いておく。環境はCentOS 5.4。
# gem install chef-server Building native extensions. This could take a while... ERROR: Error installing chef-server: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for socket() in -lsocket... no checking for gethostbyname() in -lnsl... no checking for atan() in -lm... no checking for atan() in -lm... no extconf failure: need libm Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/libxml-ruby-1.1.4 for inspection. Results logged to /usr/lib64/ruby/gems/1.8/gems/libxml-ruby-1.1.4/ext/libxml/gem_make.out
"extconf failure: need libm"とのことだが、
libm.aとかlibm.soは存在していて、ライブラリとして認識されているはず。
mkmf.logを確認
ということで、mkmf.logを見てみることにした。
今回の場合は「/usr/lib64/ruby/gems/1.8/gems/libxml-ruby-1.1.4/ext/libxml/mkmf.log」の場所。
~~~省略~~~ /usr/bin/ld: cannot find -lruby-static collect2: ld はステータス 1 で終了しました ~~~省略~~~
最初から、こいつも一緒にエラー出力してほすぃ。
というわけで、以下のように"ruby-static"をインストールした後に、
"gem install chef-server"を再実行することでchef-serverのインストールは成功。
# yum install ruby-static
2010/09/26
Rubygemsで入れたパッケージをアンインストール(削除)
Ruby |
今更ながら。
# gem uninstall {パッケージ名}
で実行する。
# gem uninstall gettext Select gem to uninstall: 1. gettext-2.0.4 2. gettext-2.1.0 3. All versions > 2
複数のバージョンが入っているときは、どのバージョンを削除するかたずねてくれる。
You have requested to uninstall the gem: gettext-2.1.0 gettext_activerecord-2.1.0 depends on [gettext (>= 2.1.0)] gettext_activerecord-2.0.4 depends on [gettext (>= 2.0.4)] If you remove this gems, one or more dependencies will not be met. Continue with Uninstall? [Yn] Successfully uninstalled gettext-2.1.0
もし、他のパッケージとの依存関係が残っている場合は、↑な感じで聞いてくれるので安心。
2010/09/22
chef-clientコマンドで出力されるログレベルを変更
Chef |
"-l"オプション、もしくは"--log_level"オプションを使う。
$ chef-client -l debug
参考
-l, --log_level LEVEL Set the log level (debug, info, warn, error, fatal)
2010/09/21
Ubuntuのmanを日本語化する
Linux |
英語に自信がない時とか。
$ sudo apt-get install manpages-ja
英語に戻したくなったら、一時的に"LANG=C"などを付けて実行で。
あ、manの"-L"オプションで"us"を指定しても英語で表示される。
2010/09/17
「Programming Ruby - The Pragmatic Programmer's Guide」を"インストール"する
Ruby |
今更ながら気付いたのですが、aptで"インストール"できちゃうんですね。
$ sudo apt-get install rubybook
"/usr/share/doc/rubybook/html/index.html" に入るので、Firefoxとかw3mで眺めれば良し。
grep(検索)できちゃうので便利・・・だが、英語なので読むオーバーヘッドが...(-o-;)
2010/09/16
Ubuntuのログイン画面(GDM,GNOME)でユーザ選択を表示させない方法
Linux |
$ sudo -u gdm gconftool-2 --set --type boolean /apps/gdm/simple-greeter/disable_user_list true
Ubuntu 10.04 (Lucid Lynx) で確認。
2010/09/15
Model定義の変更時にDBへ簡単に反映させるDjango Evolution
Djangoで、Model(モデル)の定義を変更した時に、DB定義も簡単に変更・反映(マイグレーション)してほしいところだが、Djangoには標準でそういう機構がない、と。
そこで、それを実現する「django-evolution」を使ってみた。
インストール
Ubuntuでやってみた。
$ sudo apt-get install python-django-evolution
設定とか
settings.pyを編集し、"INSTALLED_APPS"に以下のような感じで追記。
INSTALLED_APPS = ( ・・・省略・・・ 'django_evolution', )
次に、本題のmodels.pyを編集し、定義変更したいカラムを弄ります。
試しに、"max_length"の値を変更してみた。以下、実行例です。
DB定義を変更するためのDDL(DML)を確認
$ ./manage.py evolve --hint --sql -- Evolve application server UPDATE `servers` SET `memo`=LEFT(`memo`,2048); ALTER TABLE `servers` MODIFY COLUMN `memo` varchar(2048);
実際に、DB定義を変更・反映する
一応↑でどんなDDL(DML)が発行されるか確認の上、実行しましょう。
途中で、実行してよいかの確認があります。
$ ./manage.py evolve --hint --execute You have requested a database evolution. This will alter tables and data currently in the 'srvmgr' database, and may result in IRREVERSABLE DATA LOSS. Evolutions should be *thoroughly* reviewed prior to execution. Are you sure you want to execute the evolutions? Type 'yes' to continue, or 'no' to cancel: yes Evolution successful.
実際に変更を確認し、DBマイグレーションdone.
参考
2010/09/14
Chef clientのチュートリアル
本家Opscodeのサポートページで紹介されている、以下順にやっていくと、まずは躓かず雰囲気をつかめる。
ServerはOpscode Platformのモノを利用させてもらえる前提。
さて、次は、recipeとcookbookいってみよ。
ちなみにOpscode PlatformはAmazon EC2やS3がバックエンドで使われていた。
追記(2011/02/18)
リンク切れしていたので、リンク先を最新のURLに修正。
2010/09/13
SyntaxError: Non-ASCII character '\xe3' ...
Python |
SyntaxError: Non-ASCII character '\xe3' ... but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
コードが書かれているファイルの先頭に、以下のように文字コードを明示してやればOK。
#-*- coding: utf-8 -*-
検索エンジン用のおまけ
以下のような場合も。
Exception Value: Non-ASCII character '\xe8' ...
2010/09/09
VMWareのディスクイメージ".vmdk"をLinuxからmountする
マウント
# yum install fuse-libs -y # modprobe fuse # vmware-mount /path/to/test.vmdk 1 /mnt/
"1"の部分は、パーティションナンバー。
アンマウント
# vmware-mount -d /mnt
vmware-mount: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory
必要なライブラリをインストール。 ⇒ "yum install fuse-libs -y"
fuse: device not found, try 'modprobe fuse' first
文字通り。 ⇒ "modprobe fuse"
参考
# vmware-mount VMware DiskMount Utility version 2.0.1, build-156745 Usage: vmware-mount diskPath [partition num] mountPoint vmware-mount [option] [opt args] There are two modes for mounting disks. If no option is specified, we mount individual partitions from virtual disks independently. The filesystem on the partition will be accessible at the mount point specified. The -f option mounts a flat representation of a disk on a user-specified mount point. The user must explicitly unmount the disk when finished. A disk may not be in both modes at once. diskID is an identifier of the form username@hostname:/path/to/vm for remote disks and just the path for local disks. Options that mount a remote disk also require -h -u -F and optionally -v options. The -v option is required when connecting to a Virtual Center. Options: -p <diskID> list all partitions on a disk -l <diskID> list all mounted partitions on a disk -L list all mounted disks -d <mountPoint> cleanly unmount this partition (closes disk if it is the last partition) -f <diskPath> <mountPoint> mount a flat representation of the disk at "mountPoint/flat." -k <diskID> unmount all partitions and close disk -K <diskID> force unmount all partitions and close disk -x unmount all partitions and close all disks -X force unmount all partitions and close all disks Options for remote disks: -v inventory path of the vm -h hostname of remote server -u username for remote server -F file containing password -P optional TCP port number (default: 902)
2010/09/03
File Descriptorまわりの設定確認
Linux |
via. http://www.slogical.co.jp/tech/linux_proc_sys_fs_file.html
/proc/sys/fs/file-max
オープン可能なファイル数の上限を確認できる。 値の変更を行うことも可能。
/proc/sys/fs/file-nr
次の3つの情報を確認することが可能です。 1. 今までにオープンしたことのあるファイルの最大数 (割り当て済みのファイルハンドル数 ) 2. 現在オープンしているファイルの総数 (使用中のファイルハンドル数 ) 3. オープン可能なファイル数の上限 (/proc/sys/fs/file-max と同じ値)