Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to compile apache/mysql/php
#1

although the guide below is OLD, it still works (as of December 2007.

 

I've tested it with the following versions in Fedora 8

 

apache_1.3.39.tar.gz

mysql-5.0.51.tar.gz

php-5.2.5.tar

 

and apart from a small hiccup while configuring php, all was ok.

 

ok, on with the show...

 

Quote:PLEASE NOTE: THIS HOWTO WAS WRITTEN BEFORE THE VULNERABILITIES WERE FOUND IN APACHE 1.3.x - MAKE SURE TO USE APACHE 1.3.31 OR NEWER FOR THIS HOWTO. FOR DETAILS OF THE VULNERABILITIES AND TO DOWNLOAD THE APACHE 1.3.31 SOURCE PLEASE SEE <a href="http://httpd.apache.org/download.cgi" target="_blank"><a href="http://httpd.apache.org/download.cgi" target="_blank">http://httpd.apache.org/download.cgi</a></a> 

TO REPEAT, PLEASE SUBSTITUE ALL REFERENCES BELOW TO APACHE 1.3.29 with APACHE 1.3.31 or newer !
 

 

This document was inspired by this HOW-TO written by forum member [strabo]. I followed his document and with lots of help on IRC (irc://efnet.demon.co.uk/redhat) from many people, I got things up and running eventually, however there were lots of problems along the way so i'd like to clear things up a bit here and make this document more 'noob' friendly.

 

First off, I am assuming you are running either Redhat 8/9 or Fedora, if so then this should work well for you, if you already have your linux distro installed then you might be in for some problems, for example, during Redhat setup (and fedora) you have the chance to install apache and mysql amongst other things, however, if you go this root you may find that things just don't work later on.

 

 

 

Step ONE - Prepare your linux installation:-

 

I would suggest that you start with a clean slate and install Redhat/Fedora by choosing the CUSTOM option, making sure NOT to install apache (httpd), mysql or php, once done we will get the source for these components and compile them. If you have not compiled before don't worry, it's not that bad, I'll guide you through it. After I did my clean install, I installed apt-get and did the following to get my system up to date:

 



Code:
apt-get update && apt-get upgrade




 

if you don't want to use apt-get, then you can simply use yum

 



Code:
yum -y update




 

It took a while, but once done my system was more in tune with todays packages. Now all i needed was the latest kernel:

 



Code:
apt-get install kernel




 

doing the above will display an error telling you that you must specify a kernel to retrieve, so follow the instructions and install the latest kernel, I did by doing this

 



Code:
apt-get  install kernel#2.4.22-1.2174.nptl




 

Once done I rebooted and was ready for the next step.

 

 

 

 

Step TWO - Get the source for apache/mysql/php:-

 

I downloaded the three source files to the following directory

 

/home/anyweb/downloads/website

 

Apache:

 

I wanted to compile and install Apache 1.3.29 from source. I downloaded it from this mirror but you can go to apache's download page and take your pick.

 

MySQL:

 

I picked mysql 4.0.18 and picked the mirror from here

 

PHP:

 

Get over to php.net and download the latest php package, I downloaded php 4.3.5 from here

 

 

Step THREE:- uncompress the source and move it to /usr/local/src/

 

Now that you have the source lets start uncompressing it and copying it.

 

You should have three files similar to these ones below

 

apache_1.3.29.tar.gz

mysql-4.0.18.tar.gz

php-4.3.5.tar.gz

to uncompress the files do as follows:-

 

 



Code:
tar zxvf apache_1.3.29.tar.gz
tar zxvf mysql-4.0.18.tar.gz
tar zxvf php-4.3.5.tar.gz




 

Once done, you will now have three new directories with the source within. Now let's move those directories to their destination.

 

login as su - (root) and do as follows

 

cd to the directory where you saved and uncompressed your source (above)

 

 



Code:
cd /home/anyweb/downloads/website
mv apache_1.3.29 /usr/local/src/
mv mysql-4.0.18 /usr/local/src/
mv php-4.3.5 /usr/local/src/




 

 

Step FOUR - Compile MySQL

 

Be warned, compiling MySQL does take time, so be prepared to take a few coffee breaks.

 

Login as su - (root).

 

lets add the user/group mysql by doing this

 



Code:
groupadd mysql
useradd -g mysql mysql




 

Ok, now let's cd to the directory where we have the MySQL source,

 



Code:
cd /usr/local/src/mysql-4.0.18/




 

once there do as follows:-

 



Code:
./configure --prefix=/usr/local/mysql \--localstatedir=/usr/local/mysql/data \--disable-maintainer-mode \--with-mysqld-user=mysql \--enable-large-files \--without-comment \--without-debug \--without-docs \--without-bench




 

after a while.... and some scrolling you should finally see this:-

 

 

Quote:MySQL has a Web site at <a href="http://www.mysql.com/" target="_blank"><a href="http://www.mysql.com/" target="_blank">http://www.mysql.com/</a></a> which carries details on thelatest release, upcoming features, and other information to make your

work or play with MySQL more productive. There you can also find

information about mailing lists for MySQL discussion.

 

Remember to check the platform specific part of the reference manual for

hints about installing MySQL on your platform. Also have a look at the

files in the Docs directory.

 

Thank you for choosing MySQL!
 

Now let's continue !

 

type

 



Code:
make




 

(now is a good time to go and take a break, it takes time....)

 

ok once that is finished (it took a while didn't it !) you can do this

 



Code:
make install

./scripts/mysql_install_db
chown -R root:mysql  /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data




 

If the above command fails (cant find the data dir) chances are you have had mysql installed already via rpm..., if so you could try removing it with apt-get remove mysql and start the whole compiling process again, or, start fresh at step ONE (preferred) or create the data directory manually and hope that nothing else fails...

 



Code:
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
ldconfig -v | grep libmysqlclient

echo "/usr/local/mysql/bin/mysqld_safe --user=mysql &" >> /etc/rc.d/rc.local

cd /usr/local/mysql/bin
./mysqld_safe --user=mysql &




 

If the above starts MYSQL and then abrubtly ends it like the following

 

Quote:Starting mysqld daemon with databases from /var/lib/mysql040527 14:33:45 mysqld ended
then check the owner of /var/lib/mysql 

if its root, then change it to mysql as follows

 



Code:
[root@localhost bin]# chown -R mysql:mysql /var/lib/mysql




 

 

 

at this point, you'll probably need to open a new console and login again as su - because the other console is running mysql...

 

 



Code:
cd /usr/local/mysql/bin
./mysqladmin version




 

doing the above should show you something like the following if all went ok:

 

 

Quote:[root@localhost bin]# ./mysqladmin version./mysqladmin Ver 8.40 Distrib 4.0.18, for pc-linux on i686

Copyright
Reply
#2
The init.d startup script which come with the .rpm's are handy, can you get them separately?
Reply
#3

I had no troubles up until this point:

 

[root@localhost mysql-4.0.18]# ldconfig -v | grep libmysqlclient

ldconfig: Path `/usr/local/mysql/lib/mysql' given more than once

ldconfig: Path `/usr/local/mysql/lib/mysql' given more than once

libmysqlclient.so.12 -> libmysqlclient.so.12.0.0

ldconfig: Cannot stat /usr/lib/libgmpxx.so: No such file or directory

 

 

Once I tried starting the service I got this:

 

[root@localhost bin]# ./mysqld_safe --user=mysql &

[1] 13894

[root@localhost bin]# Starting mysqld daemon with databases from /usr/local/mysql/data

040415 13:57:16 mysqld ended

 

Once I tried checking the version:

 

[root@localhost bin]# ./mysqladmin version

./mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

 

So if you have any advice that would be great I would really like to get it working :)

Reply
#4

i updated the howto

 

see here

 

Quote:If the above starts MYSQL and then abrubtly ends it like the following 

Starting mysqld daemon with databases from /var/lib/mysql

040527 14:33:45  mysqld ended

 

 

 

then check the owner of /var/lib/mysql

 

if its root, then change it to mysql as follows

 

 

 

 

[root@localhost bin]# chown -R mysql:mysql /var/lib/mysql
 

plus.. to fix the /tmp socks message do this

 

echo "/usr/local/mysql/bin/mysqld_safe --user=mysql -f /etc/my.cnf &" >> /etc/rc.d/rc.local

 

 

the -f forces mysql to use a specific mysql.cnf file (my.cnf) which has the correct path to the socks file

 

hth

 

cheers

 

anyweb

Reply
#5
Can we apply this How-To's with the current version of apache, mysql, and php?
Reply
#6

Quote:configure: error: no acceptable C compiler found in $PATHSee `config.log' for more details.
 

I got that while running the configuring line for mysql

 

 

 

please help.

Reply
#7
If this ever happened to anybody, please note that you need to install all the "GCC" compilers that's available in Synaptic. It solved my problem above.
Reply
#8

Followed guide and worked 100%

 

Versions of software installed as follows...

mysql-4.0.20.tar.gz

apache_1.3.31.tar.gz

php-4.3.7.tar.gz

 

also added this to the httpd.conf for PHP

AddType application/x-httpd-php .phtml .php

 

 

Great guide,

mechtn

Reply
#9

Nice guide, thought I would add some info. If you install RedHat 9 and choose 5/5 on the SQL Server option(using GUI install method), then follow this guide, you get errors. Unable to open mysql.sock something when you try to start the daemon. I believe it's due to the fact that mysql.sock isn't in /tmp...it's in /var/lib/mysql/

So if you do the following:

cd /tmp

ln -s /var/lib/mysql/mysql.sock mysql.sock That should fix it up, at least it did for me.

Reply
#10

hello peeps,

 

time to upgrade your PHP to 4.3.10 or greater

 

theres a bad exploit/vulnerability in versions less than the above

 

see here for details [/url][url=http://www.theinquirer.net/?article=20329]http://www.theinquirer.net/?article=20329

 

\Major bug in PHP opens database security hole \

 

if you followed this guide simply download the latest php tar ball from this mirror

 

then do as follows:

 



Code:
tar zxvf php-4.3.10.tar.gz
cd php-4.3.10

./configure \--with-apxs=/usr/local/apache/bin/apxs \--with-mysql=/usr/local/mysql \--enable-track-vars \--with-xml

make
make install

/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start




Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)