서버 설정 · 7 min read · Sep 11, 2025
완벽한 서버 - Apache, PHP, MySQL, PureFTPD, BIND, Postfix, Dovecot 및 ISPConfig 3.1이 포함된 Ubuntu 18.04 (Bionic Beaver)
이 튜토리얼에서는 Apache 2.4, Postfix, Dovecot, Bind 및 PureFTPD가 포함된 Ubuntu 18.04 (Bionic Beaver) 웹 호스팅 서버의 설치를 보여주며, ISPConfig 3.1 설치를 준비합니다. 결과 시스템은 웹, 메일, 메일링 리스트, DNS 및 FTP 서버를 제공합니다.
ISPConfig는 웹 브라우저를 통해 다음 서비스를 구성할 수 있는 웹 호스팅 제어판입니다: Apache 또는 Nginx 웹 서버, Postfix 메일 서버, Courier 또는 Dovecot IMAP/POP3 서버, MySQL, BIND 또는 MyDNS 네임서버, PureFTPd, SpamAssassin, ClamAV 등. 이 설정은 Apache(대신 Nginx), BIND(대신 MyDNS) 및 Dovecot(대신 Courier)의 설치를 포함합니다.
1. 사전 참고
이 튜토리얼에서는 호스트 이름 server1.example.com과 IP 주소 192.168.1.100 및 게이트웨이 192.168.1.1을 사용합니다. 이러한 설정은 귀하의 환경에 따라 다를 수 있으므로 적절한 곳에서 교체해야 합니다. 진행하기 전에 튜토리얼에 설명된 대로 Ubuntu 18.04의 기본 최소 설치가 필요합니다.
이 튜토리얼의 명령은 루트 권한으로 실행해야 합니다. 각 명령 앞에 sudo를 추가하지 않으려면 다음을 실행하여 루트 사용자로 전환해야 합니다:
sudo -s진행하기 전에 이 명령을 실행하세요.
2. /etc/apt/sources.list 편집 및 Linux 설치 업데이트
/etc/apt/sources.list를 편집합니다. 파일에서 설치 CD를 주석 처리하거나 제거하고 universe 및 multiverse 리포지토리가 활성화되어 있는지 확인합니다. 이후에는 다음과 같이 보여야 합니다:
nano /etc/apt/sources.list#
# deb cdrom:[Ubuntu-Server 18.04 LTS _Bionic Beaver_ - Release amd64 (20180425.1)]/ bionic main restricted
#deb cdrom:[Ubuntu-Server 18.04 LTS _Bionic Beaver_ - Release amd64 (20180425.1)]/ bionic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://de.archive.ubuntu.com/ubuntu/ bionic main restricted
## 최종 릴리스 이후에 생성된 주요 버그 수정 업데이트.
deb http://de.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## N.B. 이 리포지토리의 소프트웨어는 Ubuntu 팀에 의해 전적으로 지원되지 않습니다.
## 또한, universe의 소프트웨어는 Ubuntu 보안 팀의 검토나 업데이트를 받지 않습니다.
deb http://de.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://de.archive.ubuntu.com/ubuntu/ bionic universe
deb http://de.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-updates universe
## N.B. 이 리포지토리의 소프트웨어는 Ubuntu 팀에 의해 전적으로 지원되지 않으며, 무료 라이센스 하에 있지 않을 수 있습니다.
## 소프트웨어 사용 권리에 대해 스스로 만족해야 합니다.
## 또한, multiverse의 소프트웨어는 Ubuntu 보안 팀의 검토나 업데이트를 받지 않습니다.
deb http://de.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://de.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
## N.B. 이 리포지토리의 소프트웨어는 기본 릴리스에 포함된 소프트웨어만큼 광범위하게 테스트되지 않았을 수 있으며,
## 유용한 기능을 제공할 수 있는 일부 응용 프로그램의 최신 버전을 포함합니다.
## 또한, backports의 소프트웨어는 Ubuntu 보안 팀의 검토나 업데이트를 받지 않습니다.
deb http://de.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
## Canonical의 'partner' 리포지토리에서 소프트웨어를 추가하려면 다음 두 줄의 주석을 제거하세요.
## 이 소프트웨어는 Ubuntu의 일부가 아니지만, Canonical과 해당 공급업체가 Ubuntu 사용자에게 제공하는 서비스입니다.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse그런 다음 다음을 실행합니다:
apt-get updateapt 패키지 데이터베이스를 업데이트하고
apt-get upgrade최신 업데이트를 설치합니다(있는 경우). 업데이트의 일환으로 새로운 커널이 설치되는 경우, 그 후 시스템을 재부팅해야 합니다:
reboot3. 기본 셸 변경
/bin/sh는 /bin/dash에 대한 심볼릭 링크이지만, 우리는 /bin/dash가 아닌 /bin/bash가 필요합니다. 따라서 다음과 같이 합니다:
dpkg-reconfigure dashUse dash as the default system shell (/bin/sh)? <– 아니요
이 작업을 수행하지 않으면 ISPConfig 설치가 실패합니다.
4. AppArmor 비활성화
AppArmor는 확장된 보안을 제공해야 하는 보안 확장(SELinux와 유사)입니다. 제 생각에는 보안 시스템을 구성하는 데 필요하지 않으며, 일반적으로 장점보다 더 많은 문제를 일으킵니다(어떤 서비스가 예상대로 작동하지 않아 일주일 동안 문제를 해결한 후, 모든 것이 정상이라는 것을 발견하고 AppArmor가 문제를 일으켰다는 것을 알게 되는 경우를 생각해 보세요). 따라서 이를 비활성화합니다(나중에 ISPConfig를 설치하려면 필수입니다).
다음과 같이 비활성화할 수 있습니다:
service apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils5. 시스템 시계 동기화
물리적 서버를 실행할 때 NTP (network time protocol) 서버와 시스템 시계를 동기화하는 것이 좋습니다. 가상 서버를 실행하는 경우 이 단계를 건너뛰어야 합니다. 다음을 실행하세요:
apt-get -y install ntp그러면 시스템 시간이 항상 동기화됩니다.
6. Postfix, Dovecot, MariaDB, rkhunter 및 binutils 설치
Postfix를 설치하려면 sendmail이 설치되어 있지 않고 실행되고 있지 않아야 합니다. sendmail을 중지하고 제거하려면 다음 명령을 실행합니다:
service sendmail stop; update-rc.d -f sendmail remove오류 메시지:
Failed to stop sendmail.service: Unit sendmail.service not loaded.정상입니다. 이는 sendmail이 설치되지 않았음을 의미하므로 제거할 것이 없습니다.
이제 Postfix, Dovecot, MariaDB( MySQL 대체), rkhunter 및 binutils를 단일 명령으로 설치할 수 있습니다:
apt-get -y 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다음 질문이 표시됩니다:
General type of mail configuration: <-- Internet Site
System mail name: <-- server1.example.com“system mail name”으로 server1.example.com 또는 server1.yourdomain.com과 같은 하위 도메인을 사용하는 것이 중요하며, 나중에 이메일 도메인으로 사용할 도메인(예: yourdomain.tld)은 사용하지 않아야 합니다.
다음으로 Postfix에서 TLS/SSL 및 제출 포트를 엽니다:
nano /etc/postfix/master.cf제출 및 smtps 섹션의 주석을 제거하고 다음과 같이 -o smtpd_client_restrictions=permit_sasl_authenticated,reject 라인을 추가하고 그 이후의 모든 것은 주석 처리된 상태로 둡니다:
[...]
submission inet n - y - - 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=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
smtps inet n - y - - 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=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
[...] 참고: “-o …. “ 줄 앞의 공백은 중요합니다!
그 후 Postfix를 재시작합니다:
service postfix restartMySQL이 localhost뿐만 아니라 모든 인터페이스에서 수신 대기하도록 하려면 /etc/mysql/mariadb.conf.d/50-server.cnf를 편집하고 bind-address = 127.0.0.1 줄의 주석을 제거합니다:
nano /etc/mysql/mariadb.conf.d/50-server.cnf[...]
# skip-networking 대신 기본값은 이제
# localhost에서만 수신 대기하는 것입니다.
# 이는 더 호환성이 있으며 덜 안전하지 않습니다.
#bind-address = 127.0.0.1
[...] 이제 MariaDB에서 루트 비밀번호를 설정합니다. 다음을 실행합니다:
mysql_secure_installation다음 질문이 표시됩니다:
Enter current password for root (enter for none): <-- Enter 키를 누르세요
Set root password? [Y/n] <-- y
New password: <-- 새로운 MariaDB 루트 비밀번호를 입력하세요
Re-enter new password: <-- 비밀번호를 반복 입력하세요
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- yMariaDB에서 비밀번호 인증 방법을 네이티브로 설정하여 나중에 PHPMyAdmin을 통해 루트 사용자로 연결할 수 있도록 합니다:
echo "update mysql.user set plugin = 'mysql_native_password' where user='root';" | mysql -u root파일 /etc/mysql/debian.cnf를 편집하고 MYSQL / MariaDB 루트 비밀번호를 두 번 입력합니다.
nano /etc/mysql/debian.cnf추가해야 할 MySQL 루트 비밀번호는 읽기 전용으로 표시되며, 이 예제에서는 비밀번호가 “howtoforge”입니다. “howtoforge”라는 단어를 mysql_secure_installation 명령으로 설정한 MySQL 루트 사용자 비밀번호로 교체하세요.
# Debian 스크립트용으로 자동 생성되었습니다. 수정하지 마세요!
[client]
host = localhost
user = root
password = howtoforge
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password = howtoforge
socket = /var/run/mysqld/mysqld.sock
basedir = /usr그런 다음 MariaDB를 재시작합니다:
service mysql restart이제 네트워킹이 활성화되었는지 확인합니다. 다음을 실행합니다:
netstat -tap | grep mysql출력은 다음과 같아야 합니다:
root@server1:~# netstat -tap | grep mysql
tcp6 0 0 [::]:mysql [::]:* LISTEN 30591/mysqld
root@server1:~#7. Amavisd-new, SpamAssassin 및 Clamav 설치
amavisd-new, SpamAssassin 및 ClamAV를 설치하려면 다음을 실행합니다:
apt-get -y install amavisd-new spamassassin clamav clamav-daemon 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 libdbd-mysql-perl postgreyISPConfig 3 설정은 내부적으로 SpamAssassin 필터 라이브러리를 로드하는 amavisd를 사용하므로, RAM을 확보하기 위해 SpamAssassin을 중지할 수 있습니다:
service spamassassin stop
update-rc.d -f spamassassin removeClamAV를 시작하려면:
freshclam
service clamav-daemon start첫 번째 freshclam 실행 시 다음 오류는 무시할 수 있습니다.
ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).amavisd-new 프로그램은 현재 Ubuntu 18.04에서 Dkim으로 이메일이 올바르게 서명되지 않도록 방지하는 버그가 있습니다. amavisd-new을 패치하려면 다음 명령을 실행합니다.
cd /tmp
wget https://git.ispconfig.org/ispconfig/ispconfig3/raw/stable-3.1/helper_scripts/ubuntu-amavisd-new-2.11.patch
cd /usr/sbin
cp -pf amavisd-new amavisd-new_bak
patch < /tmp/ubuntu-amavisd-new-2.11.patch마지막 ‘patch’ 명령에서 오류가 발생하면, Ubuntu가 그 사이에 문제를 수정했을 가능성이 있으므로 해당 오류는 무시해도 안전합니다.
7.1 Metronome XMPP 서버 설치 (선택 사항)
Metronome XMPP 서버는 XMPP 채팅 서버를 제공합니다. 이 단계는 선택 사항이며, 채팅 서버가 필요하지 않은 경우 이 단계를 건너뛸 수 있습니다. 다른 ISPConfig 기능은 이 소프트웨어에 의존하지 않습니다.
다음 패키지를 apt로 설치합니다.
apt-get -y 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 luarocksluarocks install lpcMetronome용 셸 사용자를 추가합니다.
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에 설치되었습니다.
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.