Archive for 4月, 2009

CentOS:日本語platexをインストール

CentOSに日本語latexをインストールするのにかなり苦しんだのでメモ
こちらを参考にさせていただいた。
http://a1667203.blog.shinobi.jp/Entry/89/

/usr/local/srcにplatex3のソースを置き、ソースを展開する。
展開するのはptetex3-20080616.tar.gzだけでよい。他のものはmakeで自動的に解凍される。

mkdir /usr/local/src/platex3
cd /usr/loca/src/platex3
wget http://tutimura.ath.cx/~nob/tex/ptetex/ptetex3/ptetex3-20080616.tar.gz
wget http://www.ring.gr.jp/pub/text/CTAN/systems/unix/teTeX/3.0/distrib/tetex-src-3.0.tar.gz
wget http://www.ring.gr.jp/pub/text/CTAN/systems/unix/teTeX/3.0/distrib/tetex-texmf-3.0po.tar.gz
tar zxf ptetex3-20080616.tar.gz
cd ptetex3-20080616

my_optionをサンプルからコピー。

cp my_option.sample ../my_option

このあとは
make
su
make install
で完了のはずだが、私の環境ではいろいろ足りなかったのでyumでインストール
yum install gcc 
yum install gcc-c++
yum install bison

でもまだ完全にはmakeできない。こんなメッセージが出る
We are NOT going to compile xdvi.  We have two choices.
1. (with xdvi)    Check if we have X11 headers.
2. (without xdvi) Set XDVI=echo in "my_option" to omit xdvi test.
もちろんxdviも使いたい。X11 headersとは何だろう。
yum install xorg-X11-devel
としてみても解決しない。
仕方ないのでGNOMEから
アプリケーション>ソフトウェアの追加・削除
で、「開発」の「Xソフトウェア開発」にチェックを入れてインストール。

yum.logをみるとこれだけインストールされていた。
どれがどれか解らない・・・。
Apr 25 10:44:03 Installed: fontconfig-devel-2.4.1-7.el5.i386
Apr 25 10:44:05 Installed: libjpeg-devel-6b-37.i386
Apr 25 10:44:05 Installed: 2:libpng-devel-1.2.10-7.1.el5_3.2.i386
Apr 25 10:44:06 Installed: libXau-devel-1.0.1-3.1.i386
Apr 25 10:44:06 Installed: libfontenc-devel-1.0.2-2.2.el5.i386
Apr 25 10:44:12 Installed: alsa-lib-devel-1.0.17-1.el5.i386
Apr 25 10:44:13 Installed: xorg-x11-util-macros-1.0.2-4.fc6.i386
Apr 25 10:44:13 Installed: libmng-devel-1.0.9-5.1.i386
Apr 25 10:44:14 Installed: xorg-x11-xtrans-devel-1.0.1-1.1.fc6.i386
Apr 25 10:44:15 Installed: netpbm-devel-10.35-6.1.el5_3.1.i386
Apr 25 10:44:18 Installed: libtiff-devel-3.8.2-7.el5_2.2.i386
Apr 25 10:44:19 Installed: libdrm-devel-2.0.2-1.1.i386
Apr 25 10:44:34 Installed: libXcomposite-0.3-5.1.i386
Apr 25 10:44:37 Installed: libXvMC-1.0.2-2.1.i386
Apr 25 10:44:38 Installed: xrestop-0.2-6.2.2.i386
Apr 25 10:44:42 Installed: xorg-x11-proto-devel-7.1-9.el5.centos.i386
Apr 25 10:44:51 Installed: libX11-devel-1.0.3-9.el5.i386
Apr 25 10:44:52 Installed: libXext-devel-1.0.1-2.1.i386
Apr 25 10:44:56 Installed: mesa-libGL-devel-6.5.1-7.7.el5.i386
Apr 25 10:44:57 Installed: libXrender-devel-0.9.1-3.1.i386
Apr 25 10:44:57 Installed: libXfixes-devel-4.0.1-2.1.i386
Apr 25 10:44:59 Installed: mesa-libGLU-devel-6.5.1-7.7.el5.i386
Apr 25 10:44:59 Installed: libXv-devel-1.0.1-4.1.i386
Apr 25 10:45:00 Installed: libXrandr-devel-1.1.1-3.1.i386
Apr 25 10:45:01 Installed: libICE-devel-1.0.1-2.1.i386
Apr 25 10:45:01 Installed: libSM-devel-1.0.1-3.1.i386
Apr 25 10:45:02 Installed: libXdmcp-devel-1.0.1-2.1.i386
Apr 25 10:45:02 Installed: libXvMC-devel-1.0.2-2.1.i386
Apr 25 10:45:02 Installed: libXcomposite-devel-0.3-5.1.i386
Apr 25 10:45:03 Installed: libXdamage-devel-1.0.3-2.1.i386
Apr 25 10:45:04 Installed: libXft-devel-2.1.10-1.1.i386
Apr 25 10:45:04 Installed: libXevie-devel-1.0.1-3.1.i386
Apr 25 10:45:04 Installed: libXScrnSaver-devel-1.1.0-3.1.i386
Apr 25 10:45:05 Installed: libXxf86misc-devel-1.0.1-3.1.i386
Apr 25 10:45:05 Installed: libXtst-devel-1.0.1-3.1.i386
Apr 25 10:45:05 Installed: libXTrap-devel-1.0.0-3.1.i386
Apr 25 10:45:06 Installed: libXres-devel-1.0.1-3.1.i386
Apr 25 10:45:07 Installed: libXxf86vm-devel-1.0.1-3.1.i386
Apr 25 10:45:07 Installed: libXfontcache-devel-1.0.2-3.1.i386
Apr 25 10:45:07 Installed: libXxf86dga-devel-1.0.1-3.1.i386
Apr 25 10:45:07 Installed: libXcursor-devel-1.1.7-1.1.i386
Apr 25 10:45:08 Installed: libXfont-devel-1.2.2-1.0.3.el5_1.i386
Apr 25 10:45:11 Installed: libXt-devel-1.0.2-3.1.fc6.i386
Apr 25 10:45:11 Installed: libXpm-devel-3.5.5-3.i386
Apr 25 10:45:12 Installed: libXmu-devel-1.0.2-5.i386
Apr 25 10:45:13 Installed: Xaw3d-devel-1.5E-10.1.i386
Apr 25 10:45:14 Installed: gd-devel-2.0.33-9.4.el5_1.1.i386
Apr 25 10:45:17 Installed: SDL-devel-1.2.10-8.el5.i386
Apr 25 10:45:18 Installed: libXaw-devel-1.0.2-8.1.i386

けど、とりあえずmakeできたのでmake install
・・・
finished!
テストします。
PATH=/usr/local/teTex/bin:$PATH; export PATH
vi test.tex    # viでtexドキュメントを書く
platex -kanji=utf8 test.tex
This is pTeX, Version 3.141592-p3.1.10 (utf8.euc) (Web2C 7.5.4)
(./test.tex
pLaTeX2e <2006/11/10>+0 (based on LaTeX2e <2003/12/01> patch level 0)
(/usr/local/teTeX/share/texmf/ptex/platex/base/jarticle.cls
Document Class: jarticle 2006/06/27 v1.6 Standard pLaTeX class
(/usr/local/teTeX/share/texmf/ptex/platex/base/jsize10.clo)) (./test.aux)
[1] (./test.aux) )
Output written on test.dvi (1 page, 300 bytes).
test.log、test.dvi、test.auxというファイルができた。
とりあえずOKかな。
dviをビューワで見る
pxdvi test.dvi
Warning: Missing charsets in String to FontSet conversion
Warning: Missing charsets in String to FontSet conversion
ウォーニングが出るけど、日本語表示はできている。
最後にPDFにするテスト
/usr/local/teTeX/bin/dvipdfmx test.dvi
完璧です。

最後にパスとオプションの設定を.bashrcに残しておく。
$HOME/.bashrc
PATH=$PATH:/usr/local/teTeX/bin
alias platex="platex -kanji=utf8"

CentOS:ゲストOSにvmware-toolsをインストール

CentOS5.3のイメージにvmware-toolsを入れようとして詰まったこと。
インストールはあっさりできたのに。

クリップボードの共有ができない&ユニティ機能が有効にならない


問題なくインストが終わったように見えるのに実際はウィンドウのリサイズとHGFSが使えるようになっただけ。

肝心のクリップボードの共有&ユニティ機能使えない。

CentOS5.3に特有な問題なのだろうか、とあきらめかけたが天啓があって解決した。

天啓:kernel-develが無いんじゃないの?
# vmware-toolsをアンインストール
/usr/bin/vmware-uninstall-tools.pl
# kernel-develをインストール
yum install kernel-devel
# おまじないてきに再起動
reboot

再起動後、もう一度vmware-toolsをインストールする。
./vmware-install.pl

きたよ!いままで↓こういうperfectlyなメッセージは出なかったけど、これで完璧なはず。
The bld-2.6.18-8.el5-i686smp-RHEL5xn--vmmemctl module loads perfectly into the running kernel.

直ちに、クリップボード共有を有効にするにはコマンドで
/usr/bin/vmware-user

またはログアウト&ログイン。Xセッションの再起動。

vmxnetを有効にするには
/etc/init.d/network stop
rmmod pcnet32
rmmod vmxnet
modprobe vmxnet
/etc/init.d/network start

以下が今回のインストールの内容。
[root@localhost vmware-tools-distrib]# ./vmware-install.pl
Creating a new VMware Tools installer database using the tar4 format.

Installing VMware Tools.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path “/usr/share/doc/vmware-tools” does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]

The installation of VMware Tools 7.8.5 build-156735 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: “/usr/bin/vmware-uninstall-tools.pl”.

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: “/usr/bin/vmware-config-tools.pl”. Do you want
this program to invoke the command for you now? [yes] ]

The answer “]” is invalid. It must be one of “y” or “n”.

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: “/usr/bin/vmware-config-tools.pl”. Do you want
this program to invoke the command for you now? [yes]


Stopping VMware Tools services in the virtual machine:
Guest operating system daemon: [ OK ]
Virtual Printing daemon: [ OK ]
The bld-2.6.18-8.el5-i686smp-RHEL5xn--vmmemctl module loads perfectly into the
running kernel.

The bld-2.6.18-8.el5-i686smp-RHEL5xn--vmhgfs module loads perfectly into the
running kernel.

The bld-2.6.18-8.el5-i686smp-RHEL5xn--vmxnet module loads perfectly into the
running kernel.

The bld-2.6.18-8.el5-i686smp-RHEL5xn--vmblock module loads perfectly into the
running kernel.

[EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that
creates backups of virtual machines. Please refer to the VMware Knowledge Base
for more details on this capability. Do you wish to enable this feature?
[no]

The bld-2.6.18-8.el5-i686smp-RHEL5xn--vmci module loads perfectly into the
running kernel.

The bld-2.6.18-8.el5-i686smp-RHEL5xn--vsock module loads perfectly into the
running kernel.



Detected X.org version 7.1.


Please choose one of the following display sizes that X will start with (1xn--
29):

[1] “320×200″
[2] “320×240″
[3] “400×300″
[4] “512×384″
[5] “640×400″
[6] “640×480″
[7] “720×480″
[8] “800×480″
[9] “854×480″
[10] “720×576″
[11]< "800x600"
[12] "1024x768"
[13] "1280x720"
[14] "1280x768"
[15] "1152x864"
[16] "1280x800"
[17] "1366x768"
[18] "1280x960"
[19] "1440x900"
[20] "1280x1024"
[21] "1400x1050"
[22] "1680x1050"
[23] "1600x1200"
[24] "1920x1080"
[25] "1920x1200"
[26] "1920x1440"
[27] "2048x1536"
[28] "2560x1600"
[29] "2560x1920"
Please enter a number between 1 and 29:

[11]


X Window System Version 7.1.1
Release Date: 12 May 2006
X Protocol Version 11, Revision 0, Release 7.1.1
Build Operating System: Linux 2.6.18-53.1.14.el5PAE i686 Red Hat, Inc.
Current Operating System: Linux localhost.localdomain 2.6.18-128.1.6.el5 #1 SMP Wed Apr 1 09:19:18 EDT 2009 i686
Build Date: 21 January 2009
Build ID: xorg-x11-server 1.1.1-48.52.el5
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "/tmp/vmware-config0/XF86ConfigLog.3042", Time: Tue Apr 21 20:50:57 2009
(++) Using config file: "/tmp/vmware-config0/XF86Config.3042"

X is running fine with the new config file.

FreeFontPath: FPE "unix/:7100" refcount is 2, should be 1; fixing.
Starting VMware Tools services in the virtual machine:
Switching to guest configuration: [ OK ]
Guest filesystem driver: [ OK ]
Mounting HGFS shares: [ OK ]
Guest memory manager: [ OK ]
Guest vmxnet fast network device: [ OK ]
VM communication interface: [ OK ]
VM communication interface socket family: [ OK ]
Blocking file system: [ OK ]
Guest operating system daemon: [ OK ]
Virtual Printing daemon: [ OK ]

The configuration of VMware Tools 7.8.5 build-156735 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an X server session.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

To use the vmxnet driver, restart networking using the following commands:
/etc/init.d/network stop
rmmod pcnet32
rmmod vmxnet
modprobe vmxnet
/etc/init.d/network start

If the virtual printer feature is enabled, you will need to restart the CUPS
service to make use of this feature.

Enjoy,

--the VMware team

CentOS:日本語入力できるようにする

yumのリポジトリを作成し、キーを登録する。

cd /etc/yum.repos.d
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
wget http://centos.karan.org/kbsingh-CentOS-Misc.repo
rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt


yumでSCIM と Anthyをインストール
yum install anthy scim scim-anthy

システム設定入力メソッドを Anthy + SCIM へ切替える。
/usr/sbin/alternatives --config xinput-ja_JP

ここでサーバを再起動。
reboot

※今使っているVMwareイメージではブート状況の表示で日本語が四角くつぶれる。
ブートが進むと日本語表示されるようになるので気にしないことにする。

再起動してログインするとCtrl-Space(または半角/全角キー)でローマ字入力できるようになる。

※できない場合は入力メソッドでシステム設定に従う[SCIM]が選択されているか確認する。
システム>設定>他の個人設定>入力メソッド

玄箱pro:debian化

最も簡単に玄箱をLinux化できるdebian化の手順について。

前提
FLASHブートモードであること
HDDに何らかのデータが入っている
※入っていない場合は1.を飛ばす
debian化

1. HDDからパテーション状況を消去する
# df -k
ここでハードディスクがマウントされていたらアンマウントする。

# umount /mnt/disk1
fdiskでパテーションを削除
# dd if=/dev/zero of=/dev/sda1 bs=1 count=3
# dd if=/dev/zero of=/dev/sda2 bs=1 count=3
# dd if=/dev/zero of=/dev/sda3 bs=1 count=3
# dd if=/dev/zero of=/dev/sda4 bs=1 count=3
# fdisk /dev/sda
※fdiskのコマンドに”p”を入れて、表示されたパテーションを全部コマンド”d”で消す。最後に”w”で保存。

2. “mtd device”フォルダに起動イメージをコピーする
\\kurobox-pro\mtd deviceに以下のファイルを置く。

hddrootfs.tar.gz
ChangeMeDevHDD
ChangeMyUbootEnv
uImage.buffalo

3.玄箱本体リアのリセットボタンを5秒長押しする
しばらく待つ。このときシリアルポートのエコーを見ていても途中で反応が無くなる。
前面のLEDを見ること。

4.rootでログインし、ネットワークの設定等を変更する
/dev/sda2を/mnt/disk1にマウントする
# mkdir /mnt/disk1
# mount /dev/sda2 /mnt/disk1
各種設定は下記のファイルに記述する。viが使えます。
ネットワーク設定
/mnt/disk1/etc/network/interfaces
名前解決
/mnt/disk1/etc/resolv.conf
hosts
/mnt/disc1/etc/hosts
ホスト名
/mnt/disk1/etc/hostname
5.玄箱を再起動

# reboot
以降、玄箱はHDDブートで起動します。

6.セットアップスクリプトを流す。
rootでログインしてセットアップスクリプトを流します。

# cd /usr/local/sbin/
# sh KURO-BOX-Pro_setup.sh

7. 玄箱をシャットダウンする
# shutdown -h now

玄箱pro:初期状態の起動オプションでFALSHブートを行う

U-Bootの画面でU-bootの起動オプションを変更

COMポートからシリアル接続してU-Bootの画面を出します。
下記のとおり起動オプションを変更する。

Marvell>> setenv bootargs_root root=/dev/mtdblock2 rw panic=5
Marvell>> setenv bootcmd ‘nboot $(default_kernel_addr) 0 $(nand_uImage_offset); bootm $(default_kernel_addr)’
Marvell>> setenv nand_boot yes
Marvell>> setenv bootargs $(bootargs_base) $(bootargs_root) $(bufflo_ver)

設定を保存し起動する
Marvell>> save
Marvell>> boot

玄箱pro:FLASHメモリを初期状態に戻す

  1. TFTPサーバー Poor TFTP Server for WIN32をダウンロードし、適当な場所に解凍する。
  2. 公式サイトの玄箱proのページから【ファームウェア(NAND型フラッシュメモリ)初期化方法F/W1.02】をダウンロード、解凍して出来たinitrd.buffaloとuImage.buffaloをTFTPサーバーのフォルダに置く。
    ※ここでダウンローするzipの中に初期化の詳しい説明がある。
  3. 玄箱のIPアドレスを調べる(以降、仮に192.168.11.150とします)
  4. PCのIPアドレスを玄箱からアクセスできるように変更する(以降、仮に192.168.11.10とします)
  5. 玄箱proの電源はONにしておき、PCからシリアル接続する
  6. PCでTFTPサーバーを起動する。

  7. U-Bootの画面でserveripの値をPCのIPアドレスに変更し、起動する
    Marvell>> setenv serverip 192.168.11.10
    Marvell>> save
    Marvell>> boot
    これでTFTPからダウンロードしたイメージで起動されます。しばらく待つ。
  8. 起動後、rootでログインする。パスワードは”kuroadmin”
  9. NANDフラッシュメモリの書き換えを行う。
    # update_mtd.sh all

玄箱pro:仮想COMポートドライバのインストール

仮想COMポートドライバのインストール

  1. ドライバ VCP Drivers をダウンロードする。
  2. SCON-KIT/PROをPCのUSBポートに差す。
  3. 「ハードウェアの検索ウィザード」が始まるので、下記のように進める。
    いいえ、今回は接続しません→
    次へ→
    一覧または特定の場所からインストールする→
    次へ→
    次の場所を含めるを選択→
    解凍したVCPのフォルダを参照→
    次へ
    
※同じインストールを2回繰り返す。

シリアルポート接続

シリアルポート接続をするターミナルはTeraTerm pro UTF-8対応版が文字化けしなくて良い。

COMポートを指定して、接続設定を下記のパラメタに合わせれば接続できる。

KURO-BOX/PRO シリアルコンソール仕様
Bps
115200bps
Data
8bit
Parity
None
Stop
8bit
Flow Ctrl
None

携帯サイト:フォームのmode属性、istyle属性

携帯端末で利用する入力フォームでtextまたはpasswordコントロールに下記のような属性を与えれば入力モードの指定ができます。

istyle mode
全角かな 1 hiragana
半角カナ 2 katakana
英字 3 alphabet
数字 4 numeric

istyle属性はdocomoとauで有効。mode属性はvodafoneで有効です。

softbankはC2以降がmode属性に対応、C3以降はmode属性とistyle属性両方に対応しています。

このように両方を書いておけばどちらの機種にも対応できます。
<input type="text" name="text1" istyle="1" mode="hiragana">

mysql:MySQLのバックアップとリストア

mysqldumpでバックアップ&リストア

すべてのデータベースをdumpでバックアップ

$ mysqldump -u root -p -x --all-databases > dump.sql
特定のデータベースをバックアップするときは
$ mysqldump -u root -p データベース名 > dump.sql
すべてのデータベースを復元するときは
$ mysql -u root -p < dump.sql
特定のデータベースを復元するときは
$ mysql -u root -p データベース名 < dump.sql

mysql:mysqlとsennaのインストール

yumで要るものを全部入れる。

yum install mecab
yum install mecab-ipadic
yum install senna
yum install MySQL-shared
yum install MySQL-client
yum install MySQL-server

mysql -urootでログインして、↓このように”Tritonn Project”のバージョンが表示されればOK。 mysql -Vでは表示されないので注意。

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2419
Server version: 5.0.51a-modified-log MySQL Community Server (GPL) (portions (c) Tritonn Project)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysqlインストール後の儀式、rootのパスワードを変更する。
mysqladmin -u root password パスワード


次にmy.cnfを設定する。
/usr/share/mysql/にある雛形を使ってmy.cnfを作成する。雛形はサーバスペックにあわせて選ぶ。意味なく大きいのにしないこと。

my.cnf雛形選択の目安
my-small.cnf
64Mバイト以下のメモリの小規模サーバー向け
my-medium.cnf
32M~64Mバイトのメモリを持つMySQL専用サーバーか、128Mバイトのメモリを持つサーバー向け
my-large.cnf
512Mバイト程度のメモリを持ち、MySQL専用となる機械向け
my-huge.cnf
1G~2Gバイトのメモリを持つMySQL専用サーバー向け
my-innodb-heavy-4G.cnf
4Gバイトのメモリ、InnoDBのみ、ACID、少ない接続、大量のクエリ

/etc/my.cnfを作る
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
デフォルトUTF8で使うときの文字コードの設定をmy.cnfに追加する
/etc/my.cnf
[mysqld]
default-character-set=utf8
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8

[mysqldump]
default-character-set = utf8

[mysql]
default-character-set = utf8

次ページへ »