This is a basic article on how to configure Linux so that it will run your webserver, telnet, ftp, mysql etc. It is primarily focused for Fedora/RedHat releases but applies to almost all server based flavors.
Read More
Summary of Commands
Trying to Start:
Then try doing this:
httpd cd /etc/rc.d/init.d/
then type:
./httpd start
mysql cd /etc/rc.d/init.d/
then type:
./mysqld start
telnet Edit the file /etc/xinetd.d/telnetd
changing the two lines to:
# default: on
disabled = no
then try doing this
/etc/rc.d/init.d/xinetd restart
ftp
Edit the file /etc/xinetd.d/wu-ftpd
changing the two lines to:
# default: on
disabled = no
then run the command
/etc/rc.d/init.d/xinetd restart
Details of Configuring Linux
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:
/sbin/chkconfig --list
The output would look something like:
…
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
telnet: off
…
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:
cd /etc/rc.d/init.d/
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:
./httpd start
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:
/etc/rc.d/rc5.d
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:
./httpd start
mv k15httpd s15httpd
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:
cd /etc/xinetd.d/
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 lines:
# 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:
/etc/rc.d/init.d/xinetd restart
Finally, you should see:
Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
Believe it or not, following all of this you should now have running:
httpd (webserver)
telnet
Now check to see what processes you have running again by using:
/sbin/chkconfig –list
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!
No comments:
Post a Comment