Ubuntu Note

Posted on 2018-10-18(목) in ubuntu

기본 editor 를 vim 으로 설정

% sudo update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode
%

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.