ImageMagick, PerlMagick,MySQL,DBI,DBD::MySQL等入っていることが前提】

(zlibのインストール)
yum install zlib
(※/usr/include/zlib.h)

(libpngのインストール)
http://prdownloads.sourceforge.net/libpng/libpng-1.2.10-no-config.tar.gz
ここからgetしてくる
tar zvxf libpng-1.2.10-no-config.tar.gz
cd libpng-1.2.10-no-config
cp -p scripts/makefile.linux .
mv makefile.linux Makefile
make
make install
(※ 
/usr/local/include/libpng12
/usr/local/lib/libpng12.a ~ .so
にインストールされます)

(freetype 2.*のインストール)
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.gz
tar zvxf freetype-2.1.10.tar.gz
./configure
make
make install

(※ 
/usr/local/include/freetype2/freetype
にインストールされます)

(libjpegのインストール)
wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar zvxf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --enable-shared
make
make install

(※ 
/usr/local/lib/libjpeg.a~ so
がインストールされます)

(xpmのインストール)どうもこの中のpixmapが必要らしい??
wget http://koala.ilog.fr/ftp/pub/xpm/xpm-3.4k-linux.tgz
x window関連なので、入れないでおきまスタ。



(GD-2.0.33のインストール)
wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
tar zvxf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --with-png=/usr/local --with-freetype=/usr/local --with-jpeg=/usr --without-xpm<以下、configureの結果>
#** Configuration summary for gd 2.0.33:
#
# Support for PNG library: yes
# Support for JPEG library: yes
# Support for Freetype 2.x library: yes
# Support for Fontconfig library: no
# Support for Xpm library: no
# Support for pthreads: yes
#
#configure: creating ./config.status
#config.status: creating Makefile
#config.status: creating config/Makefile
#config.status: creating config/gdlib-config
#config.status: creating test/Makefile
#config.status: creating config.h
#config.status: executing depfiles commands

make
make install

(※/usr/local/include以下に*.h
/usr/local/lib/以下にlibrarysがインストールされます)

(CPANモジュール GD-2.34のインストール)
wget http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.34.tar.gz
tar zvxf GD-2.34.tar.gz
cd GD-2.34
perl Makefile.PL
make
make test (All tests successful)
make install


(CPANモジュール GD-SecurityImage-1.61のインストール)
wget http://search.cpan.org/CPAN/authors/id/B/BU/BURAK/GD-SecurityImage-1.61.tar.gz
tar zvxf GD-SecurityImage-1.61.tar.gz
cd GD-SecurityImage-1.61
perl Makefile.PL
make
make test (All tests successful)
make install


(デモ版を設置)
mkdir /h/h/public_html/captcha_demo
cd /h/h/public_html/captcha_demo
wget http://search.cpan.org/src/BURAK/GD-SecurityImage-1.61/eg/demo.pl
chmod 755 demo.pl
(http://+++++++/captcha_demo/demo.pl)

[FAILED] Apache::Session::MySQL: Can't locate Apache/Session/MySQL.pm
[FAILED] String::Random: Can't locate String/Random.pm
[FAILED] Time::HiRes: Can't locate Time/HiRes.pm

[と怒られたのでインストール]

(Apache::Session::MySQLのインストール)
wget http://search.cpan.org/CPAN/authors/id/C/CW/CWEST/Apache-Session-1.81.tar.gz
tar zvxf Apache-Session-1.81.tar.gz
cd Apache-Session-1.81
perl Makefile.PL
make (Test::Deep, etcが無いと怒られる)

(ここで以下をインストール)
Test::Deep
Test::Simle
Sub::Uplevel
Test::Exception

(もう一度)
perl Makefile.PL
make
make test (All tests successful, 5 tests skipped.)
make install

(String::Randomのインストール )
wget http://search.cpan.org/CPAN/authors/id/S/ST/STEVE/String-Random-0.20.tar.gz
tar zvxf String-Random-0.20.tar.gz
perl Makefile.PL
make
make install
(※最新版は0.21だが、Makefile.PLではなくBuild.PLのため0.20をインストール)


(Time::Hiresのインストール )
wget http://search.cpan.org/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.87.tar.gz
tar zvxf Time-HiRes-1.87.tar.gz
perl Makefile.PL
make
make test (All tests successful, 1 subtest skipped.)
make install

[サー使うYO!]
/usr/local/mysql/bin/mysqladmin create gcaptcha
/usr/local/mysql/bin/mysql gcaptcha
mysql > CREATE TABLE sessions (
id char(32) not null primary key,
a_session text
);
mysql > quit

(%configを変更)
ここでは、
database
table_name
user
pass
font
%config = (
database => 'gcaptcha', # database name (for session storage)
table_name => 'sessions', # only change this value, if you *really* have to use another table name. Also change the SQL code below.
user => 'homepage', # database user name
pass => '', # database user's password
font => getcwd."/StayPuft.ttf", # ttf font
itype => 'png', # image format. set this to gif or png or jpeg
use_magick => 1, # use Image::Magick or GD
img_stat => 1, # display statistics on the image?
);


FATAL ERROR
I can not open/find the font file in '/home/homepage/public_html/captcha_demo/StayPuft.ttf': No such file or directory at /home/homepage/public_html/captcha_demo/demo.pl line 68.

orz....

(StayPuft.ttfをとってくる)
wget http://www.thibault.org/fonts/staypuft/StayPuft.ttf.tar.gz
tar StayPuft.ttf.tar.gz
cp StayPuft.ttf /h/h/public_html/captcha_demo/.

OK!