RaQ 2 AMP Components Installation

From CobaltFAQs

Jump to: navigation, search

MySQL, PHP, GD, Apache, FreeType 2, Zlib, libjpeg and libpng on a RaQ 2

By John M. Johnson III <cobalt at ospex dot com>

Special thanks goes to the following people for previous work and hints on how to perform these upgrades

* Paul Schreiber< paul at magic dot ca> http://paulschreiber.com/
* Sinisa Milivojevic <sinisa at cytanet dot com dot cy>
* Bruce Timberlake <brucetimberlake at gmail dot com>

Note: I do not have the original CobaltFAQs wiki content any longer, so I found this at [archive.org]. I have no idea if any of the sources referenced here still exist at those URLs, etc. Please update this as needed (request an account from me if you don't have one already; it's the only way I can keep the wiki spam out).


Contents

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 ftp://ftp-eng.cobalt.com/pub/unsupported/raq2/rpms/glibc-profile-2.0.7-29.4C2.mips.rpm
wget ftp://ftp-eng.cobalt.com/pub/unsupported/raq2/rpms/glibc-debug-2.0.7-29.4C2.mips.rpm
wget ftp://ftp-eng.cobalt.com/pub/unsupported/raq2/rpms/glibc-devel-2.0.7-29.4C2.mips.rpm
wget ftp://ftp-eng.cobalt.com/pub/unsupported/raq2/rpms/glibc-2.0.7-29.4C2.mips.rpm
wget ftp://ftp.linux.sgi.com/pub/linux/mips/mipsel-linux/RedHat-5.1/RPMS/mipsel/egcs-1.0.2-9.mipsel.rpm
wget ftp://ftp.linux.sgi.com/pub/linux/mips/mipsel-linux/RedHat-5.1/RPMS/mipsel/egcs-c++-1.0.2-9.mipsel.rpm
wget ftp://ftp.linux.sgi.com/pub/linux/mips/mipsel-linux/RedHat-5.1/RPMS/mipsel/egcs-g77-1.0.2-9.mipsel.rpm
wget ftp://ftp.linux.sgi.com/pub/linux/mips/mipsel-linux/RedHat-5.1/RPMS/mipsel/egcs-objc-1.0.2-9.mipsel.rpm
wget ftp://ftp.linux.sgi.com/pub/linux/mips/mipsel-linux/RedHat-5.1/RPMS/mipsel/libstdc++-2.8.0-9.mipsel.rpm
wget ftp://ftp.linux.sgi.com/pub/linux/mips/mipsel-linux/RedHat-5.1/RPMS/mipsel/libstdc++-devel-2.8.0-9.mipsel.rpm
wget ftp://ftp-eng.cobalt.com/pub/contrib/mips/flex-2.5.4a-3.mipsel.rpm
wget ftp://oss.sgi.com/pub/linux/mips/mipsel-linux/RedHat-5.1/RPMS/mipsel/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://freshmeat.net/redir/libjpeg/5665/url_tgz/jpegsrc.v6b.tar.gz
wget http://www.libpng.org/pub/png/src/libpng-1.2.5.tar.gz
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
wget http://easynews.dl.sourceforge.net/sourceforge/libpng/zlib-1.1.4.tar.gz
wget http://www.apache.inetcosmos.org/dist/httpd/apache_1.3.27.tar.gz
wget ftp://mysql.secsup.org/pub/software/mysql/Downloads/MySQL-3.23/mysql-3.23.56.tar.gz
wget http://www.php.net/get/php-4.3.1.tar.gz/from/us2.php.net/mirror
wget http://pam.sourceforge.net/mod_auth_pam/dist/mod_auth_pam-1.1.1.tar.gz
wget ftp://ftp.gnu.org/pub/gnu/make/make-3.78.1.tar.gz
wget http://aleron.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.3.tar.gz
wget wget http://www.kyz.uklinux.net/downloads/cabextract-0.6.tar.gz
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/andale32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/webdin32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/trebuc32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/georgi32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/verdan32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/comic32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/arialb32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/impact32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/arial32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/times32.exe
wget http://unc.dl.sourceforge.net/sourceforge/corefonts/courie32.exe

[4] Install the new glibc:

cd
rpm -Uvh --force --nodeps glibc-*.4C2.mips.rpm

[5] Run ldconfig:

/sbin/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

Install MySQL

[8] Compile 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'


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

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

make

[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>';
}
?>
Personal tools