Configuring a Basic LAMP Server (Linux, Apache, MySQL, PHP), with GD, ZLIB & LIBPNG |
![]() ![]() |
Configuring a Basic LAMP Server (Linux, Apache, MySQL, PHP), with GD, ZLIB & LIBPNG |
Aug 17 2006, 09:32 AM
Post
#1
|
|
![]() Member Posts: 648 From: Missouri USA OS: Windows XP Pro, Debian Linux, Windows Vista Business |
Configuring a Basic LAMP Server (Linux, Apache, MySQL, PHP) with GD, ZLIB & LIBPNG
You will obviously have a working version of Linux (any flavor will do although I will recommend Debian as it doesn't automatically install a bunch of things you won't need on a server box unless you specifically tell it to). This guide also assumes you have a basic knowledge of the Linux command line (if you do not, learn that before jumping into a Linux server... Linux boxes perform better on the command line, not with the GUI interface). NOTE: When you see a "/" at the end of a command line that means to continue tying the next line, for example: ./configure –with-mysql=/usr/local/mysql \ --with-xml --with-gd –with-zlib-dir=/usr/local/lib \ would actually be: ./configure –with-mysql=/usr/local/mysql --with-xml --with-gd –with-zlib-dir=/usr/local/lib Also where yo see the word VERSION that would be where you type in the version that you are using (the version you downloaded and copied into the /installs directory which is explained below). Lets begin: * Change to root shell>su <you should be prompted for the root password unless you logged into Linux as root> * Create a directory named installs wherever you choose, /usr/local is as good a place as any, so type in: shell>cd /usr/local shell>mkdir installs shell>cd installs * Copy the following files into the /installs directory: httpd-<version> (http://www.apache.org) php-<version>.tar.gz (http://www.php.net/downloads.php) mysql-<version>.tar.gz (http://dev.mysql.com/downloads/) gd-<version>.tar.gz (http://www.boutell.com/gd/) libpng-<version>.tar.gz (http://www.libpng.org/pub/png/libpng.html) zlib-<version>.tar.gz (http://www.zlib.net/) MySQL shell> groupadd mysql shell> su shell> useradd -g mysql mysql shell> gunzip < mysql-VERSION.tar.gz | tar -xvf - shell> cd mysql* shell> ./configure --prefix=/usr/local/mysql shell> make shell> make install shell> scripts/mysql_install_db shell> chown -R root /usr/local/mysql shell> chown -R mysql /usr/local/mysql/var shell> chgrp -R mysql /usr/local/mysql shell> cp support-files/my-medium.cnf /etc/my.cnf shell> /usr/local/mysql/bin/mysqld_safe --user=mysql & shell> /usr/local/mysql/bin/mysqladmin -u root password newpassword shell> /usr/local/mysql/bin/mysqlshow –p ZLIB shell> cd .. shell> gunzip zlib-VERSION.tar.gz | tar xvf - shell> cd zlib* shell> ./configure shell> make shell> make test shell> make install LIBPNG shell> cd .. shell> gunzip < libpng-VERSION.tar.gz | tar xvf - shell> cd libpng* shell> cp scripts/makefile.std makefile shell> make test shell> make install GD shell> cd .. shell> gunzip < gd-VERSION.tar.gz | tar xvf – shell> cd gd* shell> ./configure shell> make shell> make test shell> make install Apache shell> cd .. shell> gunzip < httpd-VERSION.tar.gz | tar xvf - shell> cd httpd-VERSION shell> export CFLAGS=-O2 shell> ./configure --prefix=/var/www --enable-so --enable-auth-digest shell> make shell> make install shell> /var/www/bin/apachectl configtest (should return Syntax OK) * To start, stop or restart Apache you would issue one of these commands: Start- /var/www/bin/apachectl start Stop - /var/www/bin/apachectl stop Restart - /var/www/bin/apachectl restart NOTE: The httpd and mysqld services will not start automatically upon system reboot and you will need to manually start and stop them or configure your system to launch the service at boot. That is beyond the scope of this guide and is relevant to the Linux distribution you have choosen. Google is your friend here, so do a search and you will find many relevant guides on how to configure this option in relation to your Linux distro. I have included how I configured my Apache and MySQL to start automatically under Debian and you can use these as a guide. The instructions are located HERE PHP shell> cd .. shell> gunzip < php-VERSION.tar.gz | tar xvf – shell> cd php-VERSION shell> ./configure –with-mysql=/usr/local/mysql \ --with-xml --with-gd –with-zlib-dir=/usr/local/lib \ --with-libpng-dir=/usr/local/lib \ --with-apxs2=/var/www/bin/apxs \ --with-apache2=../httpd-VERSION \ --enable-track-vars shell> make shell> make install shell> cp php.ini-dist /usr/local/lib/php.ini After installing PHP, edit /var/www/conf/httpd.conf and make the following additions: * Find DirectoryIndex and at the end of the line add index.php * In the AddType area add these lines: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps * Uncomment the #AddHandler cgi-scripts .cgi line * Create a file in the /var/www/htdocs directory called test.php with the following content: <? phpinfo(); ?> Open this file in your browser (http://localhost/test.php) and you should get your PHP information. You should now have a functional, albeit basic LAMP webserver at this point that supports GD, ZLIB & LIBPNG. I would recommend looking at the documentation for Apache, MySQL, Perl and PHP to find additional configuration options to tighten up your server and to add additional functionality. This post has been edited by thenotch: Aug 26 2006, 11:23 AM |
|
|
Aug 26 2006, 11:25 AM
Post
#2
|
|
![]() Member Posts: 648 From: Missouri USA OS: Windows XP Pro, Debian Linux, Windows Vista Business |
The above HOW-TO has been editted and modified by me as of today (26AUG06).
It should be a little more concise and clear and corrects a few errors in syntax. I have also added a link to a page I made up for autostarting the httpd and mysqld_safe daemons if you are using Debian. This post has been edited by thenotch: Aug 26 2006, 11:30 AM |
|
|
![]() ![]() |
|
Time is now: 24th July 2008 - 08:00 PM |
| Advertisements do not imply our endorsement of that product or service. The forum is run by volunteers who donate their time and expertise. We make every attempt to ensure that the help and advice posted is accurate and will not cause harm to your computer. However, we do not guarantee that they are accurate and they are to be used at your own risk. |