MySQL, PHP, GD, Apache, FreeType 2, Zlib, libjpeg and libpng on a Sun Cobalt RaQ2
part 1: Get all of the needed sources
[1] Get the new glibc, egcs, libstdc++, flex and bin utils:
|
echo Getting glibc, egcs, libstdc, flex and bin utils
mkdir /home/src
cd /home/src
wget http://cobalt.webtrafficstats.com/downloads/glibc-profile-2.0.7-20.mips.rpm
wget http://cobalt.webtrafficstats.com/downloads/glibc-debug-2.0.7-20.mips.rpm
wget http://cobalt.webtrafficstats.com/downloads/glibc-devel-2.0.7-20.mips.rpm
wget http://cobalt.webtrafficstats.com/downloads/glibc-2.0.7-29.4C2.mips.rpm
wget http://cobalt.webtrafficstats.com/downloads/egcs-1.0.2-9.mipsel.rpm
wget http://cobalt.webtrafficstats.com/downloads/egcs-c++-1.0.2-9.mipsel.rpm
wget http://cobalt.webtrafficstats.com/downloads/egcs-g77-1.0.2-9.mipsel.rpm
wget http://cobalt.webtrafficstats.com/downloads/egcs-objc-1.0.2-9.mipsel.rpm
wget http://cobalt.webtrafficstats.com/downloads/libstdc++-2.8.0-9.mipsel.rpm
wget http://cobalt.webtrafficstats.com/downloads/libstdc++-devel-2.8.0-9.mipsel.rpm
wget http://cobalt.webtrafficstats.com/downloads/flex-2.5.4a-3.mipsel.rpm
wget http://cobalt.webtrafficstats.com/downloads/binutils-2.8.1-2.mipsel.rpm
|
[2] Get needed software
|
echo Getting jpeg, libpng, gd, zlib, apache, mysql, php, mod_auth_pam,
make, freetype2
cd /home/src
wget http://cobalt.webtrafficstats.com/downloads/jpegsrc.v6b.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/libpng-1.2.5.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/gd-2.0.11.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/zlib-1.1.4.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/apache_1.3.27.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/mysql-3.23.56.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/php-4.3.1.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/mod_auth_pam-1.1.1.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/make-3.78.1.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/freetype-2.1.3.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/cabextract-0.6.tar.gz
wget http://cobalt.webtrafficstats.com/downloads/andale32.exe
wget http://cobalt.webtrafficstats.com/downloads/webdin32.exe
wget http://cobalt.webtrafficstats.com/downloads/trebuc32.exe
wget http://cobalt.webtrafficstats.com/downloads/georgi32.exe
wget http://cobalt.webtrafficstats.com/downloads/verdan32.exe
wget http://cobalt.webtrafficstats.com/downloads/comic32.exe
wget http://cobalt.webtrafficstats.com/downloads/arialb32.exe
wget http://cobalt.webtrafficstats.com/downloads/impact32.exe
wget http://cobalt.webtrafficstats.com/downloads/arial32.exe
wget http://cobalt.webtrafficstats.com/downloads/times32.exe
wget http://cobalt.webtrafficstats.com/downloads/courie32.exe
|
[4] Install the new glibc:
cd
rpm -Uvh --force --nodeps glibc-*.4C2.mips.rpm |
[5] Run ldconfig:
[6] Install egcs & libstdc++
rpm -e gcc-objc
rpm -e gcc-c++
rpm -e gcc
rpm -Uvh egcs*-1.0.2-9.mipsel.rpm
rpm -e libg++-devel-2.7.2.8
rpm -i libstdc++*-2.8.0-9.mipsel.rpm
rpm -Uvh binutils-2.8.1-2.mipsel.rpm
rpm -ivh flex-2.5.4a-3.mipsel.rpm |
[7] gunzip and untar the files
cd /tmp
gunzip /home/src/*.gz
tar xvf apache_1.3.27.tar
tar xvf gd-2.0.11.tar
tar xvf jpegsrc.v6b.tar
tar xvf libpng-1.2.5.tar
tar xvf mod_auth_pam-1.1.1.tar
tar xvf mysql-3.23.56.tar
tar xvf php-4.3.1.tar
tar xvf zlib-1.1.4.tar |
part 2: MySQL
[8] Install MySQL
cd mysql-3.23.56/
./configure \
--with-low-memory \
--disable-assembler \
--disable-shared \
--with-mysqld-ldflags="-all-static" \
--with-client-ldflags="-all-static" \
--prefix=/home/mysql \
--localstatedir=/home/mysql/data \
--disable-maintainer-mode \
--with-mysqld-user=mysql \
--without-comment \
--without-debug \
--without-bench \
--without-test \
--without-raid
make
make install
echo Run the MySQL install script
./scripts/mysql_install_db
echo Copy the MySQL start script:
cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod a+x /etc/rc.d/init.d/mysql
|
[9] Modify rc.local to start the MySQL server automatically:
vi /etc/rc.d/rc.local
put "/etc/rc.d/init.d/mysql start" at the very end.
create my.cnf
vi /home/mysql/data/my.cnf
[mysqld]
bind-address=127.0.0.1
|
[10] Start MySQL:
/etc/rc.d/init.d/mysql start |
[11] Give the root account a password:
/usr/local/bin/mysqladmin -u root password 'new-password-goes-here' |
part 3: install GD, libpng, jpeg-6b, make and freetype2, truetype fonts, cabextract
[12] Cab Extract
./configure
make
for i in ../*exe ; do
./cabextract --lowercase $i
done
mkdir /usr/X11R6/lib/X11
mkdir /usr/X11R6/lib/X11/fonts
mkdir /usr/X11R6/lib/X11/fonts/truetype
cp *.ttf /usr/X11R6/lib/X11/fonts/truetype/ |
[13] Install make
./configure --prefix=/usr/local
make
make install |
[14] Install freetype2
/usr/local/bin/make setup CFG="--prefix=/usr/local"
/usr/local/bin/make
/usr/local/bin/make install |
[15] Install Zlib
./configure --prefix=/usr/local
make
make install |
[16] Install jpeg-6b
./configure --prefix=/usr/local
make
make install-headers
make install-lib |
[17] Install libpng
cd scripts
cp makefile.linux ../Makefile
cd ..
vi Makefile and modify the following lines
# Where the zlib library and include files are located.
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
make
make install
|
[18] Install GD
./configure \
--prefix=/usr/local \
--with-png=/usr/local \
--with-jpeg=/usr/local \
--with-freetype=/usr/local
make
make install |
part 4: install Apache and PHP
------------------------------
[19] Configure Apache initially:
cd /tmp/apache_1.3.27/
./configure --prefix=/etc/httpd |
[20] Edit the mod_auth_pam.c file.
vi mod_auth_pam.c
Change line 153 so it reads:
*pam_servicename = "ahttpd",
|
[21] Copy mod_auth_pam into the Apache modules directory:
cp mod_auth_pam.c apache_1.3.27/src/modules/extra/ |
[22] Configure PHP:
cd
cd php-4.3.1/
./configure \
--with-mysql \
--with-apache=../apache_1.3.27 \
--enable-track-vars \
--with-gd=/usr/local \
--with-jpeg-dir=/usr/local/ \
--with-png-dir=/usr/local/ \
--with-zlib=/usr/local/ \
--with-ttf \
--enable-gd-native-ttf \
--with-freetype-dir=/usr/local \
--disable-shared
make
make install |
[23] Configure Apache to get a new apxs
./configure \
"--with-layout=Apache" \
"--prefix=/usr/local/cobalt-custom/apache" \
"--enable-module=so"
make
make install
mv /usr/lib/apache /usr/lib/apache.dist
mv /usr/include/apache /usr/include/apache.dist
cp /usr/sbin/apxs /usr/sbin/apxs.dist
mkdir /usr/include/apache
mkdir /usr/lib/apache
cp -R /usr/local/cobalt-custom/apache/include /usr/include/apache
cp -R /usr/local/cobalt-custom/apache/libexec /usr/lib/apache
cp /usr/local/cobalt-custom/apache/bin/apxs /usr/sbin/apxs
Modify apxs and change to match the following
my $CFG_TARGET = q(httpd);
my $CFG_CC = q(gcc);
my $CFG_CFLAGS = q( -DLINUX=20 -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite
`../apaci`);
my $CFG_CFLAGS_SHLIB = q(-fpic -DSHARED_MODULE);
my $CFG_LD_SHLIB = q(gcc);
my $CFG_LDFLAGS_SHLIB = q(-shared);
my $CFG_LIBS_SHLIB = q();
my $CFG_PREFIX = q(/usr/);
my $CFG_SBINDIR = q(/usr/sbin);
my $CFG_INCLUDEDIR = q(/usr/include/apache);
my $CFG_LIBEXECDIR = q(/usr/lib/apache);
my $CFG_SYSCONFDIR = q(/etc/httpd/conf);
rm -Rf /usr/local/cobalt-custom
|
[24] Configure the REAL apache
LIBS="-lpam -ldl" ./configure \ "--with-layout=Apache"
\ "--prefix=/etc/httpd" \ "--enable-module=rewrite"
\ "--enable-module=so" \ "--enable-module=mmap_static"
\ "--enable-module=log_agent" \ "--enable-module=log_referer"
\ "--enable-module=mime_magic" \ "--enable-module=info"
\ "--enable-module=speling" \ "--enable-module=auth_anon"
\ "--enable-module=auth_dbm" \ "--enable-module=auth_db"
\ "--enable-module=digest" \ "--enable-module=cern_meta"
\ "--enable-module=expires" \ "--enable-module=headers"
\ "--enable-module=usertrack" \ "--enable-module=example"
\ "--enable-module=unique_id" \ "--activate-module=src/modules/php4/libphp4.a"
\ "--activate-module=src/modules/extra/mod_auth_pam.o" |
[25] Make Apache
[26] Edit your srm.conf:
vi /etc/httpd/conf/srm.conf
Add a line that says:
AddType application/x-httpd-php .php |
[27] Backup the old Apache daemon:
cp /usr/sbin/httpd /usr/sbin/httpd.old |
[28] Stop the http daemon:
/etc/rc.d/init.d/httpd.init stop |
[29] Install the new http daemon:
cp src/httpd /usr/sbin/httpd |
[30] Restart the http daemon:
/etc/rc.d/init.d/httpd.init start |
[31] php test file
vi test.php <?php
phpinfo()
?> |
[32] php and GD test file
vi gd.test.php
<?php
if($_GET["do"] == "jpg") {
// create the image
$jpg = ImageCreate(200,200);
$bg = ImageColorAllocate($jpg,0,0,0);
$tx = ImageColorAllocate($jpg,255,128,128);
ImageFilledRectangle($jpg,0,0,200,200,$bg);
ImageString($jpg,3,70,90,"it works!",$tx);
// send the image
header("content-type: image/jpeg");
ImageJPEG($jpg);
} elseif($_GET["do"] == "png") {
// create the image
$png = ImageCreate(200,200);
$bg = ImageColorAllocate($png,0,0,0);
$tx = ImageColorAllocate($png,255,128,128);
ImageFilledRectangle($png,0,0,200,200,$bg);
ImageString($png,3,70,90,"it works!",$tx);
// send the image
header("content-type: image/jpeg");
ImageJPEG($png);
} elseif($_GET["do"] == "src") {
show_source(__FILE__);
} else {
echo '<a href="?do=jpg">Generate JPG</a><br>';
echo '<a href="?do=png">Generate PNG</a><br>';
echo '<a href="?do=src">Show Source</a>';
}
?>
|