갈루아의 반서재

728x90

아래와 같이 아파치 서비스가 제대로 작동하지 않는 경우 아파치를 삭제하고 재설치하는 방법을 알아보자. 다음의 순서대로 진행하면 된다.

(base) founder@hilbert:/etc/nginx/sites-available$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Fri 2019-10-18 08:21:01 UTC; 45min ago

Oct 18 08:21:01 hilbert systemd[1]: Starting The Apache HTTP Server...
Oct 18 08:21:01 hilbert apachectl[29122]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Oct 18 08:21:01 hilbert apachectl[29122]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 18 08:21:01 hilbert apachectl[29122]: no listening sockets available, shutting down
Oct 18 08:21:01 hilbert apachectl[29122]: AH00015: Unable to open logs
Oct 18 08:21:01 hilbert apachectl[29122]: Action 'start' failed.
Oct 18 08:21:01 hilbert apachectl[29122]: The Apache error log may have more information.
Oct 18 08:21:01 hilbert systemd[1]: apache2.service: Control process exited, code=exited status=1
Oct 18 08:21:01 hilbert systemd[1]: apache2.service: Failed with result 'exit-code'.
Oct 18 08:21:01 hilbert systemd[1]: Failed to start The Apache HTTP Server.
(base) founder@hilbert:/etc/nginx/sites-available$ sudo systemctl reload apache2
apache2.service is not active, cannot reload.

 

sudo /etc/init.d/apache2 stop

(base) founder@hilbert:/etc/nginx/sites-available$ sudo /etc/init.d/apache2 stop
[ ok ] Stopping apache2 (via systemctl): apache2.service.

 

sudo apt-get remove apache2

(base) founder@hilbert:/etc/nginx/sites-available$ sudo apt-get remove apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apache2-data gconf-service gconf-service-backend gconf2-common libdbus-glib-1-2 libegl-mesa0 libegl1 libgbm1 libgconf-2-4 libglapi-mesa
  libglvnd0 libwayland-egl1-mesa libwayland-server0 libxcb-dri2-0 libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxshmfence1
  linux-gcp-headers-4.15.0-1025 linux-gcp-headers-4.15.0-1026 linux-gcp-headers-4.15.0-1029 linux-headers-4.15.0-1029-gcp
  linux-image-4.15.0-1029-gcp linux-modules-4.15.0-1029-gcp
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  apache2
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 535 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 303857 files and directories currently installed.)
Removing apache2 (2.4.29-1ubuntu4.11) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Rules updated for profile 'Apache'
Rules updated for profile 'Nginx HTTP'

 

sudo apt-get purge apache2

(base) founder@hilbert:/etc/nginx/sites-available$ sudo apt-get purge apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apache2-data gconf-service gconf-service-backend gconf2-common libdbus-glib-1-2 libegl-mesa0 libegl1 libgbm1 libgconf-2-4 libglapi-mesa
  libglvnd0 libwayland-egl1-mesa libwayland-server0 libxcb-dri2-0 libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxshmfence1
  linux-gcp-headers-4.15.0-1025 linux-gcp-headers-4.15.0-1026 linux-gcp-headers-4.15.0-1029 linux-headers-4.15.0-1029-gcp
  linux-image-4.15.0-1029-gcp linux-modules-4.15.0-1029-gcp
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  apache2*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 303805 files and directories currently installed.)
Purging configuration files for apache2 (2.4.29-1ubuntu4.11) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.31) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Rules updated for profile 'Nginx HTTP'

 

sudo apt-get autoremove

(base) founder@hilbert:/etc/nginx/sites-available$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  apache2-data gconf-service gconf-service-backend gconf2-common libdbus-glib-1-2 libegl-mesa0 libegl1 libgbm1 libgconf-2-4 libglapi-mesa
  libglvnd0 libwayland-egl1-mesa libwayland-server0 libxcb-dri2-0 libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxshmfence1
  linux-gcp-headers-4.15.0-1025 linux-gcp-headers-4.15.0-1026 linux-gcp-headers-4.15.0-1029 linux-headers-4.15.0-1029-gcp
  linux-image-4.15.0-1029-gcp linux-modules-4.15.0-1029-gcp
0 upgraded, 0 newly installed, 25 to remove and 0 not upgraded.
After this operation, 328 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 303647 files and directories currently installed.)
Removing apache2-data (2.4.29-1ubuntu4.11) ...
Removing libwayland-egl1-mesa:amd64 (19.0.8-0ubuntu0~18.04.3) ...
Removing libegl1:amd64 (1.0.0-2ubuntu2.3) ...
Removing libegl-mesa0:amd64 (19.0.8-0ubuntu0~18.04.3) ...
Removing libgbm1:amd64 (19.0.8-0ubuntu0~18.04.3) ...
Removing libglapi-mesa:amd64 (19.0.8-0ubuntu0~18.04.3) ...
Removing libglvnd0:amd64 (1.0.0-2ubuntu2.3) ...
Removing libwayland-server0:amd64 (1.16.0-1ubuntu1.1~18.04.1) ...
Removing libxcb-dri2-0:amd64 (1.13-2~ubuntu18.04) ...
Removing libxcb-dri3-0:amd64 (1.13-2~ubuntu18.04) ...
Removing libxcb-present0:amd64 (1.13-2~ubuntu18.04) ...
Removing libxcb-sync1:amd64 (1.13-2~ubuntu18.04) ...
Removing libxcb-xfixes0:amd64 (1.13-2~ubuntu18.04) ...
Removing libxshmfence1:amd64 (1.3-1) ...
Removing linux-gcp-headers-4.15.0-1025 (4.15.0-1025.26) ...
Removing linux-gcp-headers-4.15.0-1026 (4.15.0-1026.27) ...
Removing linux-headers-4.15.0-1029-gcp (4.15.0-1029.31) ...
Removing linux-gcp-headers-4.15.0-1029 (4.15.0-1029.31) ...
Removing linux-image-4.15.0-1029-gcp (4.15.0-1029.31) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-1029-gcp
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.0-1020-gcp
Found initrd image: /boot/initrd.img-5.0.0-1020-gcp
Found linux image: /boot/vmlinuz-4.15.0-1032-gcp
Found initrd image: /boot/initrd.img-4.15.0-1032-gcp
Found linux image: /boot/vmlinuz-4.15.0-1028-gcp
Found initrd image: /boot/initrd.img-4.15.0-1028-gcp
Found linux image: /boot/vmlinuz-4.15.0-1027-gcp
Found initrd image: /boot/initrd.img-4.15.0-1027-gcp
Found linux image: /boot/vmlinuz-4.15.0-1021-gcp
Found initrd image: /boot/initrd.img-4.15.0-1021-gcp
done
Removing linux-modules-4.15.0-1029-gcp (4.15.0-1029.31) ...
Removing gconf-service (3.2.6-4ubuntu1) ...
Removing gconf-service-backend (3.2.6-4ubuntu1) ...
Removing libgconf-2-4:amd64 (3.2.6-4ubuntu1) ...
Removing gconf2-common (3.2.6-4ubuntu1) ...
Removing libdbus-glib-1-2:amd64 (0.110-2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

 

sudo apt-get install apache2

(base) founder@hilbert:/etc/nginx/sites-available$ sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  apache2-data
Suggested packages:
  www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-data
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/255 kB of archives.
After this operation, 1425 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package apache2-data.
(Reading database ... 236033 files and directories currently installed.)
Preparing to unpack .../apache2-data_2.4.29-1ubuntu4.11_all.deb ...
Unpacking apache2-data (2.4.29-1ubuntu4.11) ...
Selecting previously unselected package apache2.
Preparing to unpack .../apache2_2.4.29-1ubuntu4.11_amd64.deb ...
Unpacking apache2 (2.4.29-1ubuntu4.11) ...
Setting up apache2-data (2.4.29-1ubuntu4.11) ...
Setting up apache2 (2.4.29-1ubuntu4.11) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling module reqtimeout.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
Processing triggers for systemd (237-3ubuntu10.31) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Rules updated for profile 'Apache'
Rules updated for profile 'Nginx HTTP'
Processing triggers for ureadahead (0.100.0-21) ...

 

sudo systemctl status  apache2

(base) founder@hilbert:/etc/nginx/sites-available$ sudo systemctl status  apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Fri 2019-10-18 10:00:11 UTC; 51s ago
  Process: 5115 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
 Main PID: 4825 (apache2)
    Tasks: 55 (limit: 1997)
   CGroup: /system.slice/apache2.service
           ├─4825 /usr/sbin/apache2 -k start
           ├─5119 /usr/sbin/apache2 -k start
           └─5120 /usr/sbin/apache2 -k start

Oct 18 10:00:11 hilbert systemd[1]: Starting The Apache HTTP Server...
Oct 18 10:00:11 hilbert systemd[1]: Started The Apache HTTP Server.
Oct 18 10:00:55 hilbert systemd[1]: Reloading The Apache HTTP Server.
Oct 18 10:00:55 hilbert systemd[1]: Reloaded The Apache HTTP Server.
728x90