Question

On CentOS, describer the process of having Apache start automatically after rebooting the server.

On CentOS, describer the process of having Apache start automatically after rebooting the server.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The following example I have taken as Apache HTTP server, but procedure remain same for any other services you wish to start at boot in Red Hat Enterprise Linux (RHEL) or CentOS 6 version.

You can keep any script file name, and here I’ve kept httpd

  • Become as root user on your Linux server
  • Create or copy your script under /etc/init.d/
[root@Chandan init.d]# ls -ltr httpd
-rwxr-xr-x. 1 root root 3371 Jan 6 08:56 httpd
[root@Chandan init.d]#

We will use chkconfig utility which is available default on Linux or CentOS.

  • Add script to start on boot using chkconfig with --add parameter
[root@Chandan init.d]# chkconfig --add httpd
[root@Chandan init.d]# chkconfig httpd on
  • Confirm script is added successfully with --list
[root@Chandan init.d]# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@Chandan init.d]#

That’s all! httpd script will be called to start services on Linux boot.

In case you need to disable auto-start service then you can use the following commands

chkconfig httpd off
chkconfig --del httpd

RHEL or CentOS 7.x

Procedure to configure services on boot in RHEL 7 is slightly different than RHEL 6. It uses systemd to manage the services.

Most of the software like Apache, PHP, MySQL, Nginx scripts are added in services when you install it.

Let’s take an example of PHP-FPM.

First thing first, let’s see the status of php-fpm

[root@instance-1 ~]# systemctl status php-fpm
php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: inactive (dead) 
[root@instance-1 ~]#

As you can see the status is disabled which means it’s not configured to start on boot.

Let’s enable php-fpm to start on boot by using systemctl

[root@instance-1 ~]# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
[root@instance-1 ~]#

Now, let’s see the status

[root@instance-1 ~]# systemctl status php-fpmphp
php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)    Active: inactive (dead) 
[root@instance-1 ~]#

php-fpm is all set to start on boot. Let’s test it by rebooting the server.

If you ever need to disable starting services on boot, then you can use below command

systemctl disable php-fpm
Add a comment
Know the answer?
Add Answer to:
On CentOS, describer the process of having Apache start automatically after rebooting the server.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Answer the following two questions about running a web server: 1. If I wanted to check...

    Answer the following two questions about running a web server: 1. If I wanted to check the status of an Apache service running in the background on CentOS, what command would I use? 2. What command should be ran on CentOS in order to start an Apache webserver at boot time?

  • Why might you send the command kill -1 to the process ID number of the apache...

    Why might you send the command kill -1 to the process ID number of the apache web server instead of kill -9? kill -1 must be used when you are the root user. Kill -9 is only a “polite” request, and often doesn’t work. Because you want your web server to restart and re-read its configuration file, not shut down. Because you should start at the lowest number first, and only raise the number if the prior number doesn’t work.

  • After installing Apache software manually, where will each of the following files be stored? (Give only...

    After installing Apache software manually, where will each of the following files be stored? (Give only the name of the directory) a. Hypertext files (html or server-side files) b. Executable files Explain each of the following settings and identify the name of the configuration file in which they are defined. Setting Explanation Name of configuration File a.. ErrorLog b.. datadir

  • Consider a client and a server connected through one router. Assume the router can start transmitting...

    Consider a client and a server connected through one router. Assume the router can start transmitting an incoming packet after receiving its first h bytes instead of the whole packet. Suppose that the link rates are R byte/s and that the client transmits one packet with a size of L bytes to the server. What is the end-to-end delay? Assume the propagation, processing, and queuing delays are negligible. Generalize the previous result to a scenario where the client and the...

  • Water process Tank Write a program to implement the process ilustrated in the Figure shown. The s...

    use logo! plc program ladder program Water process Tank Write a program to implement the process ilustrated in the Figure shown. The sequence of operation is to be as follows: Normally open start and normally closed stop pushbuttons are used to start and stop the process . When the start button is pressed, solenoid A energizes to start filling the tank. .As the tank fills, the empty level sensor switch closes. When the tank is full, the full level sensor...

  • 1. Two random walkers start out together at the origin, each having equal probability of making...

    1. Two random walkers start out together at the origin, each having equal probability of making a step to the left or right along the r axis. Find the probability that they meet after N steps. (They take their steps simultaneously. It may be helpful to consider their relative motion.)

  • Exercise4.23 Model the following business process at a supplier. After a supplier notifies a retailer of...

    Exercise4.23 Model the following business process at a supplier. After a supplier notifies a retailer of the approval of a purchase order, the supplier can receive an order confirmation, an order change, or an order cancelation from the retailer. It may happen that no response is received at all. If no response is received after 48 h, or if an order cancelation is received, the supplier will cancel the order. If an order confirmation is received within 48 h, the...

  • This is in C. For this assignment we will write a simple database server. We will...

    This is in C. For this assignment we will write a simple database server. We will be creating a simple database of student records, so let’s describe these first. The format of a student record is as follows: typedef struct student {     char lname[ 10 ], initial, fname[ 10 ];     unsigned long SID;     float GPA; } SREC; Part One – the Server We will create a database server. The job of the server is to accept a...

  • I have to modify a server program and chat program to work as the following instructions...

    I have to modify a server program and chat program to work as the following instructions but I am completely clueless as to where to start. I'd appreciate any help on how to atleast get started. This must be done in java. Diffie-Hellman Two parties use a key agreement protocol to generate identical secret keys for encryption without ever having to transmit the secret key. The protocol works by both parties agreeing on a set of values (a) and (q)....

  • need this in #c . You will now add server side validation code to the frmPersonnel...

    need this in #c . You will now add server side validation code to the frmPersonnel page. Currently, when the Submit button is pressed, the frmPersonnelVerified page is displayed. This is because the frmPersonnelVerified page is set as the Submit button's PostBackUrl property. Instead of having the page go directly to the frmPersonnelVerified page when the Submit button is pressed, we want to do some server side validation. If any of the validation rules fail, we will redisplay the frmPersonnel...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT