Home>Article>Operation and Maintenance> Can centos apache be deleted?

Can centos apache be deleted?

藏色散人
藏色散人 Original
2022-01-27 14:53:52 2903browse

How to delete apache in centos: 1. Stop the httpd service through the "#systemctl stop httpd.service" command; 2. Uninstall it through the "rpm -e" or "yum -erase" command.

Can centos apache be deleted?

The operating environment of this article: CentOS 7 system, DELL G3 computer

Can centos apache be deleted?

centos 7 Install and uninstall the apache (httpd) service

We have installed mysql before, install httpd today, and then try to access the following, due to the blog The master has already been installed once, so I will uninstall it first and then install it.

Uninstall

First of all, make sure it has been installed or the system comes with httpd service. Run the following command:

# rpm -qa | grep httpd

or :

# yum list | grep httpd


I have already installed it once, so it will be displayed as follows:


Then I will uninstall it first For httpd, you must first stop the httpd service. The command is as follows:

# systemctl stop httpd.service

Then you can use the rpm -e or yum -erase command. However, when naming rpm -e, you must uninstall the dependent package yourself first, so I use yum - The erase command is used to uninstall. The command is as follows:

# yum erase httpd.x86_64


In the middle, you will be asked if you want to confirm, just y, until Complete! appears, which means the uninstallation is complete.

Installation

If you want to confirm whether the uninstallation is clean, you can use the list command to list the installed ones (the first step of uninstallation). We will not do this here. We directly list the httpd items in the yum warehouse. The command is as follows:

# yum list | grep httpd


Then, see that it is available again After the entry, we enter the following command to install:

# yum install httpd


Enter 'y' several times in the middle, and the installation is complete.

Then we check the running status of httpd through the following command:

# systemctl status httpd.service

If httpd is not started, we can start the service through the following command:

# systemctl start httpd.service

The default www directory is under /var/www/html/, so we write an html file to see what happens. Enter the command to create a file containing the hello world string:

# echo 'hello world' > /var/www/html/index.html

Then, We use curl to access the local:

# curl 127.0.0.1



It is already in normal service!

Recommended: "centos usage tutorial"

The above is the detailed content of Can centos apache be deleted?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn