skip navigation

Content:: Lamp

Installing Apache, MySQL, and PHP on Ubuntu Debian
Needed Files.
Step 1) Installing MySQL We will be configuring the MySQL installation to go into /usr/local/mysql the configuration file will go into /etc/mysql/my.cnf Extra the mysql binaries #tar -xzf mysql-4.1.7.tar.gz now go into the newly created directory. # ./configure --prefix=/usr/local/mysql # make # make install If you have successfully completed the installation there are a few more things that need to be done. First we will create the Database # /usr/local/mysql/bin/mysql_install_db Setting up user mysql the my.cnf wants user mysql things will work if users not there if user has been added file permission will fail # adduser --no-create-home --disabled-password # cd /etc # nano /etc/shadow # change mysql:*:..... to # mysql:!:..... # nano /etc/passwd # change mysql:x:......:/bin/sh to # mysql:x:.....:/bin/false change permissions of mysql files to user mysql group mysql # cd /usr/local # chown mysql.mysql mysql/ -R (follow the intructions something like) # /usr/local/mysql/bin/mysqladmin -u root password 'new-password' # /usr/local/mysql/bin/mysqladmin -u root -h Minerva password 'new-password' The second line is machine host name line I couldn't get it to work perhaps you can use localhost unsure.
Step 2) Compile and Install Apache we will configure apache to install to /usr/local/apache using the SO module so we can use extra modules, and enable rewrite cause rewrite is good. # ./configure --prefix=/usr/local/apache --enable-module=so --enable-module=rewrite --enable-shared=rewrite # make # make install php requires libxml2-dev # apt-get install libxml2-dev
Step 3) Compile and install PHP extra notes ./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs --with-gd --with-zlib --enable-gd-native-ttf --with-ttf --with-gettext --with-jpeg --with-png --with-gif --disable-magic-quotes --enable-ftp --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr --with-zlib-dir=/usr --with-mssql --enable-msdblib --enable-track-vars --with-ncurses --enable-inline-optimization --enable-bcmath --enable-sockets --enable-force-cgi-redirect configure php to use mysql and apache. # ./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs for gd image handler // not installed gd with ./configure --with-gd=/usr/local/gd/ # ./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs --with-gd=/usr/local/gd #./configure --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs --with-gd --with-zlib #./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mssql --with-zlib --with-ncurses --with-gd --with-jpeg --with-jpeg-dir=/usr/lib/ --with-png --with-gif # make # make install Copy the php.ini from the distrubution. # cp php.ini-dist /usr/local/lib/php.ini Things that may effect http.conf # LoadModule php4_module libexec/ # LoadModule php5_module libexec/ # AddModule mod_php4.c # AddModule mod_php5.c # AddType application/x-httpd-php .php .phtml # AddType application/x-httpd-php-source .phps
Step 4) Modification I like to do to apache. httpd.conf DocumentRoot "/usr/local/apache/htdocs" to DocumentRoot "/var/www/html" <Directory "/usr/local/apache/htdocs"> to <Directory "/var/www/html"> Port 8080 to Port 80 chmod 2755 /var/www/html chown root.staff /var/www/html
Last Modified: 2007-01-01