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]が選択されているか確認する。
システム>設定>他の個人設定>入力メソッド

CentOS:memcachedをインストール

CentOs5.2のリポジトリにmemcachedは無いのでリポジトリを追加する。

cd /usr/local/src
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm
mencachedを入れるのに必要なモジュールをインストールする。
たぶんこのあたりを入れておけばおっけーなはず。
yum install gcc
yum install memcached
yum install zlib-devel
yum install php-pecl-memcache

memcachedの設定は/etc/sysconfig/memcachedを編集する。
動かすだけならデフォルトのままでOK。
memcacheの起動
/etc/init.d/memcached start

サービスを自動起動にしておく。
chkconfig memcached on

テストスクリプト
<?php
    $cache = new Memcache;
    $key = 'cache_test';
    $cache->connect('localhost', 11211);
    if(!$cache->get($key)){
        // キャッシュの有効時間は15秒
        $cache->set($key, date('Y-m-d h:i:s'), MEMCACHE_COMPRESSED, 15);
    }
    echo $cache->get($key);
?>

centOS:yum-cronの設定

パッケージ更新のダウンロードまでは自動でやっておいて欲しいのでyum-cronをインストールした。
そのメモ。

# yum install yum-cron
インストールされた内容は
# rpm -ql yum-cron
/etc/cron.daily/yum.cron
/etc/cron.weekly/yum.cron
/etc/rc.d/init.d/yum-cron
/etc/sysconfig/yum-cron
/etc/yum/yum-daily.yum
/usr/share/doc/yum-cron-0.6
/usr/share/doc/yum-cron-0.6/COPYING
/usr/share/doc/yum-cron-0.6/README

設定ファイルは/etc/sysconfig/yum-cron。
初期状態だとパッケージ更新まで自動で行うようになっているので、設定ファイルを変更する。httpdのように更新を反映するのにrestartが必要なパッケージが放置されないように、当分は更新チェック、ダウンロードまで自動。アップデートは手動で行うつもり。
/etc/sysconfig/yum-cron
# Don’t install, just check (valid: yes|no)
CHECK_ONLY=yes
# Don’t install, just check and download (valid: yes|no)
# Implies CHECK_ONLY=yes (gotta check first to see what to download)
DOWNLOAD_ONLY=yes

設定したらyum-cronの再起動する。
# /etc/init.d/yum-cron restart
# yum check-update
これでrootにメールが来るようになる。

最後にyum-updatesdを止める。
# /etc/init.d/yum-updatesd stop
# /sbin/chkconfig yum-updatesd off

centOS:CentOS:yumのCtrl+Cとyum-fastestmirror

知らなかったこと。
yumでパッケージをアップデートしようしていてパッケージが少しずつしか落ちてこないから、Ctrl+Cで中断しようとしたら勝手にミラーが替わって続きからダウンロードされた。
更新は異常ないみたいだけど、こんな機能あったんだ。

今回の更新でyum-fastestmirrorが入ったからもうこの機能を活用することはなさそうだけど。

今日はもう一台更新する必要があったので、そっちはちゃんと先にyum-fastestmirrorを入れた。少しだけ時間を得したはず。

# yum install yum-fastestmirror
# yum check-update
Loading "fastestmirror" plugin
・・・
# yum update