Configuring Web Server Startup for Boot Time - XK0-004 CompTIA Linux+ Exam

Ensure Web Server Starts at Boot Time

Question

A systems administrator receives a report that the web server is not running after a planned system reboot.

After starting the web server manually, which of the following commands should the administrator issue to ensure the web server starts at boot time?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

https://geekflare.com/how-to-auto-start-services-on-boot-in-linux/

The correct answer to the question is B. systemctl enable <name>.service.

When a system reboots, it typically starts only the basic services required to boot the system. Any additional services, such as a web server, must be started manually or configured to start automatically at boot time.

The systemctl command is used to control the systemd system and service manager. The systemctl enable command is used to enable a service to start automatically at boot time.

To enable a service, you need to specify the name of the service. In this case, since the question does not provide the name of the web server service, you would need to replace &lt;name&gt;.service with the actual name of the service. For example, if the web server service is named httpd, the command would be:

bash
systemctl enable httpd.service

This command creates a symbolic link from the service file in the /usr/lib/systemd/system directory to the /etc/systemd/system/multi-user.target.wants/ directory, which is where systemd looks for services to start at boot time.

Option A, systemctl service on, is not a valid command. The correct syntax for starting a service with systemctl is systemctl start <name>.service.

Option C, systemctl service enable, is not a valid command. The correct syntax for enabling a service with systemctl is systemctl enable <name>.service.

Option D, systemctl on <name>.service, is not a valid command. The correct syntax for enabling a service with systemctl is systemctl enable <name>.service.