Configure network services to start automatically at boot
Leslie is a RHEL Sysadmin at Google:
- Her RHEL Server: RHEL_Server_GA
- Her username: leslie.akran
- Her preference: NEVER run commands as root
- Her certs: LFCS, RHCSA
- Her task: Configure network services to start automatically at boot
Leslie is about to be promoted to RHEL Lead Trainer at Google. Her job is to teach a class of 33 LFCS candidates so that they pass the LFCS exam on their first try. Please give and explain several command examples that will help Leslie to complete teaching this task.
Certainly! Here are several command examples that Leslie can use to teach her class of LFCS candidates about configuring network services to start automatically at boot in RHEL:
- Enable a network service to start at boot:
- sudo systemctl enable <service_name>
- This command allows a network service to automatically start during system boot. It creates the necessary symbolic links in the appropriate runlevel directories.
- Disable a network service from starting at boot:
- sudo systemctl disable <service_name>
- By using this command, Leslie can prevent a network service from starting automatically during system boot. It removes the symbolic links from the runlevel directories.
- Check the status of a network service:
- sudo systemctl status <service_name>
- This command displays the current status of the specified network service, including whether it is running or not. It helps in verifying the service's operational state.
- Start a network service:
- sudo systemctl start <service_name>
Use this command to manually start a specific network service immediately. It will initiate the service without waiting for the next system boot.
- Stop a network service:
- sudo systemctl stop <service_name>
This command stops a running network service. It halts the service's operation until it is explicitly started again.
- Restart a network service:
- sudo systemctl restart <service_name>
- By using this command, Leslie can stop and then start a specific network service. It ensures that any changes or updates to the service's configuration take effect.
- View the list of enabled network services:
- sudo systemctl list-unit-files --type=service | grep enabled
- This command displays a list of all enabled network services. It helps Leslie and her students quickly identify the services configured to start automatically at boot.
- View the list of all network services:
- sudo systemctl list-unit-files --type=service
- Using this command, Leslie can show her students a comprehensive list of all network services available on the system, including both enabled and disabled services.
- Check if a network service is enabled or disabled:
- sudo systemctl is-enabled <service_name>
- This command indicates whether a network service is currently enabled or disabled for automatic startup. It helps verify the configuration of individual services.
Remember, Leslie should emphasize the importance of using
sudo to execute these commands with elevated privileges, as system-level operations generally require administrative access. Encourage her students to exercise caution and double-check the commands before executing them to avoid unintended consequences or modifications to critical network services.