Modifying Runlevels on Linux

Get Started
30 minutes
  • 5 Learning Objectives

About this Hands-on Lab

A runlevel is a specific mode of operation used by systems that implement System V initialization. In this lab, we are tasked with modifying runlevels for both CentOS and Ubuntu.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Configure the Runlevels on the CentOS Server
  1. Use the chkconfig command to disable the crond service for runlevels 2 and 4:

    chkconfig --level 24 crond off
  2. Use the chkconfig to enable the httpd service for runlevels 3 and 5:

    chkconfig --level 35 httpd on
Modify the Initialization Script for the Postfix Service on the CentOS Server
  1. Use a text editor to modify the init script for postfix at /etc/rc.d/init.d/postfix with the following changes:

  2. Update this line:

    # chkconfig: 2345 80 30

    To be:

    # chkconfig: 3 78 35
  3. Update this line:

    # Default-Start: 2 3 4 5

    To be:

    # Default-Start: 3
  4. Apply the changes.

  5. Remove the postfix service:

    chkconfig --del postfix
  6. Add the postfix service:

    chkconfig --add postfix
Remove the SysVinit Script Links for the Nginx Service
  1. Use the update-rc.d command to remove init links for nginx:

    update-rc.d nginx remove
Enable the Lighttpd Service for Runlevels 2 and 5
  1. Use the update-rc.d command to enable lighttpd for runlevels 2 and 5:

    update-rc.d lighttpd enable 2 5
Create the Default SysVinit links for the Bluetooth Service
  1. Use the update-rc.d command to add the defaults for the Bluetooth service:

    update-rc.d bluetooth defaults

Additional Resources

We, along with our team, are in charge of managing the various Linux systems at our company. In order to comply with the standards throughout the organization, we have been tasked with modifying the run levels for our CentOS and Ubuntu hosts.

For the CentOS hosts, we need to disable the crond service for runlevels 2 and 4. We also must enable the httpd service for runlevels 3 and 5. Then, we need to modify the initialization script for the postfix service with the following changes:

  • The service should only be enabled for runlevel 3.
  • The start priority should be 78.
  • The kill priority should be 35.

Once the script has been updated, the service needs to be deleted and added again to apply the changes.

For the Ubuntu hosts, remove the SysV init links for the nginx service. Then, enable the lighttpd service for runlevels 2 and 5. Finally, add the default SysV init links for the Bluetooth service.

Note: All tasks should be performed as the root user.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?