Steps to Build a SLAMPS Server - Slackware Linux, Apache2, MySQL, PHP, SSL

Here is what we are using:

Build MySQL

  1. cd /downloads
  2. create a mysql user and mysql group if they don't already exist
  3. mkdir /var/run/mysql
  4. chown -R mysql.mysql /var/run/mysql
  5. wget latest source from http://www.mysql.com
  6. tar zxvf mysql-5.0.24.tar.gz
  7. cd mysql-5.0.24
  8. ./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
  9. make
  10. make install
  11. echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
  12. ldconfig
  13. cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
  14. cd /usr/local/mysql
  15. bin/mysql_install_db --user=mysql
  16. cd /usr/local
  17. chown -R root.mysql mysql
  18. cd /home
  19. chown -R mysql mysql
  20. /usr/local/mysql/bin/mysqld_safe &
  21. Now we will set the root password for localhost and host_name and delete the anonymous accounts for localhost and host_name
  22. cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/rc.mysqld


Build Apache

  1. cd /downloads
  2. Create apache user and group if they don't already exist:
  3. wget latest source from http://httpd.apache.org
  4. tar zxvf httpd-2.2.3.tar.gz
  5. cd httpd-2.2.3
  6. ./configure --prefix=/usr/local/apache --enable-mods-shared=most --enable-deflate --enable-ssl
  7. make
  8. make install
  9. echo "/usr/local/apache/lib" >> /etc/ld.so.conf
  10. ldconfig
  11. cd /usr/local/apache/conf
  12. mkdir ssl.crt ssl.key ssl.csr
  13. openssl req -new -out server.csr
  14. openssl rsa -in privkey.pem -out server.key
  15. openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
  16. rm privkey.pem
  17. mv server.crt ssl.crt/
  18. mv server.key ssl.key/
  19. mv server.csr ssl.csr/
  20. edit httpd.conf and do the following:
  21. edit extras/httpd-ssl.conf and change the following (the paths don't have the ssl.* directories by default):
  22. echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local
  23. /usr/local/apache/bin/apachectl start
  24. go to http://your_server and https://your_server to make sure Apache is working on both ports 80 and 443


Build PHP

  1. cd /downloads
  2. wget latest source from http://www.php.net
  3. tar zxvf php-5.1.4.tar.gz
  4. cd php-5.1.4
  5. ./configure --prefix=/usr/local --with-config-file-path=/etc --with-apxs2=/usr/local/apache/bin/apxs --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
  6. make
  7. make install
  8. cp php.ini-recommended /etc/php.ini
  9. edit /etc/php.ini and do the following:
  10. edit /usr/local/apache/conf/httpd.conf and do the following:
  11. /usr/local/apache/bin/apachectl restart
  12. echo "<? phpinfo(); ?>" > /usr/local/apache/htdocs/test.php
  13. go to http://your_server/test.php and see if your PHP is working


Copyright © 2006, Adam Cantwell