2012년 2월 17일 금요일

centos 웹서버

참고: http://kch1183.blog.me
참고: http://gudle.net

설치 확인
# rpm -qa httpd php mysql

삭제
# yum remove -y httpd php mysql

mysql 사용자 등록 확인
# cat /etc/passwd

mysql 사용자 삭제
# userdel -r mysql

패키지 설치
# yum -y install mysql mysql-server mysql-connector-odbc mysql-devel
메모리설정 파일 복사
# cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
# cp /etc/my.cnf /etc/my.cnf.org 로 이름을 바꾸고 파일을 복사

my.cnf파일에 utf-8인코딩 추가
[client]
default-character-set   = utf8
[mysqld]
init_connect = SET collation_connection = utf8_general_ci
init_connect = SET NAMES utf8
default-character-set = utf8
character-set-server = utf8
collation-server = utf8_general_ci
[mysqldump]
default-character-set=utf8
[mysql]
default-character-set=utf8

서비스 가동
#/etc/rc.d/init.d/mysqld start
서비스 가동 실패(fail)시 에러확인
# cat /var/log/mysqld.log
120217 17:07:21 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
120217 17:07:21 [ERROR] Do you already have another mysqld server running on port: 3306 ?
120217 17:07:21 [ERROR] Aborting
라고 나와서 관련프로세스를 죽였다.
# killall mysqld
# killall mysql
(두번째 재설치 할때는 A mysqld process already exists at 에러가  나왔다.)

mysql 접속 및 문자셋 확인
# mysql -u root
mysql> show variables like 'c%';

root 암호 초기화
mysql> USE mysql;
mysql> UPDATE user SET password=password('new_password') WHERE user='kella';
mysql> FLUSH privileges;
또는
/usr/bin/mysqladmin -u root password 'new-password'

데이터베이스 선택 및 보기
mysql> USE mysql;
mysql> SELECT Host, User, Password FROM user;

apache 설치
참조: http://batsu05.tistory.com/53
# vi /usr/local/server/apache/conf/httpd.conf
마지막줄에 추가한다.
AddDefaultCharset UTF-8
# service httpd restart


php 설치
# tar -xvzf php-5.3.10.tar.gz
# cd php-5.3.10
#  .confiure.. (옵션)
옵션
./configure --prefix=/usr/local/server/php --with-apxs2=/usr/local/server/apache/bin/apxs --with-mysql=/usr/local/server/mysql --with-config-file-path=/usr/local/server/apache/conf --disable-debug --enable-safe-mode --enable-track-vars --enable-sockets --with-charset=utf8 --with-xml --with-language=korean --enable-calender --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --enable-gd-native-ttf --enable-url-includes --enable-inline-optimization --enable-bcmath --with-jpeg --with-png  --with-zlib --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring
(옵션에 맞는 라이브러리가 없어서 에러가 날 경우도 있다. 구글에서 에러문을 검색해 본다.)

# make && make install

CentOS 리눅스 구축관리실무 책에 보면은 php.ini-dist 파일을 /usr/local/server/apache/conf/php.ini로 이동하라고 되어있다.

하지만 설치한 php5.3버전에는 존재하지 않는 파일, 검색결과 5.3버전부터는 php.ini-production 파일을 이동하면 된다고 한다.

#vi /usr/local/server/apache/conf/httpd.conf

<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>
.
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .htm .html .php .php3 .php4 .inc
AddType application/x-httpd-php-source .phps


# vi /usr/local/server/apache/htdocs/phpinfo.php
<?php
phpinfo();
?>
//작성

댓글 없음:

댓글 쓰기