How do I install Apache as a “service unit”?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I wanted to run Apache as a service so it will start on bootup, so I tried:
sudo systemctl start apache2.service
but got the error:
Failed to start apache2.service: Unit apache2.service not found.
So, apparently I need to install apache as a "service unit". The Apache documentation does not appear to have information on how to do this, just the old confusing init.d instructions which do not work anymore.
debian apache-httpd
add a comment |
up vote
0
down vote
favorite
I wanted to run Apache as a service so it will start on bootup, so I tried:
sudo systemctl start apache2.service
but got the error:
Failed to start apache2.service: Unit apache2.service not found.
So, apparently I need to install apache as a "service unit". The Apache documentation does not appear to have information on how to do this, just the old confusing init.d instructions which do not work anymore.
debian apache-httpd
1
Did you actually installapache2?
– Nasir Riley
yesterday
@NasirRiley Yes, works fine. I usually start it with apachectl but I would like to start it as a service now (or some kind of startup script) so that it starts automatically on boot.
– Tyler Durden
yesterday
What Debian is that?
– Tomasz
yesterday
1
What do you get fromsystemctl list-unit-files | grep apache? Also, did you install it viaaptor did you compile it from source?
– Nasir Riley
yesterday
@NasirRiley I get nothing when I enter that. I built it from source, but added many features. Possibly I missed the one that automatically enables it to run as a service?
– Tyler Durden
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I wanted to run Apache as a service so it will start on bootup, so I tried:
sudo systemctl start apache2.service
but got the error:
Failed to start apache2.service: Unit apache2.service not found.
So, apparently I need to install apache as a "service unit". The Apache documentation does not appear to have information on how to do this, just the old confusing init.d instructions which do not work anymore.
debian apache-httpd
I wanted to run Apache as a service so it will start on bootup, so I tried:
sudo systemctl start apache2.service
but got the error:
Failed to start apache2.service: Unit apache2.service not found.
So, apparently I need to install apache as a "service unit". The Apache documentation does not appear to have information on how to do this, just the old confusing init.d instructions which do not work anymore.
debian apache-httpd
debian apache-httpd
edited yesterday
asked yesterday
Tyler Durden
1,48641849
1,48641849
1
Did you actually installapache2?
– Nasir Riley
yesterday
@NasirRiley Yes, works fine. I usually start it with apachectl but I would like to start it as a service now (or some kind of startup script) so that it starts automatically on boot.
– Tyler Durden
yesterday
What Debian is that?
– Tomasz
yesterday
1
What do you get fromsystemctl list-unit-files | grep apache? Also, did you install it viaaptor did you compile it from source?
– Nasir Riley
yesterday
@NasirRiley I get nothing when I enter that. I built it from source, but added many features. Possibly I missed the one that automatically enables it to run as a service?
– Tyler Durden
yesterday
add a comment |
1
Did you actually installapache2?
– Nasir Riley
yesterday
@NasirRiley Yes, works fine. I usually start it with apachectl but I would like to start it as a service now (or some kind of startup script) so that it starts automatically on boot.
– Tyler Durden
yesterday
What Debian is that?
– Tomasz
yesterday
1
What do you get fromsystemctl list-unit-files | grep apache? Also, did you install it viaaptor did you compile it from source?
– Nasir Riley
yesterday
@NasirRiley I get nothing when I enter that. I built it from source, but added many features. Possibly I missed the one that automatically enables it to run as a service?
– Tyler Durden
yesterday
1
1
Did you actually install
apache2?– Nasir Riley
yesterday
Did you actually install
apache2?– Nasir Riley
yesterday
@NasirRiley Yes, works fine. I usually start it with apachectl but I would like to start it as a service now (or some kind of startup script) so that it starts automatically on boot.
– Tyler Durden
yesterday
@NasirRiley Yes, works fine. I usually start it with apachectl but I would like to start it as a service now (or some kind of startup script) so that it starts automatically on boot.
– Tyler Durden
yesterday
What Debian is that?
– Tomasz
yesterday
What Debian is that?
– Tomasz
yesterday
1
1
What do you get from
systemctl list-unit-files | grep apache? Also, did you install it via apt or did you compile it from source?– Nasir Riley
yesterday
What do you get from
systemctl list-unit-files | grep apache? Also, did you install it via apt or did you compile it from source?– Nasir Riley
yesterday
@NasirRiley I get nothing when I enter that. I built it from source, but added many features. Possibly I missed the one that automatically enables it to run as a service?
– Tyler Durden
yesterday
@NasirRiley I get nothing when I enter that. I built it from source, but added many features. Possibly I missed the one that automatically enables it to run as a service?
– Tyler Durden
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
Building apache2 from source does not create a service for it. That is why you are getting the error that the service isn't found.
You will either need to create one manually or install apache2 via apt. The latter is much easier and you can also install all of the features that you added. To get it to run at boot, you will need to use systemctl enable apache2 after creating the service or installing apache2 via apt.
Ok, so how do I manually create a service unit for Apache? That is the question?
– Tyler Durden
yesterday
2
You could just copy the apache2.service file from the Debian source, replace the paths to represent your source install, and place it in/etc/systemd/system/. Aftersystemctl daemon-reloadit should be available
– GracefulRestart
yesterday
@NasirRiley That's whatsystemctl enable apache2.servicedoes (assuming the[Install]section has been correctly configured.) I'd recommend enabling it throughsystemctl enablerather than creating symbolic links by hand.
– Filipe Brandenburger
yesterday
1
Building it from the Debian source does include the service units, as well as a number of patches that make Apache use Debian paths and whatnot. The problem here is likely to be building from the wrong source.
– JdeBP
yesterday
1
@FilipeBrandenburger You are correct. It even says so when you runsystemctl enable service. I'll remove that comment since it's uneccessary redundant.
– Nasir Riley
yesterday
|
show 5 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Building apache2 from source does not create a service for it. That is why you are getting the error that the service isn't found.
You will either need to create one manually or install apache2 via apt. The latter is much easier and you can also install all of the features that you added. To get it to run at boot, you will need to use systemctl enable apache2 after creating the service or installing apache2 via apt.
Ok, so how do I manually create a service unit for Apache? That is the question?
– Tyler Durden
yesterday
2
You could just copy the apache2.service file from the Debian source, replace the paths to represent your source install, and place it in/etc/systemd/system/. Aftersystemctl daemon-reloadit should be available
– GracefulRestart
yesterday
@NasirRiley That's whatsystemctl enable apache2.servicedoes (assuming the[Install]section has been correctly configured.) I'd recommend enabling it throughsystemctl enablerather than creating symbolic links by hand.
– Filipe Brandenburger
yesterday
1
Building it from the Debian source does include the service units, as well as a number of patches that make Apache use Debian paths and whatnot. The problem here is likely to be building from the wrong source.
– JdeBP
yesterday
1
@FilipeBrandenburger You are correct. It even says so when you runsystemctl enable service. I'll remove that comment since it's uneccessary redundant.
– Nasir Riley
yesterday
|
show 5 more comments
up vote
2
down vote
Building apache2 from source does not create a service for it. That is why you are getting the error that the service isn't found.
You will either need to create one manually or install apache2 via apt. The latter is much easier and you can also install all of the features that you added. To get it to run at boot, you will need to use systemctl enable apache2 after creating the service or installing apache2 via apt.
Ok, so how do I manually create a service unit for Apache? That is the question?
– Tyler Durden
yesterday
2
You could just copy the apache2.service file from the Debian source, replace the paths to represent your source install, and place it in/etc/systemd/system/. Aftersystemctl daemon-reloadit should be available
– GracefulRestart
yesterday
@NasirRiley That's whatsystemctl enable apache2.servicedoes (assuming the[Install]section has been correctly configured.) I'd recommend enabling it throughsystemctl enablerather than creating symbolic links by hand.
– Filipe Brandenburger
yesterday
1
Building it from the Debian source does include the service units, as well as a number of patches that make Apache use Debian paths and whatnot. The problem here is likely to be building from the wrong source.
– JdeBP
yesterday
1
@FilipeBrandenburger You are correct. It even says so when you runsystemctl enable service. I'll remove that comment since it's uneccessary redundant.
– Nasir Riley
yesterday
|
show 5 more comments
up vote
2
down vote
up vote
2
down vote
Building apache2 from source does not create a service for it. That is why you are getting the error that the service isn't found.
You will either need to create one manually or install apache2 via apt. The latter is much easier and you can also install all of the features that you added. To get it to run at boot, you will need to use systemctl enable apache2 after creating the service or installing apache2 via apt.
Building apache2 from source does not create a service for it. That is why you are getting the error that the service isn't found.
You will either need to create one manually or install apache2 via apt. The latter is much easier and you can also install all of the features that you added. To get it to run at boot, you will need to use systemctl enable apache2 after creating the service or installing apache2 via apt.
answered yesterday
Nasir Riley
2,126239
2,126239
Ok, so how do I manually create a service unit for Apache? That is the question?
– Tyler Durden
yesterday
2
You could just copy the apache2.service file from the Debian source, replace the paths to represent your source install, and place it in/etc/systemd/system/. Aftersystemctl daemon-reloadit should be available
– GracefulRestart
yesterday
@NasirRiley That's whatsystemctl enable apache2.servicedoes (assuming the[Install]section has been correctly configured.) I'd recommend enabling it throughsystemctl enablerather than creating symbolic links by hand.
– Filipe Brandenburger
yesterday
1
Building it from the Debian source does include the service units, as well as a number of patches that make Apache use Debian paths and whatnot. The problem here is likely to be building from the wrong source.
– JdeBP
yesterday
1
@FilipeBrandenburger You are correct. It even says so when you runsystemctl enable service. I'll remove that comment since it's uneccessary redundant.
– Nasir Riley
yesterday
|
show 5 more comments
Ok, so how do I manually create a service unit for Apache? That is the question?
– Tyler Durden
yesterday
2
You could just copy the apache2.service file from the Debian source, replace the paths to represent your source install, and place it in/etc/systemd/system/. Aftersystemctl daemon-reloadit should be available
– GracefulRestart
yesterday
@NasirRiley That's whatsystemctl enable apache2.servicedoes (assuming the[Install]section has been correctly configured.) I'd recommend enabling it throughsystemctl enablerather than creating symbolic links by hand.
– Filipe Brandenburger
yesterday
1
Building it from the Debian source does include the service units, as well as a number of patches that make Apache use Debian paths and whatnot. The problem here is likely to be building from the wrong source.
– JdeBP
yesterday
1
@FilipeBrandenburger You are correct. It even says so when you runsystemctl enable service. I'll remove that comment since it's uneccessary redundant.
– Nasir Riley
yesterday
Ok, so how do I manually create a service unit for Apache? That is the question?
– Tyler Durden
yesterday
Ok, so how do I manually create a service unit for Apache? That is the question?
– Tyler Durden
yesterday
2
2
You could just copy the apache2.service file from the Debian source, replace the paths to represent your source install, and place it in
/etc/systemd/system/. After systemctl daemon-reload it should be available– GracefulRestart
yesterday
You could just copy the apache2.service file from the Debian source, replace the paths to represent your source install, and place it in
/etc/systemd/system/. After systemctl daemon-reload it should be available– GracefulRestart
yesterday
@NasirRiley That's what
systemctl enable apache2.service does (assuming the [Install] section has been correctly configured.) I'd recommend enabling it through systemctl enable rather than creating symbolic links by hand.– Filipe Brandenburger
yesterday
@NasirRiley That's what
systemctl enable apache2.service does (assuming the [Install] section has been correctly configured.) I'd recommend enabling it through systemctl enable rather than creating symbolic links by hand.– Filipe Brandenburger
yesterday
1
1
Building it from the Debian source does include the service units, as well as a number of patches that make Apache use Debian paths and whatnot. The problem here is likely to be building from the wrong source.
– JdeBP
yesterday
Building it from the Debian source does include the service units, as well as a number of patches that make Apache use Debian paths and whatnot. The problem here is likely to be building from the wrong source.
– JdeBP
yesterday
1
1
@FilipeBrandenburger You are correct. It even says so when you run
systemctl enable service. I'll remove that comment since it's uneccessary redundant.– Nasir Riley
yesterday
@FilipeBrandenburger You are correct. It even says so when you run
systemctl enable service. I'll remove that comment since it's uneccessary redundant.– Nasir Riley
yesterday
|
show 5 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481823%2fhow-do-i-install-apache-as-a-service-unit%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Did you actually install
apache2?– Nasir Riley
yesterday
@NasirRiley Yes, works fine. I usually start it with apachectl but I would like to start it as a service now (or some kind of startup script) so that it starts automatically on boot.
– Tyler Durden
yesterday
What Debian is that?
– Tomasz
yesterday
1
What do you get from
systemctl list-unit-files | grep apache? Also, did you install it viaaptor did you compile it from source?– Nasir Riley
yesterday
@NasirRiley I get nothing when I enter that. I built it from source, but added many features. Possibly I missed the one that automatically enables it to run as a service?
– Tyler Durden
yesterday