A review of Linux Configuration for Server use, written by Mark Rais, author of Linux for the Rest of Us 2nd Edition and sr. editor for reallylinux.com.
In this brief introductory article, I share the core details for how to configure Linux so
that it will run your webserver, telnet, ftp, mysql etc.
This means we will be configuring processes including: httpd, mysql, xinetd. Please note that this article is primarily focused on the RedHat/Fedora Linux flavor.
I also recommend you get familiar with these Commands for Server Administrators .
Summary of Commands
|Trying to Start:||
Then try doing this:
|telnet||Edit the file
changing the two lines to:
# default: on
disabled = no
then try doing this
Details of Configuring
EDITORS NOTE: Some of the newest flavors of Linux have changed the locations of the configuration files. For this reason please note that most of these commands apply best to Fedora/Redhat. However, some configuration commands like the use of xinetd or running chkconfig are useful on almost all Linux/Unix systems.
First off, I should mention that this guide is best used when in front of your Linux computer, with an open xterm session. The exact commands come from RedHat 7.1+ related server, but apply to most Linux servers.
TIP 1. When you need to find a particular file/directory then use the 'locate' command (on Fedora slocate works well too) to find things on your server. Like, typing: locate xinetd
TIP 2. If you did not know this already, all of the web server html files for Fedora are placed under: /var/www/html
Step 1. Which Processes are Running On Your Server?
If you don't know, then you need to find out asap! Use the command:
The output would look
The above command will give you a long list of processes with info beside them like "off". Any process with the word "off" next to it can be assumed disabled by default during startup. You should look for your processes that are usually needed for running a webserver like httpd, telnet, wu-ftp, mysqld. All of these should be "on" by default.
Step 2. Get Processes Started
Starting up your webserver (httpd), mysql (mysqld), sendmail, etc. is easy so long as you follow the directions from the steps below.
For your webserver and mysql, you can enable these things right away for use during this session.
Change to the initialization (aka init) directory:
This directory (when listed) shows all processes you can start like httpd and mysqld. For now let's start our web server with the command:
You should then see:
Starting httpd: [ OK ]
Now enable your webserver (httpd) for ALL future STARTUPS!
1. Edit the config files as applied to
the "rc" directory of your choice. Remember that all
resource files activated at different run times are in different
rc.d directories. For instance, when your server is loaded at
runtime level 5 (usual) then all the resources under rc5.d are
activated. Change directory to:
Remember that the rc5.d is a resource directory (under /etc) for run level 5... etc.
You edit files in these directories to control what occurs at different run levels. Files with a prefix of K are NOT installed to run at startup. Files with S are ready to run at startup. Example names: K74ypserv or S14nfslock.
You can always use something like the command:
/sbin/chkconfig --add httpd
to add the web server to the future startups. However, I prefer doing my change manually.
2. You can manually force this by simply using a command like:
mv K15httpd S15httpd
Summary for those needing one... You now should have your webserver started and ready as default for all future starts with:
Step 3. What About telnet and ftp?
Ok, you're smart enough to have noticed that following the steps above you can not get telnet or ftp started. That's because they are not part of the initd process, but rather the xinetd process. The xinetd process handles the startup of all of your network related protocols etc.
1st Start telnet first by changing directories to xinetd:
Next type ls to list all of the processes that can be configured. You'll notice for instance the file telnet.
2nd Edit the telnet file and change two
# default: on
disabled = no
These lines are not adjacent, but usually the first and last lines of the configuration file (in our case telnet). You need to edit all configuration files that apply to things you're trying to start. Many processes come by default turned off and disabled = yes. You can edit files like telnet, wu-ftp, etc.
3rd Once you have edited and saved the files with the default on and disabled = no, you can force an automatic restart of the xinetd to load without rebooting:
Finally, you should see:
Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
Believe it or not, following all of this you should now have running:
Now check to see what processes you have running again by using:
or use the long "process" ps command like: ps -e | grep http.
You can use these same steps above to get mysql and ftp running. Replace httpd with mysql, and telnet with wu-ftpd. Always remember there is a difference between configuration and startup files under initd and xinetd.
Hopes this helps you get going! Special thanks to John for his inspiration and to Tom for catching a typo that could have mislead readers!
Other Linux Help (Reallylinux site)