([# ]표시 = 명령어 입력, [:: ]표시 = 내용 타이핑하라는 의미임)

http://httpd.apache.org  httpd-2.2.11.tar.bz2
http://www.php.net  php-5.3.0.tar.bz2
http://www.mysql.com  mysql-5.1.36.tar.gz
 -[Downloads]-[Downloads]-[MySQL Community Server]-[MySQL 5.1]
   제일아래[Source downloads] 'Compressed GNU TAR arcive(tar.gz)' 5.1.36버전


# tar xvfj httpd*
# tar xvfj php*
# tar xvfz mysql*

 

1. 아파치 서버 설치
# cd httpd-2.2*
# pwd
# ./configure --prefix=/web/httpd2 --enable-module=so --enable-mods-shared=most --with-ssl
# make
# make install

압축푼 디렉토리로 들어가서 configure 옵션주고 하고, make와 make install완료하기
(※1.# ./configure할때 옵션뒤에 \버튼을 누르면 줄바꿈되고 > 표시 뒤에 옵션 이어쓰기 가능
\앞에는 한칸 공백 줘야함
ex) ./configure --prefix=/web/httpd2 \
> --enable-module=so \
> --enable-mods-shared=most \
> --with-ssl
※2.# make; make install 동시에 가능)

 

# vi /etc/ld.so.conf
:: /web/httpd2/lib
:: /web/httpd2/modules
2줄 추가
(웹전용으로 운영할 계획이라면 /web 디렉토리를 RAID를 사용해야 빠르고 안정적)

# ldconfig
추가한 내용 적용

# cp /web/httpd2/bin/apachectl /etc/init.d/httpd2
아파치 시작 스크립트 파일 /etc/init.d 디렉토리에 복사

# vi /etc/init.d/httpd2
:: # chkconfig: - 85 15
:: # description: 아파치 웹 서버 2.2.11 입니다
띄워쓰기 주의해서 입력

# chkconfig httpd2 on  → 컴퓨터 부팅될때 자동시작으로 설정
# service httpd2 start  → 아파치 웹 서버 가동
# ps -ef | grep httpd  → 아파치 프로세스가 보이는지 확인

※ 오류 해결법
# service httpd2 restart
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
이런 메시지 나온다면
# vi /web/httpd2/conf/httpd.conf
아무곳에나
:: ServerName 127.0.1.1
추가해주기




웹 서버 작동 테스트
웹 브라우저에서 http://localhost 또는 http://127.0.0.1 로 접속
It works! 페이지 뜨는지 확인

ㅁㅁㅁㅁㅁㅁ 컴파일한 아파치의 홈 디렉토리 = /web/httpd2/htdocs/
ㅁㅁㅁㅁㅁㅁ 지금 열린 파일 = index.html


----------------------------------------------------------------
2. MySQL 설치

# rpm -qa | grep mysql
# rpm -e --nodeps '파일명'
rpm으로 설치 되어있는 mysql을 지우기 

# cd /root/mysql-5.*           (압축해제한 설치파일 있는 폴더)
# pwd
# ./configure --prefix=/web/mysql --localstatedir=/web/mysql/var --with-charset=euckr
# make
# make install
configure옵션중 --with-charset=euckr은 한글 지원하게 하려는 옵션

# vi /etc/ld.so.conf
:: /web/mysql/lib/mysql

# ldconfig
추가해준 후 추가내용 적용

# cp /web/mysql/share/mysql/mysql.server /etc/init.d/mysqld
mysqld 시작 스크립트 파일을 /etc/init.d/ 디렉토리에 복사

# /web/mysql/bin/mysql_install_db
MySQL 서버의 초기 Database(mysql, test) 생성

# ls -l /web/mysql/var
mysql, test 두개의 디렉토리 확인

# groupadd mysql
# adduser -M -d /web/mysql -g mysql -s /bin/false -r mysql
# chown -R mysql.mysql /web/mysql/var
MySQL 그룹 및 사용자를 생성
초기 DB의 소유권 mysql 사용자에게 주기

# chkconfig mysqld on
# service mysqld start
자동시작 등록

# PATH=$PATH:/web/mysql/bin
mysql 실행 디렉토리를 PATH에 추가

# mysql
mysql> show databases;
mysql> quit;
정상 작동 테스트
(※ /root/.bash_profile의 아래 부분을 수정하면 다음에 로그온할때 mysql 명령을 간단히 실행할수 있다.)
"PATH=$PATH:$HOME/bin → PATH=$PATH:$HOME/bin:/web/mysql/bin"


-------------------------------------------------------------------------
3. PHP 설치

# cd /root/php-5.*
# pwd
# ./configure --with-mysql=/web/mysql --with-apxs2=/web/httpd2/bin/apxs --with-mysqli=/web/mysql/bin/mysql_config \
--with-imap-ssl --disable-debug --with-iconv --with-gd --with-jpeg-dir --with-png-dir --with-libxml-dir \
--with-openssl --with-config-file-path=/etc
# make
# make install
컴파일후 설치 완료

# ls -l /web/httpd2/modules/libphp5.so
DSO(Dynamic Shared Object) 방식으로 위 파일 하나만 생성

# vi /web/httpd2/conf/httpd.conf
98행:: LoadModule php5_module modules/libphp5.so
354행:: AddType application/x-httpd-php .php .php3 .php4 .php5 .htm .html .inc
웹 서버 가동시 PHP모듈(libphp5.so) 파일 등록
파일열어 확인하고 없으면 추가

# pwd
pwd로 현재위치 php압축 푼 폴더인지 확인후

# cp php.ini-production /etc/php.ini
PHP 설정파일인 php.ini-production 복사

# service httpd2 stop
웹서버 중지

# ps -ef | grep httpd2
중지 되었나 확인

# service httpd2 start
웹서버 가동

※ 오류 해결법
# service httpd2 restart
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
이런 메시지 나온다면
# vi /web/httpd2/conf/httpd.conf
아무곳에나
:: ServerName 127.0.1.1
추가해주기



# ps -ef | grep httpd2
잘 돌아가나나 확인
(※ # service httpd2 restart 로 해도 같음)

# vi /web/httpd2/htdocs/phpinfo.php
:: <? phpinfo (); ?>
vi에디터로 파일 생성해서 내용입력

웹 브라우저로 http://서버IP/phpinfo.php 접속확인
화면 뜨면 성공

※ 오류 해결법
다운로드 받으라고나온다면
# vi /etc/php.ini
:: short_open_tag = On    → OFF 인부분 On 으로 수정
# service httpd2 restart
서비스 재시작


 


※ ZendGuardLoader 설치하기

1. 본인 버전에 맞는 ZendGuardLoader 다운로드
ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
2. vi /etc/php.ini
:: zend_extension=/root/zendguard/ZendGuardLoader.so
:: zend_loader.enable=1
아래부분 사이에 2줄 추가

;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll

zend_extension=/root/zendguard/ZendGuardLoader.so
zend_loader.enable=1

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

# service httpd2 restart
서비스 재시작

Posted by 딩구르
,