Phine Solutions web work notes

install PHP

Filed under: server setup by 1.618 — September 27, 2006 10:31 pm

Since I didn’t intall the devel packages, some extra RPMs need to be installed for PHP installation.

A bunch of RPMs that need to be installed:
flex-2.5.4a-33.i386.rpm
libxml2-devel-2.6.16-6.i386.rpm
zlib-devel-1.2.1.2-1.2.i386.rpm
mysql-devel-4.1.12-3.RHEL4.1.i386.rpm
openssl-devel-0.9.7a-43.8.i586.rpm
krb5-devel-1.3.4-27.i386.rpm
e2fsprogs-devel-1.35-12.3.EL4.i386.rpm
mysql-bench-4.1.12-3.RHEL4.1.i386.rpm
perl-DBD-MySQL-2.9004-3.1.i386.rpm
perl-DBI-1.40-8.i386.rpm
mysql-4.1.12-3.RHEL4.1.i386.rpm

Again, if you have development packages installed when insalling Linux at the beginning, these packages should be there.

some additional packages:
yum install libpng-devel
yum install libjpeg-devel
yum install libxslt-devel

yum install libcrypt-devel <– without this one make will error out at last step.

Now we can run:
./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –enable-mbstring –with-curl=/usr/ –enable-exif –with-xsl=/usr/lib/ –with-gd –with-jpeg-dir=/usr/lib/ –with-png-dir=/usr/lib/ –with-zlib-dir=/usr/lib/

make
make install

install apache

Filed under: server setup by 1.618 — 10:31 pm

Now it’s time to install the apache web server.

  • First, need to remove the existing httpd stuff. I removed the following RPMS.

rpm -e mod_python-3.1.3-5.1.i386
rpm -e mod_ssl-2.0.52-22.ent.centos4.i386
rpm -e mod_perl-1.99_16-4.centos4.i386
rpm -e webalizer-2.01_10-25.i386
rpm -e httpd-2.0.52-22.ent.centos4 httpd-manual-2.0.52-22.ent.centos4 system-config-httpd-1.3.1-1 httpd-suexec-2.0.52-22.ent.centos4

The Perl and Python stuff depend on the httpd so I went ahead removed them.

  • Then I downloaded apache 2.2.3 source code, unpacked them and then compile:

Oops…
configure –enable-so tells me gcc is not there.

./configure –enable-so –enable-ssl –enable-rewrite –enable-speling=shared

Ok, I didn’t install the developer’s package during system installation to try to save some space, not it came back to bite me.

After some research, the following rpms are installed:
gcc-3.4.5-2.i386.rpm
glibc-headers-2.3.4-2.19.i386.rpm
pkgconfig-0.15.0-3.i386.rpm
glib2-devel-2.4.7-1.i386.rpm
glibc-kernheaders-2.4-9.1.98.EL.i386.rpm
glibc-devel-2.3.4-2.19.i386.rpm

  • Apache compiled and installed succefully.

./apachectl start

“It works!”

Now we want to add Apache httpd server to the services:

  • first, make sure we have the startup script ready, copy the following script to /etc/init.d

————————————————————————
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: – 85 15
# description: Apache is a World Wide Web server. It is used to serve # HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid

RETVAL=0

# The semantics of these two functions differ from the way apachectl does
# things — attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $”Starting $prog: ”
/usr/local/apache2/bin/apachectl start
RETVAL=$?
return $RETVAL
}
stop() {
echo -n $”Stopping $prog: ”
/usr/local/apache2/bin/apachectl stop
RETVAL=$?
return $RETVAL
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $”Usage: $prog {start|stop|restart|condrestart|status|fullstatus|graceful|help|configtest}”
exit 1
esac

exit $RETVAL

————————————————————————

The script is not going to win me any award but it is functional….status check is not in the service since it is quite easy to check on port 80…

  • Second, add the service:

chkconfig –add httpd

  • Third, turn it on:

chkconfig –level 3 httpd on

  • Ok, do a little testing:

service httpd restart

prepare for my dedicated server

Filed under: server setup by 1.618 — 10:30 pm

Since I decided to upgrade one of my website’s hosting to a dedicated server in the near future, I figured that I need to prepare for the administration tasks. Got to shake some dust off my fingers. What’s the plan? Use one of my old box to practice installing Apache/PHP, MySQL and Qmail.

Downloaded the CentOS 4.3 ISO image from web and burned 4 CDs.

Dug out my 10 year old PC. Yes, you heard it right, I built it myself 10 years ago. The CPU is an AMD400(mm?), and it has 256m emmory. Hard drive? 10G. It was a HUGH hard drive then.

Ok, booted the system from CDROM and the rest of the stuff was pretty much no brainer.

I about 2 hours I had my system running.

For GUI, I selected KDE. Not that I preferred it, just thought it takes less space comparing with Gnome…I may be wrong here, or I can get some other X system which is far lighter than KDE. But I am not palnning to use the GUI to manage the machine. As a matter of fact, once the system is up I’ll change the default runlevel to 3 so it doesn’t load this clunky GUI to start.

Here is how I did it:

Su to root
Open /etc/inittab
change
id:3:initdefault:
to
id:5:initdefault:

Restarted the system…

The meaning of the runlevels:
0 – halt (Do NOT set initdefault to this)
1 – Single user mode
2 – Multiuser, without NFS (The same as 3, if you do not have networking)
3 – Full multiuser mode
4 – unused
5 – X11
6 – reboot (Do NOT set initdefault to this)

« Previous Page

©phinesolutions.com