Compile and Install LAMP Server from Source – PHP5, Apache2, MySQL5

Tagged with: , , , , , , , ,

MySQL

./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-mysqld-user=mysql --with-unix-socket-path=/tmp/mysql.sock --without-comment --without-debug --without-bench
make
make install

cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf
chown -R root:mysql /usr/local/mysql
chown mysql:mysql /var/lib/mysql

./scripts/mysql_install_db

cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
/usr/local/mysql/bin/mysql

Apache

./configure --prefix=/usr/local/apache --enable-so --enable-cgi--enable-info --enable-rewrite --enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic
make
make install

PHP

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --disable-debug --enable-ftp --enable-inline-optimization --enable-magic-quotes --enable-mbstring --enable-mm=shared --enable-safe-mode --enable-track-vars --enable-trans-sid --enable-wddx=shared --enable-xml --with-dom --with-gd --with-gettext --with-mysql=/usr/local/mysql --with-regex=system --with-xml --with-zlib-dir=/usr/lib --with-gettext --with-gdbm

make
make install
cp -p php.ini-recommended /usr/local/php/php.ini

Configuration

httpd.conf
php.ini

One Response to “Compile and Install LAMP Server from Source – PHP5, Apache2, MySQL5

  • 1
    Don
    May 3rd, 2009 03:59

    Hello,

    I like your article. However, may I please make a suggestion. On installing mysql, it will not create the /var/lib/mysql until after you install the database. Also, the ‘chown’ needs to be recursive. So after installing the database, use the command ‘chown -R mysql:mysql /var/lib/mysql’. Doing the way you had instructed spitted out some error codes stating that access denied to database.

Leave a Reply