Steps to Build a SLAMPS Server - Slackware Linux, Apache, MySQL, PHP, SSL
Here is what we are using:
- Slackware 10.2
- Apache 1.3.37
- MySQL 5.0.24
- PHP 5.1.4
- OpenSSL
Build MySQL
- cd /downloads
- create a mysql user and mysql group if they don't already exist:
- groupadd mysql
- useradd -g mysql -d /usr/local/mysql -s /bin/false mysql
- mkdir /var/run/mysql
- chown -R mysql.mysql /var/run/mysql
- wget latest source from http://www.mysql.com
- tar zxvf mysql-5.0.24.tar.gz
- cd mysql-5.0.24
- ./configure --prefix=/usr/local/mysql --localstatedir=/home/mysql --enable-assembler --enable-thread-safe-client --with-unix-socket-path=/var/run/mysql/mysql.pid --with-mysqld-user=mysql --with-extra-charsets=none --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --without-debug --without-bench --without-docs
- make
- make install
- echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
- ldconfig
- cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
- cd /usr/local/mysql
- bin/mysql_install_db --user=mysql
- cd /usr/local
- chown -R root.mysql mysql
- cd /home
- chown -R mysql mysql
- /usr/local/mysql/bin/mysqld_safe &
- Now we will set the root password for localhost and host_name and delete the anonymous accounts for localhost and host_name
- /usr/local/mysql/bin/mysql -u root
- SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
- SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
- DELETE FROM mysql.user WHERE Host='localhost' AND User='';
- DELETE FROM mysql.user WHERE Host='host_name' AND User='';
- FLUSH PRIVILEGES;
- cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/rc.mysqld
Configure Apache
- cd /downloads
- wget latest source from http://httpd.apache.org
- tar zxvf apache_1.3.37.tar.gz
- cd apache_1.3.37
- ./configure --prefix=/usr/local/apache
Configure mod_ssl
- cd /downloads
- wget source that matches Apache version from http://www.modssl.org
- tar zxvf mod_ssl-2.8.28-1.3.37.tar.gz
- cd mod_ssl-2.8.28-1.3.37
- ./configure --with-apache=../apache_1.3.37 --with-ssl --prefix=/usr/local/apache --enable-module-so
Build PHP
- cd /downloads
- wget latest source from http://www.php.net
- tar zxvf php-5.1.4.tar.gz
- cd php-5.1.4
- ./configure --prefix=/usr/local --with-config-file-path=/etc --with-apache=../apache_1.3.37 --with-mysql=/usr/local/mysql --with-mysql-sock=/var/run/mysql/mysql.sock --with-mysqli=/usr/local/mysql/bin/mysql_config --with-openssl --enable-ftp --disable-debug --enable-memory-limit --enable-inline-optimization --enable-magic-quotes --enable-mbstring --enable-track-vars --enable-xml --with-dom --with-xml --enable-sockets --with-zlib --with-gettext --with-pear --with-apsell
- make
- make install
- cp php.ini-recommended /etc/php.ini
- edit /etc/php.ini and do the following:
- change "short_open_tag" to On
- change include_path to ".:/usr/local/lib/php"
Build Apache
- cd /downloads/apache_1.3.37
- Create apache user and group if they don't already exist:
- groupadd apache
- useradd -g apache -d /dev/null -s /bin/false apache
- SSL_BASE=SYSTEM ./configure --prefix=/usr/local/apache --with-layout=GNU --activate-module=src/modules/php5/libphp5.a --enable-module=ssl --disable-rule=SSL_COMPAT --enable-rule=SSL_SDBM --disable-module=status --disable-module=imap --server-uid=apache --server-gid=apache
- make
- make certificate TYPE=test
- make install
- edit /usr/local/apache/etc/httpd.conf do the following for PHP support:
- add "index.php" to DirectoryIndex directive"
- add "AddType application/x-httpd-php .php .phtml .inc .class" to the end of the file
- echo "/usr/local/apache/sbin/apachectl start" >> /etc/rc.d/rc.local
- /usr/local/apache/sbin/apachectl start
- The above starts Apache in normal mode. To start in SSL mode, do 'startssl' instead of 'start'.
- go to http://your_server and https://your_server to make sure Apache is working on both ports 80 and 443
- echo "<? phpinfo(); ?>" > /usr/local/apache/share/htdocs/test.php
- go to http://your_server/test.php and see if your PHP is working
Copyright © 2006, Adam Cantwell