서버 설정 · 6 min read · Oct 05, 2025
완벽한 서버 - Debian Lenny (Debian 5.0) [ISPConfig 2] - 페이지 4
11 MySQL
MySQL을 설치하기 위해 다음 명령어를 실행합니다.
apt-get install mysql-server mysql-client libmysqlclient15-devMySQL root 사용자에 대한 비밀번호를 입력하라는 메시지가 표시됩니다. 이 비밀번호는 root@localhost 사용자와 [email protected] 모두에 유효하므로, 나중에 MySQL root 비밀번호를 수동으로 지정할 필요가 없습니다:
MySQL “root” 사용자에 대한 새 비밀번호: <– yourrootsqlpassword
MySQL “root” 사용자에 대한 비밀번호 반복: <– yourrootsqlpassword
MySQL이 localhost뿐만 아니라 모든 인터페이스에서 수신 대기하도록 하려면 /etc/mysql/my.cnf를 편집하고 bind-address = 127.0.0.1 줄의 주석을 제거합니다:
vi /etc/mysql/my.cnf| [...] # skip-networking 대신 기본값은 이제 localhost에서만 수신 대기하는 것입니다. # 이는 더 호환성이 높고 덜 안전하지 않습니다. #bind-address = 127.0.0.1 [...] |
그런 다음 MySQL을 재시작합니다:
/etc/init.d/mysql restart이제 네트워킹이 활성화되었는지 확인합니다. 다음 명령어를 실행합니다:
netstat -tap | grep mysql출력은 다음과 같아야 합니다:
server1:~# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 6612/mysqld
server1:~#12 Postfix With SMTP-AUTH And TLS
SMTP-AUTH 및 TLS와 함께 Postfix를 설치하려면 다음 단계를 수행합니다:
apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules procmail두 가지 질문이 표시됩니다. 다음과 같이 답변합니다:
일반 메일 구성 유형: <– 인터넷 사이트
시스템 메일 이름: <– server1.example.com
그런 다음 다음 명령어를 실행합니다:
dpkg-reconfigure postfix다시 몇 가지 질문이 표시됩니다:
일반 메일 구성 유형: <– 인터넷 사이트
시스템 메일 이름: <– server1.example.com
루트 및 포스트마스터 메일 수신자: <– [빈칸]
메일을 수신할 다른 목적지 (없으면 빈칸): <– server1.example.com, localhost.example.com, localhost.localdomain, localhost
메일 큐에서 동기식 업데이트 강제 적용? <– 아니오
로컬 네트워크: <– 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
로컬 배달에 procmail 사용? <– 예
메일박스 크기 제한 (바이트): <– 0
로컬 주소 확장 문자: <– +
사용할 인터넷 프로토콜: <– 모두
다음으로, 다음을 수행합니다:
postconf -e 'smtpd_sasl_local_domain ='
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'broken_sasl_auth_clients = yes'
postconf -e 'smtpd_sasl_authenticated_header = yes'
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
postconf -e 'inet_interfaces = all'
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf그런 다음 TLS용 인증서를 생성합니다:
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csropenssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crtopenssl rsa -in smtpd.key -out smtpd.key.unencryptedmv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650다음으로 Postfix를 TLS에 맞게 구성합니다 (myhostname에 대해 올바른 호스트 이름을 사용해야 합니다):
postconf -e 'myhostname = server1.example.com'postconf -e 'smtpd_tls_auth_only = no'
postconf -e 'smtp_use_tls = yes'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtp_tls_note_starttls_offer = yes'
postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_tls_received_header = yes'
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
postconf -e 'tls_random_source = dev:/dev/urandom'이제 /etc/postfix/main.cf 파일은 다음과 같아야 합니다:
cat /etc/postfix/main.cf| # /usr/share/postfix/main.cf.dist에서 주석이 달린 더 완전한 버전을 참조하십시오. # Debian 특정: 파일 이름을 지정하면 해당 파일의 첫 번째 줄이 이름으로 사용됩니다. Debian 기본값은 /etc/mailname입니다. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no # .domain을 추가하는 것은 MUA의 작업입니다. append_dot_mydomain = no # 다음 줄의 주석을 제거하여 "지연된 메일" 경고를 생성합니다. #delay_warning_time = 4h readme_directory = no # TLS 매개변수 smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key smtpd_use_tls = yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache # SMTP 클라이언트에서 SSL을 활성화하는 방법에 대한 정보는 postfix-doc 패키지의 /usr/share/doc/postfix/TLS_README.gz를 참조하십시오. myhostname = server1.example.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = server1.example.com, localhost.example.com, localhost.localdomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_command = procmail -a "$EXTENSION" mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all smtpd_sasl_local_domain = smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_sasl_authenticated_header = yes smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination smtpd_tls_auth_only = no smtp_use_tls = yes smtp_tls_note_starttls_offer = yes smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom |
인증은 saslauthd에 의해 수행됩니다. 제대로 작동하도록 몇 가지를 변경해야 합니다. Postfix가 /var/spool/postfix에서 chrooted로 실행되기 때문에 다음을 수행해야 합니다:
mkdir -p /var/spool/postfix/var/run/saslauthd이제 /etc/default/saslauthd를 편집하여 saslauthd를 활성화해야 합니다. START를 yes로 설정하고 OPTIONS=”-c -m /var/run/saslauthd” 줄을 OPTIONS=”-c -m /var/spool/postfix/var/run/saslauthd -r”로 변경합니다:
vi /etc/default/saslauthd| # # saslauthd 데몬에 대한 설정 # 자세한 내용은 /usr/share/doc/sasl2-bin/README.Debian을 참조하십시오. # # saslauthd가 자동으로 시작할까요? (기본값: 아니오) START=yes # 이 saslauthd 인스턴스에 대한 설명. 권장됨. # (제안: SASL 인증 데몬) DESC="SASL Authentication Daemon" # 이 saslauthd 인스턴스의 짧은 이름. 강력히 권장됨. # (제안: saslauthd) NAME="saslauthd" # saslauthd가 사용할 인증 메커니즘은 무엇인가요? (기본값: pam) # # 이 Debian 패키지에서 사용 가능한 옵션: # getpwent -- getpwent() 라이브러리 함수 사용 # kerberos5 -- Kerberos 5 사용 # pam -- PAM 사용 # rimap -- 원격 IMAP 서버 사용 # shadow -- 로컬 shadow 비밀번호 파일 사용 # sasldb -- 로컬 sasldb 데이터베이스 파일 사용 # ldap -- LDAP 사용 (구성은 /etc/saslauthd.conf에 있음) # # 한 번에 하나의 옵션만 사용할 수 있습니다. 자세한 내용은 saslauthd 매뉴얼 페이지를 참조하십시오. # # 예: MECHANISMS="pam" MECHANISMS="pam" # 이 메커니즘에 대한 추가 옵션. (기본값: 없음) # 이 메커니즘에 대한 옵션에 대한 정보는 saslauthd 매뉴얼 페이지를 참조하십시오. MECH_OPTIONS="" # 몇 개의 saslauthd 프로세스를 실행해야 하나요? (기본값: 5) # 0 값은 각 연결에 대해 새 프로세스를 포크합니다. THREADS=5 # 기타 옵션 (기본값: -c -m /var/run/saslauthd) # 주의: -m 옵션을 반드시 지정해야 합니다. 그렇지 않으면 saslauthd가 실행되지 않습니다! # # 경고: -d 옵션을 지정하지 마십시오. # -d 옵션은 saslauthd가 데몬이 아닌 포그라운드에서 실행되게 합니다. 이는 시스템이 제대로 부팅되지 않게 합니다. 디버그 모드로 saslauthd를 실행하려면 안전하게 수동으로 실행하십시오. # # Debian 특정 정보는 /usr/share/doc/sasl2-bin/README.Debian을 참조하십시오. # saslauthd 매뉴얼 페이지 및 'saslauthd -h'의 출력을 참조하여 이러한 옵션에 대한 일반 정보를 확인하십시오. # # Postfix 사용자를 위한 예: "-c -m /var/spool/postfix/var/run/saslauthd" #OPTIONS="-c -m /var/run/saslauthd" OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r" |
다음으로 postfix 사용자를 sasl 그룹에 추가합니다 (이렇게 하면 Postfix가 saslauthd에 접근할 수 있는 권한을 갖게 됩니다):
adduser postfix sasl이제 Postfix를 재시작하고 saslauthd를 시작합니다:
/etc/init.d/postfix restart
/etc/init.d/saslauthd startSMTP-AUTH 및 TLS가 제대로 작동하는지 확인하려면 다음 명령어를 실행합니다:
telnet localhost 25Postfix 메일 서버에 연결한 후 다음을 입력합니다:
ehlo localhost다음과 같은 줄이 표시되면
250-STARTTLS및
250-AUTH LOGIN PLAIN모든 것이 정상입니다.
내 시스템의 출력은 다음과 같습니다:
server1:/etc/postfix/ssl# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (Debian/GNU)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
server1:/etc/postfix/ssl#quit를 입력하여 시스템의 셸로 돌아갑니다.
13 Courier-IMAP/Courier-POP3
다음 명령어를 실행하여 Courier-IMAP/Courier-IMAP-SSL (IMAPs 포트 993용) 및 Courier-POP3/Courier-POP3-SSL (POP3s 포트 995용)을 설치합니다:
apt-get install courier-authdaemon courier-base courier-imap courier-imap-ssl courier-pop courier-pop-ssl courier-ssl gamin libgamin0 libglib2.0-0두 가지 질문이 표시됩니다:
웹 기반 관리용 디렉토리 생성? <– 아니오
SSL 인증서 필요 <– 확인
설치 중에 IMAP-SSL 및 POP3-SSL에 대한 SSL 인증서가 localhost라는 호스트 이름으로 생성됩니다. 이를 올바른 호스트 이름 (이 튜토리얼에서는 server1.example.com)으로 변경하려면 인증서를 삭제합니다…
cd /etc/courier
rm -f /etc/courier/imapd.pem
rm -f /etc/courier/pop3d.pem… 그리고 다음 두 파일을 수정합니다. CN=localhost를 CN=server1.example.com으로 교체합니다 (필요한 경우 다른 값을 수정할 수도 있습니다):
vi /etc/courier/imapd.cnf| [...] CN=server1.example.com [...] |
vi /etc/courier/pop3d.cnf| [...] CN=server1.example.com [...] |
그런 다음 인증서를 다시 생성합니다…
mkimapdcert
mkpop3dcert… 그리고 Courier-IMAP-SSL 및 Courier-POP3-SSL을 재시작합니다:
/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop-ssl restartISPConfig를 사용하지 않으려면 Postfix를 사용자의 Maildir*에 이메일을 전달하도록 구성합니다:
postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
/etc/init.d/postfix restart*참고: ISPConfig를 사용할 계획이라면 이 작업을 수행할 필요가 없습니다. ISPConfig가 procmail 레시피를 사용하여 필요한 구성을 수행합니다. 그러나 ISPConfig 웹 인터페이스의 관리 -> 서버 -> 설정 -> 이메일에서 Maildir을 활성화해야 합니다.
새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.