#WITHYOU
Lum7671's Weblog
#WITHYOU
Ubuntu Note

Ubuntu 에서 기억하고 싶은 내용

UFW (Uncomplicated Firewall)

1. 링크

init.d, update-rc.d

배경 :

  • nginx를 사용해서 Apache2가 뜨지 않도록 함.
  • pagespeed 를 사용하기 위해서 Apache2가 설치 돼있어야 함.

1. runlevel 확인

% runlevel
N 5
  • N : 이전 runlevel
  • 5 : 현재 runlevel

2. apache2 데몬 띄우지 않기

2.1 “KXX…” symbolic link 만들기.

% ls -ald /etc/rc5.d/K01apache2
lrwxrwxrwx 1 root root 17  8월 20  2016 /etc/rc5.d/K01apache2 -> ../init.d/apache2

2.2 수정 내용 시스템에 적용하기.

% sudo update-rc.d apache2 defaults

2.3 혹은, daemon disable

% sudo update-rc.d apache2 disable
[sudo] password for x:
update-rc.d: error: apache2 Default-Start contains no runlevels,
aborting.
% sudo update-rc.d apache2 remove

3. 수정 내용 확인

% head /etc/init.d/apache2
#!/bin/sh
### BEGIN INIT INFO
# Provides:          apache2
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:
# Default-Stop:      0 1 2 3 4 5 6
# X-Interactive:     true
# Short-Description: Apache2 web server
# Description:       Start the web server
  • Default-Stop 에 runlevel 5가 포함 되있는 것을 볼 수 있다.

4. 참고

% sudo systemctl disable apache2
apache2.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable apache2
update-rc.d: error: apache2 Default-Start contains no runlevels,
aborting.
  • /lib/systemd/systemd-sysv-install
% sudo /lib/systemd/systemd-sysv-install disable apache2
update-rc.d: error: apache2 Default-Start contains no runlevels, aborting.