ComTech: IT Support Stirling
TwitterFacebookGoogle

How to configure services in Linux

ComTech: IT Support Stirling


Today we will have a look at configuring services in Linux.  For the purpose of this tutorial I will use Linux Mint 12 but the majority of the commands can be run on any Linux Distribution.

Seeing what services are running

To check what services are running on our system we need a package called chkconfig. Open up a terminal and type:

sudo apt-get install chkconfig

Once installed we need to check what is currently running (run as normal user) so type:

chkconfig -l

So how do we turn a service on and off?

Chkconfig runlevels

The easiest way is to turn a service off for a particular run level and to do this we use the syntax: chkconfig -s ‘service name’ ‘run levels’.

So to take an example we will make the mysql service above start at runlevels 2 and 3 so type:

sudo chkconfig -s mysql 23

In the above screenshot mysql now starts at run levels 2 and 3

Init Scrips

If you want to start and stop a service right now then you need to use init scripts.  So this time we will stop the clamav-freshclam service so type:

sudo /etc/init.d/clamav-freshclam stop

and

sudo /etc/init.d/clamav-freshclam start to restart.

Upstart

Upstart is the replacement for init scripts and as such some of the services have been re-written to work solely with upstart.  If a particular service is now an upstart job then the syntax is:

service ‘service name’ start/stop

For example to turn the samba daemon on and off you would type:

sudo service samba start

sudo service samba stop

How do you configure a service to start at boot?

You can either use the runlevel method described above or for Upstart jobs use the following syntax:

update-rc.d ‘service name’ defaults

About the Author

P1020114

Hi I’m Chris Wakefield the owner of ComTech IT Support. I provide Windows, Mac and Linux based IT Support to small businesses in Stirling, Alloa and Falkirk.

Follow @Comtech247 on Twitter

 

 

 

 

 

 

 

 

 

 

One thought on “How to configure services in Linux

Leave a comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

CyberChimps
Follow

Get every new post delivered to your Inbox

Join other followers

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera
WP Like Button Plugin by Free WordPress Templates