PostgreSQL8.0¤Î²òÀâ
Apache2.2¤Î²òÀâ
¥Ð¡¼¥¸¥ç¥ó8.1.4, 8.0.8, 7.4.13, 7.3.15°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤Ï¥Þ¥ë¥Á¥Ð¥¤¥È½èÍý¤ËSQL¥¤¥ó¥¸¥§¥¯¥·¥ç¥ó¤ÎÀȼåÀ¤¬¤¢¤ê¤Þ¤¹¡£
¾ÜºÙ(SRA OSS)
¾ÜºÙ(ITpro)
PostgreSQL,PHP,Apache¤ÎRPM¤ÏÁ´¤Æºï½ü¤·¤Æ¤ª¤¤Þ¤¹
¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×¤¹¤ë¾ì¹ç¤Ï¥Ð¥Ã¥¯¥¢¥Ã¥×¤ò¼è¤Ã¤Æ»ß¤á¤Æ¤ª¤¤Þ¤·¤ç¤¦
postgres ¥æ¡¼¥¶¡¼¤ÎºîÀ®
# /usr/sbin/useradd -d /usr/local/pgsql postgres # chmod 755 /usr/local/pgsql
ºî¶È¥Ç¥£¥ì¥¯¥È¥êºîÀ®
# mkdir /usr/local/src/postgresql-8.1.3 # chown postgres /usr/local/src/postgresql-8.1.3
¥½¡¼¥¹¼èÆÀ http://www.postgresql.jp/
¾ï¤ËºÇ¿·¥Ð¡¼¥¸¥ç¥ó¤ò³Îǧ¤·¤Þ¤·¤ç¤¦
ÄÌ¿®¤ò°Å¹æ²½¤¹¤ë¾ì¹ç¤Ï ./configure --with-openssl ¤È¤¹¤ë
# su postgres $ tar xvzf postgresql-8.1.3.tar.gz $ cd postgresql-8.1.3 $ ./configure $ gmake $ gmake check $ gmake install
$ cd $ cd data $ openssl req -new -text -out server.req Generating a 1024 bit RSA private key ...++++++ .....++++++ writing new private key to 'privkey.pem' Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:JP State or Province Name (full name) [Berkshire]:Shiga Locality Name (eg, city) [Newbury]:Otsu Organization Name (eg, company) [My Company Ltd]:Self Organizational Unit Name (eg, section) []:Engineer Common Name (eg, your name or your server's hostname) []:example.com Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
¥Ñ¥¹¥Õ¥ì¡¼¥º¤Îºï½ü
$ openssl rsa -in privkey.pem -out server.key $ rm -f privkey.pem
¼«¸Ê½ð̾
$ openssl req -x509 -in server.req -text -key server.key -out server.crt $ chmod og-rwx server.key
pg_hba.conf ¤Ëhostssl¤òµ½Ò
postgresql.conf ¤Îssl¤òon¤Ë¤¹¤ë
¥¯¥é¥¤¥¢¥ó¥È¦¤Ë¤âPostgreSQL¤ò --with-openssl ÉÕ¤¤Ç¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯
µ¯Æ°¤¹¤ëɬÍפÏ̵¤·
postgres¤ÈPostgreSQL¤ò»ÈÍѤ¹¤ë¥æ¡¼¥¶¡¼Á´¤Æ¤Î.bashrc¤Ë°Ê²¼¤òÄɲÃ
PATH="$PATH":/usr/local/pgsql/bin export POSTGRES_HOME=/usr/local/pgsql export PGLIB=$POSTGRES_HOME/lib export PGDATA=$POSTGRES_HOME/data export MANPATH="$MANPATH":$POSTGRES_HOME/man export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"
ÀßÄê¤ÎÈ¿±Ç
$ source ~/.bashrc
¥Ç¡¼¥¿¥Ù¡¼¥¹½é´ü²½
$ initdb --encoding=EUC_JP --no-locale
°ì¹ÔÄɲÃ
# vi /etc/ld.so.conf /usr/local/pgsql/lib # /sbin/ldconfig
# cp /usr/local/src/postgresql-8.1.3/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql # chmod 755 /etc/rc.d/init.d/postgresql # /sbin/chkconfig --add postgresql # /etc/rc.d/init.d/postgresql start
$ vi /usr/local/pgsql/data/postgresql.conf redirect_stderr = on log_filename = '%m-%d.log' log_truncate_on_rotation = on log_min_error_statement = error log_line_prefix = '<%t %u %d %p>'
PostgreSQL8.1¤«¤é¤Ï¼«Æ°¤ÇVACUUM¤¬¼Â¹Ô¤µ¤ì¤ë¤è¤¦¤ËÀßÄê¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿
$ vi /usr/local/pgsql/data/postgresql.conf stats_row_level = on autovacuum = on
¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏÉÔ½½Ê¬¤Ê¤Î¤Ç¤³¤Á¤é¤ò»²¹Í¤Ë¹ç¤ï¤»¤Æ¤ä¤Ã¤Æ¤ª¤³¤¦
PostgreSQL¤Î¥Á¥å¡¼¥Ë¥ó¥°
MPM¤Ïworker¤â¤·¤¯¤Ïperchild¤À¤ÈPHP¤¬°ÂÄêÆ°ºî¤·¤Ê¤¤¤é¤·¤¤
»²¹Í
SSL¤ò͸ú¤Ë¤¹¤ë¾ì¹ç¤Ï --enable-ssl
»²¹Í
# tar xvzf httpd-2.2.2.tar.gz # cd httpd-2.2.2 # ./configure --with-mpm=prefork --enable-rewrite --enable-so # make # make install
configure: error: Cannot use an external APR-util with the bundled APR
¤È¥¨¥é¡¼¤¬½Ð¤ë¾ì¹ç¤Ï --with-included-apr ¤òÄɲ䷤Ƥߤë
nobody¸¢¸Â¤Ë¤Ê¤ë¤è¤¦¤ËÊѹ¹
ÆäËÍýͳ¤Ï̵¤·¡£ÀΤ«¤é¤Î¸Ä¿ÍŪ¤Ê̾»Ä
<IfModule !mpm_netware_module> User nobody Group nobody </IfModule>
Apache2.0·Ï¤Î¾ì¹ç
vi /usr/local/apache2/conf/httpd.conf
ServerTokens Prod ServerSignature Off TraceEnable off
Apache2.2·Ï¤Î¾ì¹ç
Apache2.2·Ï¤«¤éÌÜŪÊ̤κ٤«¤¤ÀßÄê¤ÏÊÌ¥Õ¥¡¥¤¥ë¤ËʬΥ¤µ¤ì¤Æ¤¤¤ë¡£
apache2/conf/extra/ Æâ¤Ë httpd-xxxxxxx.conf ¤Î·Á¼°¤Ç¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤¹¤ë¡£
¤³¤ì¤é¤òÆɤ߹þ¤à¤¿¤á¤Ë¤Ï httpd.conf Æâ¤Ç³ºÅö²Õ½ê¤Î¥³¥á¥ó¥È¤ò³°¤¹É¬Íפ¬¤¢¤ë
º£²óÀßÄꤹ¤ë¹àÌܤ¬¤¢¤ë¤Î¤Ï httpd-default.conf
vi /usr/local/apache2/conf/httpd.conf
394¹ÔÌܤ¢¤¿¤ê
Include conf/extra/httpd-default.conf
httpd.conf ¤ÇÆɤ߹þ¤Þ¤»¤¿¥Õ¥¡¥¤¥ë¤òÊÔ½¸
vi /usr/local/apache2/conf/extra/httpd-default.conf
ServerTokens Prod ServerSignature Off TraceEnable off
¡ÖTraceEnable¡×¤ÏºÇ½é½ñ¤¤¤Æ¤Ê¤¤¤«¤â
¤½¤Î¾ì¹ç¡ÖServerSignature¡×¤Î²¼¤Ë¤Ç¤âÄɲ䷤Ȥ±¤Ð¤¤¤¤¤À¤í¤¦
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd # chmod 755 /etc/rc.d/init.d/httpd
# vi /etc/rc.d/init.d/httpd
°Ê²¼¤òÄɲÃ
#!/bin/sh # chkconfig: - 85 15 # description: Apache is a World Wide Web server. It is used to serve \ # HTML files and CGI. # processname: httpd # pidfile: /usr/local/apache2/logs/httpd.pid # config: /usr/local/apache2/conf/httpd.conf
# /sbin/chkconfig --add httpd # /etc/rc.d/init.d/httpd start
¥í¥°¤òZIP°µ½Ì¤¹¤ë¾ì¹ç compress
# vi /etc/logrotate.d/apache
/usr/local/apache2/logs/*_log { rotate 4 compress weekly sharedscripts postrotate /usr/local/apache2/bin/apachectl restart endscript }
# /usr/sbin/logrotate -f /etc/logrotate.d/apache
¥³¥Þ¥ó¥É¤Ë¤Æ /usr/local/apache2/logs Æâ¤Ë access_log.1 error_log.1 ¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤ì¤ÐOK
http://jp.php.net/downloads.php
PHP¤á¤â¤â»²¹Í¤Ë¤·¤Æ²¼¤µ¤¤
Amazon ECS¤Ê¤É¤òÍøÍѤ¹¤ë¾ì¹ç¤ÏSimpleXML´Ø¿ô¤ò͸ú¤Ë¤·¤Æ¤ª¤¯
--enable-simplexml
cURL¤òÍøÍѤ¹¤ë¾ì¹ç¤ÏÀè¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯
RPM¤ÇÆþ¤Ã¤Æ¤¤¤ì¤ÐOK
--with-curl
MySQL¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï
--with-mysql
# tar xvzf php-5.1.4.tar.gz # cd php-5.1.4 # ./configure \ --with-apxs2=/usr/local/apache2/bin/apxs \ --enable-zend-multibyte \ --enable-mbstring \ --enable-mbregex \ --with-gd \ --with-zlib-dir=/usr \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-freetype-dir=/usr \ --with-ttf \ --enable-gd-native-ttf \ --enable-gd-jis-conv \ --enable-sockets \ --enable-simplexml \ --with-curl \ --with-pgsql \ --with-mysql # make # make install
--enable-soap
--enable-ftp
--with-zlib --enable-pdo=shared¤Þ¤¿¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¸ÇͤΠPDO ¥É¥é¥¤¥Ð ¤ò»ÈÍѤ¹¤ëɬÍפ¬¤¢¤Î¤Ç¡¢
--with-pgsql=shared --with-pdo-pgsql=shared
--with-sqlite=shared --with-pdo-sqlite=shared
--with-mysql=shared --with-pdo-mysql=shared
# cp /usr/local/src/php-5.1.4/php.ini-dist /usr/local/lib/php.ini
;; ½ÐÎϥХåե¡¥ê¥ó¥°¤ò͸ú¤Ë¤¹¤ë output_buffering = On ;; mb_output_handler¤Ë¤è¤ë½ÐÎÏÊÑ´¹¤ò͸ú¤Ë¤¹¤ë output_handler = mb_output_handler magic_quotes_gpc = Off ;; HTTP¥Ø¥Ã¥À charset ¤òÀßÄê default_charset = Shift_JIS ;;ÆüËܸì¼çÂΤǻÈÍÑ mbstring.language = Japanese ;; ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤òEUC-JP¤ËÀßÄê mbstring.internal_encoding = EUC-JP ;; HTTPÆþÎÏ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ´¹¤òauto¤ËÀßÄê mbstring.http_input = auto ;; SJIS¤ËÊÑ´¹ mbstring.http_output = SJIS ;; ¼«Æ°¥¨¥ó¥³¡¼¥É ;; ¥Û¥ó¥È¤ÏOff¤Ë¤·¤Æ¼«ÎϤǥ¨¥ó¥³¡¼¥É¤¹¤ëÊý¤¬Ê¸»ú²½¤±¤Î¿´Çۤ⤤¤é¤Ê¤¤ mbstring.encoding_translation = On mbstring.detect_order = auto ;; ̵¸ú¤Êʸ»ú¤ò½ÐÎϤ·¤Ê¤¤ mbstring.substitute_character = none; mbstring.func_overload = 0 ; Zend_Session¤ò»ÈÍѤ¹¤ë¤Ê¤é¤Ð¥³¥á¥ó¥È¤ò¤Ï¤º¤·¤Æ¤ª¤¯¤ÈµÈ session.save_path = "/tmp"
AddType application/x-httpd-php .php
¤òÄɲä·¤ÆApacheºÆµ¯Æ°