서버 설정 · 4 min read · Dec 03, 2025
완벽한 서버 - Mandriva 2008 무료 (Mandriva 2008.0) - 페이지 5
10 MySQL (5.0)
MySQL 5.0을 설치하려면, 다음을 실행합니다:
urpmi MySQL MySQL-client libmysql15-devel기본적으로 Mandriva 2008의 MySQL 패키지에서는 네트워킹이 활성화되어 있지 않지만, ISPConfig에서는 네트워킹이 필요합니다. 우리는 /etc/my.cnf에서 skip-networking 줄의 주석을 제거하여 이를 변경할 수 있습니다:
vi /etc/my.cnf| [...] # TCP/IP 포트를 전혀 듣지 않습니다. 이는 보안 향상이 될 수 있습니다, # mysqld에 연결해야 하는 모든 프로세스가 동일한 호스트에서 실행되는 경우. # mysqld와의 모든 상호작용은 Unix 소켓 또는 명명된 파이프를 통해 이루어져야 합니다. # 이 옵션을 사용하되 Windows에서 명명된 파이프를 활성화하지 않으면 # ("enable-named-pipe" 옵션을 통해) mysqld는 쓸모없게 됩니다! # #skip-networking [...] |
그 후, MySQL을 시작합니다:
/etc/init.d/mysqld start이제 네트워킹이 활성화되었는지 확인합니다. 다음을 실행합니다:
netstat -tap | grep mysql출력은 다음과 같아야 합니다:
[root@server1 var]# netstat -tap | grep mysql
tcp 0 0 *:mysql-im *:* LISTEN 5697/mysqlmanager
tcp 0 0 *:mysql *:* LISTEN 5705/mysqld다음으로, 다음을 실행하여 root 사용자에 대한 비밀번호를 설정합니다 (그렇지 않으면 누구나 MySQL 데이터베이스에 접근할 수 있습니다!).
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword11 Postfix와 SMTP-AUTH 및 TLS
필요한 패키지(Postfix, cyrus-sasl, imap 등)를 다음과 같이 설치합니다:
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 imap그런 다음 (mydomain, myhostname 및 mydestination에 대해 올바른 값을 사용하고 있는지 확인하십시오):
postconf -e 'mydomain = example.com'
postconf -e 'myhostname = server1.$mydomain'
postconf -e 'mydestination = /etc/postfix/local-host-names, localhost.example.com'
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_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
touch /var/lib/mailman/data/aliases/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'이제 Postfix, saslauthd, imap 및 pop3를 시작합니다:
chkconfig imap on
chkconfig imaps on
chkconfig ipop3 on
chkconfig pop3s on
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
/etc/init.d/xinetd 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.4.5) (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를 입력하여 시스템의 셸로 돌아갑니다.
12 Apache2와 PHP5
Apache2와 PHP5를 설치하려면, 다음 명령을 실행합니다 (한 줄로):
urpmi apache-mod_suexec apache-mod_ssl apache-mod_php libphp5_common5 php-bz2 php-calendar php-ctype php-curl php-devel php-dio php-dom php-eaccelerator php-enchant php-esmtp php-event php-exif php-fam php-ffmpeg php-fileinfo php-filepro php-ftp php-gd php-gettext php-gmp php-iconv php-id3 php-idn php-imap php-imlib2 php-mailparse php-mbstring php-mcache php-mcrypt php-mhash php-ming php-mysql php-mysqli php-ncurses php-newt php-odbc php-oggvorbis php-pam_auth php-pcntl php-pcre php-pear-Net_IDNA php-posix php-pspell php-readline php-recode php-session php-shmop php-simplexml php-snmp php-soap php-sockets php-sqlite php-ssh2 php-suhosin php-sysvmsg php-sysvsem php-sysvshm php-tclink php-tcpwrap php-tidy php-xml php-xmlrpc php-zip php-ini curl libcurl4-devel perl-libwww-perl ImageMagickApache를 시작합니다:
/etc/init.d/httpd restart12.1 PHP를 전역적으로 비활성화
(이 서버에 ISPConfig를 설치할 계획이 없다면 이 섹션을 건너뛰십시오!)
ISPConfig에서는 웹사이트별로 PHP를 구성할 수 있습니다. 즉, 어떤 웹사이트가 PHP 스크립트를 실행할 수 있고 어떤 웹사이트가 실행할 수 없는지를 지정할 수 있습니다. 이는 PHP가 전역적으로 비활성화되어 있어야만 작동합니다. 그렇지 않으면 모든 웹사이트가 ISPConfig에서 지정한 것과 관계없이 PHP 스크립트를 실행할 수 있습니다.
/etc/httpd/modules.d/70_mod_php.conf를 편집하고 AddType 줄의 주석을 제거합니다:
vi /etc/httpd/modules.d/70_mod_php.conf| |
/etc/httpd/conf/httpd.conf를 편집하고 LoadModule 섹션에 다음 줄을 추가합니다:
vi /etc/httpd/conf/httpd.conf| [...] LoadModule php5_module extramodules/mod_php5.so [...] |
(이 줄은 이미 /etc/httpd/modules.d/70_mod_php.conf에 있지만, ISPConfig에서 생성된 가상 호스트에 php_admin_flag safe_mode On과 같은 줄이 포함되어 있을 경우, 이 명령이 매우 중요합니다. 그렇지 않으면 명령
httpd -t가 Syntax OK 대신 오류를 보고할 것입니다!)
Apache를 다시 시작합니다:
/etc/init.d/httpd restart새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.