Jump to content

Compiling Apache/php/mysql On Linux


Recommended Posts

First of all download the following (These are the latest when I made this tutorial):

Apache 1.3.26: http://www.apache.org/dist/httpd/apache_1.3.26.tar.gz

PHP 4.2.2: http://ca.php.net/do_download.php?download...hp-4.2.2.tar.gz

MySQL 3.23.51: http://www.mysql.com/Downloads/MySQL-3.23/...-3.23.51.tar.gz

First of all you need to extract these (usually in /usr/src/, which requires root

permission). Open a terminal in the directory where you have the files and type the

following commands to extract them:

tar -zxvf apache_1.3.26.tar.gz

tar -zxvf php-4.2.2.tar.gz

tar -zxvf mysql-3.23.51.tar.gz

Apache

--------

Now the first step is to compile apache, before doing anything, I like to make a place to

store all the server files (/wwwroot), type:

mkdir /wwwroot

Now it is time to configure apache, go into the apache directory where you extracted the

source code and do the following:

./configure --prefix=/wwwroot --enable-module=so

This will configure apache to install in the /wwwroot folder (You can choose someplace

else, or don’t type it in to install in default), and will also compile apxs (which allows

you to build modules for Apache). You can also see more info by running: ./configure

--help

next type:

make

This will compile apache, next type:

make install

This will install Apache in the /wwwroot folder

PHP

----

First go to the directory where you extracted the PHP source, and type the following:

./configure --prefix=/wwwroot/php --with-config-file-path=/wwwroot/php

--with-apxs=/wwwroot/bin/apxs --with-xml --enable-bcmath --enable-calender --enable-ftp

--with-gd --enable-magic-quotes --with-mysql --with-pear --enable-track-vars --with-ttf

--with-zlib --with-mod_charset --with-iconv --enable-trans-sid --enable-sockets

This basically tells PHP where to install, and what to compile (this is what I use as a

standard). You may need to compile or download packages for libgd and some other things

which the configure script will tell you what is missing. Also, you can see all the other

configure options here: http://www.php.net/manual/en/install.configure.php

Next do:

make

make install

Note: The make install will automatically update your httpd.conf to load the module.

MySQL

-----

You first need to do a configure:

./configure --prefix=/wwwroot

Then compile and install:

make

make install

This will take longer than PHP/Apache to compile

After you do this, you need to go to the bin directory and run the:

cd /wwwroot/bin/

./mysql_install_db

script, it will create the default users in the database. You can later use phpMyAdmin to

change passwords

and users.

Setting up

------------

You will need to edit /wwwroot/conf/httpd.conf , and Add the following:

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

and you can add whatever other files types you want to process

Starting the servers

--------------------

To start Apache:

cd /wwwroot/bin

./apachectl start

to start MySQL

cd /wwwroot/mysql/libexec

mysqld -u root

Running at Startup

------------------

If you are using Debian, then you can do the following for Apache:

ln -s /wwwroot/bin/apachectl /etc/init.d/apache

If you also want MySQL to run at startup, read this:

http://www.vbulletin.com/manual/mysql.html

Hope this helps anybody who want to set up a Linux server at home, you need to put the

documents in /wwwroot/htdocs/ , If you have port 3306 opened to the internet, make sure

that you edit the user root to have a password, you simply need to run mysqld and type the

following:

cd /wwwroot/mysql/bin

./mysqladmin -u root password new_password_you_want

then make sure you flush privilages or restart mysql, since the settings wont work until

then. You can also make Apache users availiable by uncommenting everthing below somthing

that

looks like:

<Directory /home/*/public_html/>

...

</directory>

and also find the line that says

UserDir public_html

and uncomment that line only.

If you do this you need to create a directory in the users folder called public_html, and

make sure it is readable by everybody, if you don’t want to chmod then by hand open a

console

in the users directory and type:

chown -R nobody public_html

chgrp -R users public_html

Now users for the computer can access their page by going to:

http://ip-or-domain.com/~usersname/

If you need mail to work, I would reccomend downloading the exim package (on Debian it has

4 questions that it asks when it is being set up, don't know about other distro's). Also,

for IMAP, the WU-IMAPD is a nice server, and I did not find any config files for it. :D

Then, just install Squirrelmail or your favorite PHP/Perl/CGI mail client and everthing

should work ok.

If you have any questions ask them here :rolleyes:

If you want to post this on other forums, please leave some credit :D

You can also just download the package, but dont you find this more fun ? :)

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...