서버 설정 · 3 min read · Dec 13, 2025
완벽한 서버 - 페도라 12 x86_64 [ISPConfig 2] - 페이지 4
9 MySQL 5
MySQL을 설치하려면, 다음과 같이 합니다:
yum install mysql mysql-devel mysql-server그런 다음 MySQL의 시스템 시작 링크를 생성하여 (시스템이 부팅될 때마다 MySQL이 자동으로 시작되도록) MySQL 서버를 시작합니다:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start이제 네트워킹이 활성화되었는지 확인합니다. 다음을 실행합니다:
netstat -tap | grep mysql다음과 같은 결과가 보여야 합니다:
[root@server1 ~]# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 1433/mysqld
[root@server1 ~]#만약 그렇지 않다면, /etc/my.cnf를 편집하고 skip-networking 옵션을 주석 처리합니다:
vi /etc/my.cnf| [...] #skip-networking [...] |
그런 다음 MySQL 서버를 재시작합니다:
/etc/init.d/mysqld restart다음 명령어를 실행하여 root 사용자에 대한 비밀번호를 설정합니다 (그렇지 않으면 누구나 MySQL 데이터베이스에 접근할 수 있습니다!).
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword10 Postfix와 SMTP-AUTH 및 TLS
이제 Postfix와 Dovecot를 설치합니다 (Dovecot는 우리의 POP3/IMAP 서버가 됩니다):
yum install cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain postfix dovecot이제 SMTP-AUTH와 TLS를 구성합니다:
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 [::1]/128'우리는 /usr/lib64/sasl2/smtpd.conf를 편집하여 Postfix가 PLAIN 및 LOGIN 로그인을 허용하도록 해야 합니다 (32비트 시스템에서는 이 파일이 /usr/lib/sasl2/smtpd.conf에 있습니다). 다음과 같이 보여야 합니다:
vi /usr/lib64/sasl2/smtpd.conf| pwcheck_method: saslauthd mech_list: plain login |
그 후 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다음으로 TLS를 위한 Postfix를 구성합니다:
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'그런 다음 Postfix 설치에서 호스트 이름을 설정합니다 (server1.example.com을 자신의 호스트 이름으로 교체해야 합니다):
postconf -e 'myhostname = server1.example.com'이러한 구성 단계를 마친 후, 이제 /etc/postfix/main.cf가 다음과 같이 보여야 합니다 (모든 주석을 제거했습니다):
cat /etc/postfix/main.cf| queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix mail_owner = postfix inet_interfaces = all inet_protocols = all mydestination = $myhostname, localhost.$mydomain, localhost unknown_local_recipient_reject_code = 550 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix setgid_group = postdrop html_directory = no manpage_directory = /usr/share/man sample_directory = /usr/share/doc/postfix-2.6.5/samples readme_directory = /usr/share/doc/postfix-2.6.5/README_FILES 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 mynetworks = 127.0.0.0/8 [::1]/128 smtpd_tls_auth_only = no smtp_use_tls = yes smtpd_use_tls = yes smtp_tls_note_starttls_offer = yes smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt 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 myhostname = server1.example.com |
이제 Postfix, saslauthd 및 Dovecot을 시작합니다:
chkconfig --levels 235 sendmail off
chkconfig --levels 235 postfix on
chkconfig --levels 235 saslauthd on
chkconfig --levels 235 dovecot on
/etc/init.d/sendmail stop
/etc/init.d/postfix start
/etc/init.d/saslauthd start
/etc/init.d/dovecot startSMTP-AUTH와 TLS가 제대로 작동하는지 확인하려면 다음 명령어를 실행합니다:
telnet localhost 25Postfix 메일 서버에 연결한 후 다음을 입력합니다:
ehlo localhost다음과 같은 줄이 보이면:
250-STARTTLS그리고
250-AUTH PLAIN LOGIN모든 것이 정상입니다.
[root@server1 ssl]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 server1.example.com ESMTP Postfix
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를 입력하여 시스템의 셸로 돌아갑니다.
10.1 Maildir
Dovecot은 Maildir 형식(즉, mbox가 아님)을 사용하므로, 서버에 ISPConfig를 설치하는 경우 Management -> Server -> Settings -> Email에서 Maildir을 활성화해야 합니다. 그러면 ISPConfig가 필요한 구성을 수행합니다.
ISPConfig를 설치하고 싶지 않은 경우, Postfix를 구성하여 사용자의 Maildir로 이메일을 배달해야 합니다 (ISPConfig를 사용하는 경우에도 이 작업을 수행할 수 있습니다 - 해가 되지 않습니다 ;-)):
postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
/etc/init.d/postfix restart새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.