This tutorial was written by my friend, Josh, not me. He's kindly donated it to Geekery. He's swell. It's for machines running Linux. So, you Windows people can go find something else to do. To get started, open up a terminal window and su to root.
FOLLOW THESE STEPS IN ORDER - MAKE SURE YOU ARE ROOT!
- Download source distrobutions of the following to /usr/local/src/. :
- Unzip and untar MySQL : tar -zxvf mysql-dist.tar.gz
- Create /data/mysql and /usr/local/apache:
- mkdir /data
- mkdir /data/mysql
- mkdir /usr/local/apache
NOTE: This assumes that you have the user mysql configured on your system
- 3) Change to MySQL dir: cd mysql-dist
- Run the configure script with the following options :
- ./configure --prefix=/usr/local/mysql --localstatedir=/data/mysql
NOTE: If you see ERROR: No curses/termcap library found find where libncurses.so.5
is installed on your system and add the following flag to your configure
statement :
--with-named-curses-libs=/usr/path/to/libncurses.so.5
- Make it : make
- Install it : make install
- Set up the DB : scripts/mysql_install_db
- Edit the /etc/rc.d/rc.local File To Auto Start MySQL: add : bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld &'
- Set new root password with :
/usr/local/mysql/bin/mysqladmin -u root -p password 'new password'
NOTE: When it prompts you to enter the password, just hit Enter - if you don't see an error,
the password was successfully changed.
- Unzip and Untar Apache and PHP :
- tar -zxvf apache-dist.tar.gz
- tar -zxvf php-dist.tar.gz
- Change to the Apache directory : cd /usr/local/src/apache-dist
- Configure Apache for PHP: ./configure --prefix=/usr/local/apache
- Change to the PHP dir: cd ../php-dist
- Configure PHP4:./configure --with-apache=../apache-dist
--with-mysql=/usr/local/mysql
--enable-memory-limit=yes
--enable-debug=no
--enable-track-vars
- Make it :
make
- Install it:
make install
- Change back to the Apache dir :
cd ../apache-dist
- Configure Apache with PHP :
./configure --prefix=/usr/local/apache
--activate-module=src/modules/php4/libphp4.a
- Make it :
make
- Install it :
make install
- Edit the /usr/local/apache/conf/httpd.conf file :
- Uncomment : AddType application/xhttpd-php .php
- Add php to : DirectoryIndex index.html index.php
- Add the following lines to the /etc/rc.d/rc.local file to start Apache
and MySQL automatically when the machine boots up:
# Start MySQL Server
/bin/sh -c 'cd /usr/local/mysql; ./bin/safe_mysqld &'
# Start Apache
/usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf
INSTALLATION OF phpMyAdmin AND .htaccess
- Download the current version of phpMyAdmin from http://www.phpwizard.net to
your pages (htdocs, www) directory : /usr/local/apache/pages
- Unzip and untar it: tar -zxvf phpMyAdmin-dist.tar.gz
- Edit the config.inc.php file to use your root name and password
- Copy the htpasswd script to /usr/bin :
cp /usr/local/apache/bin/htpasswd /usr/bin/htpasswd
- Create the .htaccess file :
touch .htaccess
- Add the following :
AuthUserFile /usr/local/apache/pages/phpMyAdmin/.htpasswd
AuthGroupFile /dev/null
AuthName "phpMyAdmin"
AuthType Basic
Require valid-user
- Create the .htpasswd file :htpasswd -bc .htpasswd username password
NOTE: Of course, you'll want to substitute your own values for username and
password. They can be anything - not just system users! Use the -a flag
instead of the -c flag to add users to an existing .htpasswd file.
- Make sure your httpd.conf file allows .htaccess file-reading. In the htaccess config section set the following :
AllowOverride AuthConfig
- Bounce the server (to read the new httpd.conf) and you're good to go!
Questions? Comments? Send them to Josh