서버 설정 · 5 min read · Oct 29, 2025

완벽한 서버 - Debian 8.6 (nginx, BIND, Dovecot, ISPConfig 3.1)

이 튜토리얼은 ISPConfig 3.1 설치를 위해 Debian Jessie 서버(nginx, BIND, Dovecot 포함)를 준비하는 방법과 ISPConfig 3.1을 설치하는 방법을 보여줍니다. ISPConfig 3는 웹 브라우저를 통해 다음 서비스를 구성할 수 있는 웹 호스팅 제어판입니다: Apache 또는 nginx 웹 서버, Postfix 메일 서버, Courier 또는 Dovecot IMAP/POP3 서버, MySQL, BIND 또는 MyDNS 네임서버, PureFTPd, SpamAssassin, ClamAV 등. 이 설정은 nginx(대신 Apache), BIND를 DNS 서버로, Dovecot을 IMAP / POP3 서버로 포함합니다.

1 사전 참고

이 튜토리얼에서는 호스트 이름 server1.example.com과 IP 주소 192.168.1.100 및 게이트웨이 192.168.1.1을 사용합니다. 이러한 설정은 귀하의 경우 다를 수 있으므로 적절한 곳에서 교체해야 합니다. 계속 진행하기 전에 Debian 8의 최소 설치가 필요합니다. 이는 호스팅 제공업체의 Debian 최소 이미지일 수 있으며, 또는 Minimal Debian Server 튜토리얼을 사용하여 기본 시스템을 설정할 수 있습니다.

2 SSH 서버 설치

시스템 설치 중 OpenSSH 서버를 설치하지 않았다면 지금 설치할 수 있습니다:

apt-get -y install ssh openssh-server

이제부터는 PuTTY와 같은 SSH 클라이언트를 사용하여 작업 스테이션에서 Debian 8 서버에 연결하고 이 튜토리얼의 나머지 단계를 따를 수 있습니다.

3 셸 텍스트 편집기 설치 (선택 사항)

이 튜토리얼에서는 nano 텍스트 편집기를 사용할 것입니다. 일부 사용자는 고전적인 vi 편집기를 선호하므로 두 편집기를 모두 설치하겠습니다. 기본 vi 프로그램은 Debian 및 Ubuntu에서 이상한 동작을 하므로 이를 수정하기 위해 vim-nox를 설치합니다:

apt-get -y install nano vim-nox

(다른 텍스트 편집기(예: joe)를 사용하는 경우 이 작업을 수행할 필요는 없습니다.)

4 호스트 이름 구성

서버의 호스트 이름은 “server1.example.com”과 같은 서브도메인이어야 합니다. “example.com”과 같은 서브도메인 부분이 없는 도메인 이름을 호스트 이름으로 사용하지 마십시오. 이는 나중에 메일 설정에 문제를 일으킬 수 있습니다. 먼저 /etc/hosts에서 호스트 이름을 확인하고 필요할 경우 변경해야 합니다. 줄은 다음과 같아야 합니다: “IP 주소 - 공백 - 전체 호스트 이름 포함 도메인 - 공백 - 서브도메인 부분”. /etc/hosts를 편집합니다. 다음과 같이 보이도록 만드십시오:

nano /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.1.100   server1.example.com     server1

# 다음 줄은 IPv6 지원 호스트에 바람직합니다
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

그런 다음 /etc/hostname 파일을 편집합니다:

nano /etc/hostname

여기에는 서브도메인 부분만 포함되어야 하며, 우리의 경우:

server1

마지막으로 변경 사항을 적용하기 위해 서버를 재부팅합니다:

reboot

다시 로그인하고 다음 명령어로 호스트 이름이 올바른지 확인합니다:

hostname  
hostname -f

출력은 다음과 같아야 합니다:

root@server1:/tmp# hostname  
server1  
root@server1:/tmp# hostname -f  
server1.example.com

5 Debian 설치 업데이트

먼저 /etc/apt/sources.list에 wheezy-updates 리포지토리가 포함되어 있는지 확인하십시오(이는 ClamAV 바이러스 스캐너의 최신 업데이트를 항상 받을 수 있도록 보장합니다 - 이 프로젝트는 매우 자주 릴리스를 게시하며, 때때로 이전 버전이 작동을 멈추기도 합니다), 그리고 contrib 및 non-free 리포지토리가 활성화되어 있는지 확인하십시오(일부 패키지(예: libapache2-mod-fastcgi)는 기본 리포지토리에 없습니다).

nano /etc/apt/sources.list
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free  
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free  
  
deb http://security.debian.org/ jessie/updates main contrib non-free  
deb-src http://security.debian.org/ jessie/updates main contrib non-free  
  
# Debian backports - Letsencrypt에 필요  
deb http://ftp.debian.org/debian jessie-backports main

중요: 위와 같이 Debian Backports 리포지토리를 추가하십시오.

다음 명령어를 실행하여

apt-get update

apt 패키지 데이터베이스를 업데이트하고

apt-get upgrade

최신 업데이트를 설치합니다(있는 경우).

6 기본 셸 변경

/bin/sh는 /bin/dash에 대한 심볼릭 링크이지만, 우리는 /bin/bash가 필요합니다. 따라서 다음과 같이 합니다:

dpkg-reconfigure dash

기본 시스템 셸로 dash를 사용합니까? <– 아니요

이 작업을 수행하지 않으면 ISPConfig 설치가 실패합니다.

7 시스템 시계 동기화

인터넷을 통해 NTP (network time protocol) 서버와 시스템 시계를 동기화하는 것이 좋습니다. 다음 명령어를 실행하십시오:

apt-get install ntp

그러면 시스템 시간이 항상 동기화됩니다.

8 Postfix, Dovecot, MySQL, rkhunter, binutils 설치

Postfix, Dovecot, MySQL, rkhunter 및 Binutils를 단일 명령어로 설치할 수 있습니다:

apt-get install postfix postfix-mysql postfix-doc mariadb-client mariadb-server openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd sudo

다음 질문이 표시됩니다:

일반 메일 구성 유형: <– 인터넷 사이트
시스템 메일 이름: <– server1.example.com
MariaDB “root” 사용자에 대한 새 비밀번호: <– yourrootsqlpassword
MariaDB “root” 사용자에 대한 비밀번호 반복: <– yourrootsqlpassword

MariaDB / MySQL 설치를 보안하고 테스트 데이터베이스를 비활성화하려면 다음 명령어를 실행하십시오:

mysql_secure_installation

우리는 설치 중에 새 비밀번호를 설정했으므로 MySQL 루트 비밀번호를 변경할 필요가 없습니다. 질문에 다음과 같이 답하십시오:

루트 비밀번호를 변경하시겠습니까? [Y/n] <-- n  
익명 사용자 제거? [Y/n] <-- y  
원격에서 루트 로그인 금지? [Y/n] <-- y  
테스트 데이터베이스 및 접근 제거? [Y/n] <-- y  
권한 테이블을 지금 다시 로드하시겠습니까? [Y/n] <-- y

다음으로 Postfix에서 TLS/SSL 및 제출 포트를 엽니다:

nano /etc/postfix/master.cf

제출 및 smtps 섹션의 주석을 제거합니다(우리는 필요하지 않으므로 -o milter_macro_daemon_name=ORIGINATING는 그대로 두십시오):

[...]
submission inet n - - - - smtpd  
 -o syslog_name=postfix/submission  
 -o smtpd_tls_security_level=encrypt  
 -o smtpd_sasl_auth_enable=yes  
 -o smtpd_client_restrictions=permit_sasl_authenticated,reject  
# -o smtpd_reject_unlisted_recipient=no  
# -o smtpd_client_restrictions=$mua_client_restrictions  
# -o smtpd_helo_restrictions=$mua_helo_restrictions  
# -o smtpd_sender_restrictions=$mua_sender_restrictions  
# -o smtpd_recipient_restrictions=  
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject  
# -o milter_macro_daemon_name=ORIGINATING  
smtps inet n - - - - smtpd  
 -o syslog_name=postfix/smtps  
 -o smtpd_tls_wrappermode=yes  
 -o smtpd_sasl_auth_enable=yes  
 -o smtpd_client_restrictions=permit_sasl_authenticated,reject  
# -o smtpd_reject_unlisted_recipient=no  
# -o smtpd_client_restrictions=$mua_client_restrictions  
# -o smtpd_helo_restrictions=$mua_helo_restrictions  
# -o smtpd_sender_restrictions=$mua_sender_restrictions  
# -o smtpd_recipient_restrictions=  
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject  
# -o milter_macro_daemon_name=ORIGINATING
[...]

그 후 Postfix를 재시작합니다:

service postfix restart

MySQL이 localhost뿐만 아니라 모든 인터페이스에서 수신 대기하도록 하려면 /etc/mysql/my.cnf를 편집하고 bind-address = 127.0.0.1 줄의 주석을 제거합니다:

nano /etc/mysql/my.cnf
[...]
# skip-networking 대신 기본값은 이제 localhost에서만 수신 대기하는 것입니다.
#bind-address           = 127.0.0.1
[...]

그런 다음 MySQL을 재시작합니다:

service mysql restart

이제 네트워킹이 활성화되었는지 확인합니다. 다음 명령어를 실행하십시오:

netstat -tap | grep mysql

출력은 다음과 같아야 합니다:

root@server1:~# netstat -tap | grep mysql  
tcp        0      0 *:mysql                 *:*                     LISTEN      218123/mysqld  
root@server1:~#

9 Amavisd-new, SpamAssassin 및 Clamav 설치

amavisd-new, SpamAssassin 및 ClamAV를 설치하려면 다음 명령어를 실행합니다:

apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl postgrey

ISPConfig 3 설정은 내부적으로 SpamAssassin 필터 라이브러리를 로드하는 amavisd를 사용하므로 RAM을 확보하기 위해 SpamAssassin을 중지할 수 있습니다:

service spamassassin stop  
systemctl disable spamassassin

9.1 Metronome XMPP 서버 설치 (선택 사항)

이 단계는 XMPP 프로토콜과 호환되는 채팅 서버를 제공하는 Metronome XMPP 서버를 설치합니다. 이 단계는 선택 사항이며, 채팅 서버가 필요하지 않다면 이 단계를 건너뛸 수 있습니다. 다른 ISPConfig 기능은 이 소프트웨어에 의존하지 않습니다.

Debian에 Prosody 패키지 리포지토리를 추가합니다.

echo "deb http://packages.prosody.im/debian jessie main" > /etc/apt/sources.list.d/metronome.list  
wget http://prosody.im/files/prosody-debian-packages.key -O - | sudo apt-key add -

패키지 목록을 업데이트합니다:

apt-get update

빌드 프로세스에 필요한 프로그램을 설치합니다:

apt-get install build-essential

그리고 apt로 패키지를 설치합니다.

apt-get install git lua5.1 liblua5.1-0-dev lua-filesystem libidn11-dev libssl-dev lua-zlib lua-expat lua-event lua-bitop lua-socket lua-sec luarocks luarocks
luarocks install lpc

Metronome을 위한 셸 사용자를 추가합니다.

adduser --no-create-home --disabled-login --gecos 'Metronome' metronome

/opt 디렉토리에 Metronome을 다운로드하고 컴파일합니다.

cd /opt; git clone https://github.com/maranda/metronome.git metronome  
cd ./metronome; ./configure --ostype=debian --prefix=/usr  
make  
make install

이제 Metronome이 /opt/metronome에 설치되었습니다.

Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.