서버 설정 · 4 min read · Jan 09, 2026
완벽한 서버 - Mandriva 2008 스프링 무료 (Mandriva 2008.1) - 페이지 5
10 MySQL (5.0)
MySQL 5.0을 설치하려면, 다음과 같이 실행합니다:
urpmi MySQL MySQL-client libmysql15-devel기본적으로 Mandriva 2008.1의 MySQL 패키지에서는 네트워킹이 활성화되어 있지 않지만, ISPConfig에서는 네트워킹이 필요합니다. /etc/my.cnf에서 skip-networking 줄의 주석을 제거하여 이를 변경할 수 있습니다. 또한 default-character-set을 utf8에서 latin1으로 변경합니다:
vi /etc/my.cnf| [...] # TCP/IP 포트를 전혀 듣지 않습니다. 이는 보안 향상이 될 수 있습니다, # mysqld에 연결해야 하는 모든 프로세스가 동일한 호스트에서 실행되는 경우. # mysqld와의 모든 상호작용은 Unix 소켓 또는 명명된 파이프를 통해 이루어져야 합니다. # Windows에서 명명된 파이프를 활성화하지 않고 이 옵션을 사용하면 # ("enable-named-pipe" 옵션을 통해) mysqld가 쓸모없게 됩니다! # #skip-networking [...] default-character-set = latin1 [...] |
그 후, MySQL의 시스템 시작 링크를 생성합니다…
chkconfig mysqld on… 그리고 시작합니다:
/etc/init.d/mysqld start이제 네트워킹이 활성화되었는지 확인합니다. 다음을 실행합니다:
netstat -tap | grep mysql출력은 다음과 같아야 합니다:
[root@server1 var]# netstat -tap | grep mysql
tcp 0 0 *:mysql-im *:* LISTEN 3863/mysqlmanager
tcp 0 0 *:mysql *:* LISTEN 3871/mysqld
[root@server1 var]#다음으로, 다음을 실행하여
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword사용자 root의 비밀번호를 설정합니다 (그렇지 않으면 누구나 MySQL 데이터베이스에 접근할 수 있습니다!).
11 Postfix With SMTP-AUTH And TLS; Dovecot
필요한 패키지(Postfix, cyrus-sasl, Dovecot 등)를 다음과 같이 설치합니다:
urpmi cyrus-sasl libsasl2 libsasl2-devel libsasl2-plug-plain libsasl2-plug-anonymous libsasl2-plug-crammd5 libsasl2-plug-digestmd5 libsasl2-plug-gssapi libsasl2-plug-login postfix dovecot그런 다음 다음을 실행합니다:
postconf -e 'mydestination = /etc/postfix/local-host-names, localhost.$mydomain'
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'
postconf -e 'mynetworks = 127.0.0.0/8'
touch /etc/postfix/local-host-names그런 다음 Postfix 설치에서 호스트 이름을 설정합니다 (server1과 example.com을 자신의 설정으로 바꾸는 것을 잊지 마세요):
postconf -e 'mydomain = example.com'
postconf -e 'myhostname = server1.$mydomain'/etc/sasl2/smtpd.conf를 편집합니다. 다음과 같아야 합니다:
vi /etc/sasl2/smtpd.conf| # postfix를 위한 SASL 라이브러리 구성 파일 # 모든 매개변수는 다음에 문서화되어 있습니다: # /usr/share/doc/cyrus-sasl/options.html # mech_list 매개변수는 사용할 sasl 메커니즘을 나열합니다, # 기본적으로 발견된 모든 메커니즘입니다. mech_list: plain login # 별도의 saslauthd 데몬을 사용하여 인증하려면 (예: 시스템 또는 ldap 사용자). # /etc/sysconfig/saslauthd도 참조하십시오. pwcheck_method: saslauthd saslauthd_path: /var/lib/sasl2/mux # sasldb에 저장된 사용자에 대해 인증합니다. #pwcheck_method: auxprop #auxprop_plugin: sasldb #sasldb_path: /var/lib/sasl2/sasl.db |
TLS에 필요한 SSL 인증서를 생성합니다:
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에 맞게 구성합니다:
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'다음으로 Dovecot을 구성하여 imap, imaps, pop3 및 pop3s 프로토콜을 제공해야 합니다. /etc/dovecot.conf를 열고 다음 값을 조정합니다:
vi /etc/dovecot.conf| [...] # 제공하고자 하는 프로토콜: imap imaps pop3 pop3s # dovecot-auth만 사용하려면 "none"으로 설정할 수 있습니다. protocols = imap imaps pop3 pop3s [...] disable_plaintext_auth = no [...] pop3_uidl_format = %08Xu%08Xv [...] |
이제 시스템에 Dovecot이 ntpd가 시작된 후에만 시작되도록 지시해야 합니다. Dovecot이 실행 중일 때 시스템 시간이 뒤로 이동하면 Dovecot이 매우 관대하지 않기 때문입니다 (http://wiki.dovecot.org/TimeMovedBackwards 참조). 이로 인해 syslog에 다음과 같은 오류가 발생할 수 있습니다:
Apr 9 19:29:18 server1 dovecot: 시간이 17초 뒤로 이동했습니다. 이는 많은 문제를 일으킬 수 있으므로, 지금 저를 죽이겠습니다. http://wiki.dovecot.org/TimeMovedBackwards불행히도 Mandriva에서는 Dovecot이 ntpd보다 먼저 시작되므로 다음과 같이 변경합니다:
cd /etc/rc3.d
mv S99ntpd S98ntpd
mv S54dovecot S99dovecot
cd /etc/rc4.d
mv S99ntpd S98ntpd
mv S54dovecot S99dovecot
cd /etc/rc5.d
mv S99ntpd S98ntpd
mv S54dovecot S99dovecot그런 다음 Postfix의 시스템 시작 링크를 생성합니다…
chkconfig postfix on… 그리고 (재)시작합니다 Postfix, saslauthd 및 Dovecot:
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
/etc/init.d/dovecot restartSMTP-AUTH 및 TLS가 제대로 작동하는지 확인하려면 다음 명령을 실행합니다:
telnet localhost 25Postfix 메일 서버에 연결한 후 다음을 입력합니다:
ehlo localhost다음 줄이 보이면
250-STARTTLS그리고
250-AUTH PLAIN LOGIN모든 것이 정상입니다:
[root@server1 ssl]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 server1.example.com ESMTP Postfix (2.5.1) (Mandriva Linux)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@server1 ssl]#quit를 입력하여 시스템의 셸로 돌아갑니다.
11.1 Maildir
Dovecot은 Maildir 형식(mbox 아님)을 사용하므로, 서버에 ISPConfig를 설치하는 경우 관리 -> 서버 -> 설정 -> 이메일에서 Maildir을 활성화하는 것을 잊지 마세요. ISPConfig가 필요한 구성을 수행합니다.
ISPConfig를 설치하고 싶지 않은 경우, Postfix를 사용자의 Maildir로 이메일을 배달하도록 구성해야 합니다(ISPConfig를 사용하는 경우에도 이 작업을 수행할 수 있습니다 - 해롭지 않습니다 ;-)):
postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
/etc/init.d/postfix restart새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.