2010年10月6日水曜日

CentOSにvim7.3をインストールする

CentOSの標準リポジトリーにあるのは旧バージョンのvimなので
最新のvim7.3をインストールします
まず既存のvimをアンインストールし必要なパッケージを追加します
[root@blog.m264.com ~]$ yum -y remove vim-enhaced vim-common
[root@blog.m264.com ~]$ yum -y install ncurses-devel patch gcc

次に必要なファイルをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/vim730
--2010-10-06 00:35:16--  
Resolving short.m264.info... 168.143.174.97
Connecting to short.m264.info|168.143.174.97|:80... connected.
HTTP request sent, awaiting response... 301 Moved
Location: http://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 [following]
--2010-10-06 00:35:16--  http://short.m264.info/vim730
Resolving ftp.vim.org... 192.87.102.42, 192.87.102.43, 2001:610:1:80aa:192:87:102:42, ...
Connecting to ftp.vim.org|192.87.102.42|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9080692 (8.7M) [application/x-bzip2]
Saving to: `vim-7.3.tar.bz2'

100%[=========================================================>] 9,080,692    894K/s   in 15s

解凍してパッチフォルダを作ります
[root@blog.m264.com ~]$ tar -xvf ./vim-7.3.tar.bz2
[root@blog.m264.com ~]$ mkdir patches
[root@blog.m264.com ~]$ cd vim73/patches

パッチをダウンロードします
http://short.m264.info/ayQLCM からパッチの数を確認してください
(7.3.*** ←ココの数字が何番まであるか確認)

[root@blog.m264.com ~]$ seq -f http://ftp.vim.org/pub/vim/patches/7.3/7.3.%03g パッチの数 | xargs wget
--2010-10-06 00:28:21--  http://ftp.vim.org/pub/vim/patches/7.3/7.3.001
Resolving ftp.vim.org... 192.87.102.43, 192.87.102.42, 2001:610:1:80aa:192:87:102:42, ...
Connecting to ftp.vim.org|192.87.102.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1720 (1.7K) [text/plain]
Saving to: `7.3.001'

100%[=====================================================>] 1,720       --.-K/s   in 0.001s

2010-10-06 00:28:24 (2.06 MB/s) - `7.3.019' saved [2747/2747]

-----------
パッチの数だけダウンロードするのでパッチの数によっては時間がかかる
-----------

--2010-10-06 00:28:24--  http://ftp.vim.org/pub/vim/patches/7.3/7.3.019
Connecting to ftp.vim.org|192.87.102.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2987 (2.9K) [text/plain]
Saving to: `7.3.019'

100%[======================================================>] 2,987       --.-K/s   in 0.001s

パッチを当てる
[root@blog.m264.com ~]$ cat patches/7.3.* | patch -p0
patching file src/misc1.c
patching file src/version.c
patching file src/ex_docmd.c
patching file src/version.c
patching file src/quickfix.c
patching file src/version.c
patching file src/regexp.c
patching file src/version.c
patching file src/eval.c
patching file src/testdir/Makefile
patching file src/testdir/test61.in
patching file src/version.c
patching file src/mbyte.c
patching file src/spell.c
patching file src/version.c
patching file src/if_py_both.h
patching file src/version.c
patching file src/buffer.c
patching file src/diff.c
patching file src/ex_cmds.c
patching file src/ex_cmds2.c
patching file src/ex_docmd.c
patching file src/ex_getln.c
patching file src/if_cscope.c
patching file src/macros.h
patching file src/quickfix.c
patching file src/search.c
patching file src/tag.c
patching file src/window.c
patching file src/version.c
patching file src/os_win32.c
patching file src/version.c
patching file src/gui_mac.c
patching file src/version.c
patching file src/ui.c
patching file src/os_unix.c
patching file src/version.c
patching file src/Make_ming.mak
patching file src/GvimExt/Make_ming.mak
patching file src/version.c
patching file src/if_ruby.c
patching file src/version.c
patching file src/ex_getln.c
patching file src/version.c
patching file src/testdir/test49.vim
patching file src/version.c
patching file runtime/doc/netbeans.txt
patching file src/gui.c
patching file src/main.c
patching file src/netbeans.c
patching file src/version.c
patching file src/spell.c
patching file src/syntax.c
patching file src/version.c
patching file src/Make_ming.mak
patching file src/GvimExt/Make_ming.mak
patching file src/version.c
patching file src/netbeans.c
patching file src/version.c
configureする(オプションはお好みで)
[root@blog.m264.com ~]$ ./configure --prefix=/usr --enable-multibyte --with-features=huge --disable-selinux
configure: loading cache auto/config.cache
checking whether make sets $(MAKE)... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for library containing strerror... none required
以下略
makeしてインストール!
[root@blog.m264.com ~]$ make
mkdir objects
CC="gcc -Iproto -DHAVE_CONFIG_H         " srcdir=. sh ./osdef.sh
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/buffer.o buffer.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/blowfish.o blowfish.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/charset.o charset.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/diff.o diff.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/digraph.o digraph.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/edit.o edit.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/eval.o eval.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_cmds.o ex_cmds.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_cmds2.o ex_cmds2.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_docmd.o ex_docmd.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_eval.o ex_eval.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_getln.o ex_getln.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/fileio.o fileio.c
以下略
[root@blog.m264.com ~]$ make install
Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src && make install
make[1]: Entering directory `/root/work/vim/vim73/src'
if test -f /usr/bin/vim; then \
          mv -f /usr/bin/vim /usr/bin/vim.rm; \
          rm -f /usr/bin/vim.rm; \
        fi
cp vim /usr/bin
strip /usr/bin/vim
chmod 755 /usr/bin/vim
/bin/sh ./mkinstalldirs /usr/share/vim
mkdir /usr/share/vim
chmod 755 /usr/share/vim
cp vimtutor /usr/bin/vimtutor
以下略
vimを起動する
vim

1
~
~                                   VIM - Vi IMproved
~
~                                     version 7.3.19
~                                by Bram Moolenaar et al.
~                      Vim is open source and freely distributable
~
~                             Help poor children in Uganda!
~                     type  :help iccf       for information
~
~                     type  :q               to exit
~                     type  :help  or    for on-line help
~                     type  :help version7   for version info
~

2010年10月1日金曜日

VirtualboxやVMware 及び Virtual PC等のHDDイメージを双方向に変換する方法

VirtualBoxにはVBoxManageというツールが標準で着いてくるのでそれを使います
現にVirtualBoxを導入済みと仮定して話を進めます
コマンドプロンプトを起動します (windows + rの後表示されたウィンドウにcmdと入力してOKを押す)
まずディレクトリに移動します
cd C:\Program Files\Oracle\VirtualBox
VDIから各イメージに変換
VDIからVMDKに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VDI -dstformat VMDK c:\test.vdi c:\test.vmdk

VDIからVHDに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VDI -dstformat VHD c:\test.vdi c:\test.vhd

VDIからRAWに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VDI -dstformat RAW c:\test.vdi c:\test.raw

VMDKから各イメージに変換
VMDKからVDIに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VMDK -dstformat VDI c:\test.vmdk c:\test.vdi

VMDKからVHDに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VMDK -dstformat VHD c:\test.vmdk c:\test.vhd

VMDKからRAWに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VMDK -dstformat VDI c:\test.vmdk c:\test.raw

VHDから各イメージに変換
VHDからVDIに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VHD -dstformat VDI c:\test.vhd c:\test.vdi

VHDからVMDKに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VHD -dstformat VMDK c:\test.vhd c:\test.vmdk

VHDからRAWに変換する場合
VBoxManage.exe internalcommands converthd -srcformat VHD -dstformat RAW c:\test.vhd c:\test.raw

RAWから各イメージに変換
RAWからVDIに変換する場合
VBoxManage.exe internalcommands converthd -srcformat RAW -dstformat VDI c:\test.raw c:\test.vdi

RAWからVMDKに変換する場合
VBoxManage.exe internalcommands converthd -srcformat RAW -dstformat VMDK c:\test.raw c:\test.vmdk

RAWからVHDに変換する場合
VBoxManage.exe internalcommands converthd -srcformat RAW -dstformat VHD c:\test.raw c:\test.vhd

サイズによってはものすごく時間かかるので気長に待ちましょう

libxvidを入れる

yumにlibxvidが無かったのでソースファイルからインストールします
まずlibxvidをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/xvidcore
--2010-09-30 18:36:51--  http://short.m264.info/xvidcore
downloads.xvid.org をDNSに問いあわせています... 88.198.32.206
downloads.xvid.org|88.198.32.206|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 643344 (628K) [application/x-bzip]
`xvidcore-1.2.2.tar.bz2' に保存中

100%[================================================>] 643,344      155K/s 時間 4.1s

2010-09-30 18:36:56 (155 KB/s) - `xvidcore-1.2.2.tar.bz2' へ保存完了 [643344/643344]
解凍してフォルダを移動します
[root@blog.m264.com ~]$ tar -xf xvidcore-1.2.2.tar.bz2
[root@blog.m264.com ~]$ cd ./xvidcore/build/generic
メイクしてインストールします
[root@blog.m264.com ~]$ ./configure
/root/work/xvidcore/build/generic
[root@localhost generic]# ./configure
checking build system type... i686-pc-linux
checking host system type... i686-pc-linux
checking target system type... i686-pc-linux
checking whether to use default CFLAGS... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for whether to use assembly code... yes
checking for architecture type... ia32
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for int *... yes
checking size of int *... 4
checking whether byte ordering is bigendian... no
checking for build extensions... .so .a .o
checking for platform specific LDFLAGS/CFLAGS... ok
checking for yasm... no
checking for nasm... no
configure: WARNING: no correct assembler was found - Compiling generic sources only
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking assert.h usability... yes
checking assert.h presence... yes
checking for assert.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for pthread_join in -lpthread... yes
configure: creating ./config.status
config.status: creating platform.inc
[root@blog.m264.com ~]$ make
D: =build
C: ./decoder.c
C: ./encoder.c
C: ./xvid.c
C: bitstream/bitstream.c
C: bitstream/cbp.c
C: bitstream/mbcoding.c
C: dct/fdct.c
C: dct/idct.c
C: dct/simple_idct.c
C: image/colorspace.c
C: image/image.c
C: image/interpolate8x8.c
C: image/font.c
C: image/postprocessing.c
C: image/qpel.c
C: image/reduced.c
C: motion/estimation_bvop.c
../../src/motion/estimation_bvop.c: In function ‘SMPMotionEstimationBVOP’:
../../src/motion/estimation_bvop.c:1107: 警告: unused variable ‘f_mbs’
C: motion/estimation_common.c
C: motion/estimation_gmc.c
C: motion/estimation_pvop.c
../../src/motion/estimation_pvop.c: In function ‘MotionEstimation’:
../../src/motion/estimation_pvop.c:912: 警告: unused variable ‘skip_thresh’
../../src/motion/estimation_pvop.c:907: 警告: unused variable ‘stat_thresh’
../../src/motion/estimation_pvop.c: In function ‘MotionEstimateSMP’:
../../src/motion/estimation_pvop.c:1015: 警告: unused variable ‘skip_thresh’
../../src/motion/estimation_pvop.c:1008: 警告: unused variable ‘stat_thresh’
C: motion/estimation_rd_based.c
C: motion/estimation_rd_based_bvop.c
C: motion/gmc.c
C: motion/motion_comp.c
C: motion/vop_type_decision.c
C: motion/sad.c
C: prediction/mbprediction.c
C: plugins/plugin_single.c
C: plugins/plugin_2pass1.c
C: plugins/plugin_2pass2.c
C: plugins/plugin_lumimasking.c
C: plugins/plugin_dump.c
C: plugins/plugin_psnr.c
C: plugins/plugin_ssim.c
C: quant/quant_h263.c
C: quant/quant_matrix.c
C: quant/quant_mpeg.c
C: utils/emms.c
C: utils/mbtransquant.c
C: utils/mem_align.c
C: utils/mem_transfer.c
C: utils/timer.c
L: libxvidcore.a
L: libxvidcore.so.4.2

---------------------------------------------------------------
Xvid has been successfully built.

* Binaries are currently located in the '=build' directory
* To install them on your system, you can run '# make install'
as root.
---------------------------------------------------------------
make install
D: /usr/local/lib
I: /usr/local/lib/libxvidcore.so.4.2
I: /usr/local/lib/libxvidcore.a
D: /usr/local/include
I: /usr/local/include/xvid.h

ClipBucketで動画をアップロードすると500エラーが表示される

ClipBucketで動画をアップロードすると500エラーが表示されるときはまずhttpdのログを確認してみましょう

[root@blog.m264.com ~]$ tail -n 1 /var/log/httpd/error_log
[Thu Sep 30 13:16:19 2010] [error] [client 192.168.3.4] PHP Warning: POST Content-Length of 10948294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0


POST Content-Length of 10948294 bytes exceeds the limit of 8388608 bytes

要は
え??10MBもアップするの!? お話じゃぁ8MBって聞いてたけど・・・・ (´・ω・`)
って行ってるので

10MBでも受け付けてもらえるようにお話を通します←

まずphp.iniを編集します
[root@blog.m264.com ~]$ vim /etc/php.ini
477行のpost_max_sizeを
post_max_size = 100M
とかにしちゃいます
ついでに
582行とかも弄っちゃいます
upload_max_filesize = 100M

いじり終わったら保存しちゃいます
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 200M


;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;

"/etc/php.ini" 1222L, 45090C 書込み 582,1 47%
話が通ったようなのでhttpdさんに報告しましょう←
[root@blog.m264.com ~]$ service httpd reload
httpd を再読み込み中: [ OK ]