Latest LQ Deal: Linux Power User Bundle
Go Back > Blogs > Lumak's Guide to Random Things
User Name


OK I don't really have a good title yet but I figure I can post works in progress and other tips I've come across or other interesting things.
Rate this Entry

HOWTO: LAMP server on Slackware

Posted 01-20-2011 at 11:01 AM by lumak

This is a short HOWTO in getting a basic LAMP server running on Slackware. You will have to do more reading if you really want to know the details about configuring everything. I call this 'ready to confirm you want the defaults.' Please send me a message if you think I missed something.

set the execute bit on /etc/rc.d/rc.httpd
chmod +x /etc/rc.d/rc.httpd
As far as getting a basic web server up and running, that's all you need.
Slackware's web server directory is /var/www. You would place your webpage files in htdocs subdirectory. You will also find /srv has two symbolic links in it that both point to /var/www. Being that the /etc/httpd/httpd.conf file uses:
DocumentRoot "/srv/httpd/htdocs"
You can change the location of your webpage folders by copying /var/www somewhere and changing the symbolic links in /srv... Or you can customize /etc/httpd/httpd.conf anyway you want. It's up to you.

MySQL is not set up with an initial database in Slackware. This is why so many people can't figure out how to start it. However, the start up script it self contains the instructions on configuring MySQL with the initial database. Read the comments on the script /etc/rc.d/rc.mysqld as well as the man pages for the following two commands.
mysql_install_db --user=mysql
Set the execute bit on /etc/rc.d/rc.mysqld
chmod +x /etc/rc.d/rc.mysqld
Additionally, if you need other computers on the network to access the database, comment out the following line in the start up script /etc/rc.d/rc.mysqld:
# This is a security thing.  If the database is just for local access,
# there is no reason to make it visible on the network.
While not specifically needed, you can choose a configuration file from those listed in /etc/my-*.cnf to better control the resources that mySQL uses. This is really only needed if you have less than 2 gigs of ram on your system and access the database at lot.

Note, the mod_dbd module is already included in the httpd.conf file. SQL access should work for any module that uses it.

Uncomment the following line at the end of the /etc/httpd/httpd.conf file
Include /etc/httpd/mod_php.conf
On around line 231 in the same script there is the following block
<IfModule dir_module>
  DirectoryIndex index.html
You may want to append "index.php" to allow you to have the default page of a directory with a php extension.

Now copy the example config files in place for php. Read them for more detail.
cp /etc/httpd/mod_php.conf.example /etc/httpd/mod_php.conf
cp /etc/httpd/php.ini-recommended /etc/httpd/php.ini

Install mod_perl/mod_python from Enable it in the /etc/httpd/httpd.conf file by adding to the end:
Include /etc/httpd/mod_perl.conf
Include /etc/httpd/mod_python.conf
You may want to look at their configuration files and make sure they are actually there. They may have a .new extension on them and or some other suffix.

Starting it up
You can choose to reboot or start Apache and MySQL manually.
sh /etc/rc.d/rc.httpd start
sh /etc/rc.d/rc.mysqld start
Note! if you already had the execute bits set when the computer was booted, then Apache is already running! MySQL probably was not if it was not configured. You can always restart the servers by using "restart" instead. For that matter, you can also stop them by using "stop".
Views 2313 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 10:21 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration