Steps to Build a SLAMPS Server - Slackware Linux, Apache2, MySQL, PHP, SSL
Here is what we are using:
- Slackware 10.2
- Apache 2.2.3
- 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
Build Apache
- cd /downloads
- Create apache user and group if they don't already exist:
- groupadd apache
- useradd -g apache -d /dev/null -s /bin/false apache
- wget latest source from http://httpd.apache.org
- tar zxvf httpd-2.2.3.tar.gz
- cd httpd-2.2.3
- ./configure --prefix=/usr/local/apache --enable-mods-shared=most --enable-deflate --enable-ssl
- make
- make install
- echo "/usr/local/apache/lib" >> /etc/ld.so.conf
- ldconfig
- cd /usr/local/apache/conf
- mkdir ssl.crt ssl.key ssl.csr
- openssl req -new -out server.csr
- openssl rsa -in privkey.pem -out server.key
- openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
- rm privkey.pem
- mv server.crt ssl.crt/
- mv server.key ssl.key/
- mv server.csr ssl.csr/
- edit httpd.conf and do the following:
- Change User and Group to "apache"
- Uncomment "Include conf/extra/httpd-default.conf"
- Uncomment "Include conf/extra/httpd-ssl.conf"
- edit extras/httpd-ssl.conf and change the following (the paths don't have the ssl.* directories by default):
- SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt
- SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key
- echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local
- /usr/local/apache/bin/apachectl start
- go to http://your_server and https://your_server to make sure Apache is working on both ports 80 and 443
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-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
- 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"
- edit /usr/local/apache/conf/httpd.conf and do the following:
- make sure install added "LoadModule php5_module modules/libphp5.so"
- add "index.php" to DirectoryIndex directive
- add "AddType application/x-httpd-php .php .inc .class" to the end of the file
- /usr/local/apache/bin/apachectl restart
- echo "<? phpinfo(); ?>" > /usr/local/apache/htdocs/test.php
- go to http://your_server/test.php and see if your PHP is working
Copyright © 2006, Adam Cantwell