apache2 服务器向我显示我的 azure vm 中当前安装的版本,即使它已卸载

问题描述 投票:0回答:1

我的 Azure VM 是 Linux (Ubuntu) -20.04。

很久回来了,安装了apache2(版本是2.4.41)。现在我尝试卸载 apache2、nginx,但是当我在 azure vm(putty)中输入 apache2 -v 命令时,它仍然向我显示该服务器的当前版本。为什么?

我使用的命令

sudo apt remove nginx
sudo apt remove apache2
sudo apt autoremove
apache2 -v

我已经卸载了,但为什么它显示给我?

更新

which apache2
命令告诉我输出
/usr/sbin/apache2

我尝试从

/usr/sbin/
路径中删除 apache2,它显示了以下输出:

/sbin$ sudo apt remove apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'apache2' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 281 not upgraded.

如果我输入

apache2 -v
,它会显示当前安装的版本:

/sbin$ apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built:   2023-03-08T17:32:54

如果您在上面的屏幕截图之一中看到输出的颜色编码,它会显示绿色的

apache2
颜色。绿色决定可执行文件或识别的数据文件。

这只是一个未安装的可执行文件吗?我说得对吗?

azure ubuntu apache2 azure-virtual-machine putty
1个回答
0
投票

在我的虚拟机中,我有如下 Apache 服务器:

sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-11-28 16:45:09 UTC; 7min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 2955 (apache2)
      Tasks: 55 (limit: 19118)
     Memory: 17.3M
     CGroup: /system.slice/apache2.service
             ├─2955 /usr/sbin/apache2 -k start
             ├─2957 /usr/sbin/apache2 -k start
             └─2958 /usr/sbin/apache2 -k start

Nov 28 16:45:09 vm2 systemd[1]: Starting The Apache HTTP Server...
Nov 28 16:45:09 vm2 systemd[1]: Started The Apache HTTP Server.
imran123@vm2:~$ apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built:   2023-10-26T13:54:09

enter image description here

要删除 Apache,您可以使用以下命令:

sudo systemctl stop apache2
sudo apt-get purge apache2
sudo apt-get autoremove
apache2 -v

输出:

imrxxxx:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libjansson4
  liblua5.2-0 ssl-cert
0 upgraded, 0 newly installed, 10 to remove and 34 not upgraded.
After this operation, 7575 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 59414 files and directories currently installed.)
Removing apache2-bin (2.4.41-4ubuntu3.15) ...
Removing apache2-data (2.4.41-4ubuntu3.15) ...
Removing apache2-utils (2.4.41-4ubuntu3.15) ...
Removing libaprutil1-dbd-sqlite3:amd64 (1.6.1-4ubuntu2.2) ...
Removing libaprutil1-ldap:amd64 (1.6.1-4ubuntu2.2) ...
Removing libaprutil1:amd64 (1.6.1-4ubuntu2.2) ...
Removing libapr1:amd64 (1.6.5-1ubuntu1) ...
Removing libjansson4:amd64 (2.12-1build1) ...
Removing liblua5.2-0:amd64 (5.2.4-1.1build3) ...
Removing ssl-cert (1.0.39) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.12) ...
imran123@vm2:~$ apache2 -v
-bash: /usr/sbin/apache2: No such file or directory

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.