달력

2

« 2025/2 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
2017. 7. 2. 22:25

linux 리눅스 APM 연동 하기 C. Oracle2017. 7. 2. 22:25


Apache + MySQL + PHP  연동 설치

 

php, mysql, httpd 소스 받아서 /apm 디렉토리에 풀고 각각의 디렉토리명 바꾸기

 

-          mkdir /apm

-          mv ~.tar /apm   ( 각각의 소스를 다운로드하여 /apm 으로 옮기기 )

-          tar ?xvzf ~.tar  (  php,mysql,httpd 풀어주기 )

-          mv mysql.버전 mysql  ,  mv hpptd.버전 httpd   ,   mv php.버전 php

 

MYSQL Install

 

설치

-          cd /apm/mysql

-          ./configure  --prefix=/usr/local/mysql  --with-char=euc_kr

            --localstatedir=/usr/local/mysql/data

 

( --prefix=/usr/local/mysql : MYSQL 설치위치. /usr/local/mysql MYSQL

관한 모든 파일들과 디렉토리들이 생성된다 )

--localstatedir=/usr/loca/mysql/data : MYSQL 데이테버이스 데이터들이

저장될 위치

--with-char=euc_kr: 한글지원을 하기 위한 설정 )

 

-  make (컴파일)

-  make install (설치)

    -  cd  /usr/local/mysql/bin

./mysql_install_db 실행: /usr/local/mysql/data 디렉토리가 생성되며 디렉토

리내에 mysql test 데이터베이스를 생성한다.

 

 

계정 생성 DB디렉토리 권한 변경

 

-  useradd ?M mysql

-  chown ?R mysql.mysql /usr/local/mysql/data 

( /usr/local/mysql/data 디렉토리와 안에 들어있는 모든 파일들의 소유주와 그룹

소유주를 mysql mysql 설정.)

 

데몬구동

( 시작 서비스에 등록하여 구동하는 방법 ) a여기서는 방법 선택

    - cp /usr/local/mysql/share/mysql/mysql.server  /etc/rc.d/init.d/

    - chkconfig  --add mysql.server

    - chkconfig  --level 345 mysql.server on

    - service mysql.server start

( 임의로 그때 그때 구동 )

-          /usr/local/mysql/bin/mysqld_safe & : 백그라운드로 mysql 데몬을 실행한다.

계정생성후 테스트

 

구동 테스트

-  /usr/local/mysql/bin/mysqladmin  ?u root password xxxxxxx

 

-  ./mysql ?u root ?p mysql ( 방금 설정한 MYSQL root사용자 패스워드를 이용하여

                            mysql 데이터베이스로 접속 테스트)

 

MySQL에서 /usr/local/mysql/bin/mysql -uroot -p mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

 

DB저장 폴더의 소유권 변경( ex) chown mysql.mysql  /usr/bin/mysql/data

touch /tmp/mysql.sock

chmod 777 /tmp/mysql.sock

service mysql.server start

 

 

 

APACHE2 Install

 

 설치

-          cd  /apm/httpd

-          ./configure  --prefix=/usr/local/apache2  --enale-module=so 

                 --enable-shared=max  --enable-so

-          make

-          make install

 

데몬구동 ( 시작 서비스에 등록하여 구동 )

 

-          cp  /usr/local/pache2/bin/apachectl  /etc/rc.d/init.d

-          vi  /etc/rc.d/init.d/apachectl ( apachectl파일 chkconfig 등록할수 있게 설정)

a /etc/rc.d/init.d/ 있는 아무 파일을 열어서…(ex> nfs 파일사용 ) 그안에 있는

Chkconfig ~~ ,description ~~ 라인을 복사하여 /etc/rc.d/init.d/apachectl 파일

안에 붙여 넣는다.

- chkconfig  --add apachectl

 

    - chkconfig  --level 345 apachectl on

 

    - service apachectl start

 

PHP4 설치

 

mv  /apm/php  /usr/local/php   ( php prefix옵션수행에서 자동생성이 안되므로

                                  설치 디렉토리를 옮겨준다. )

 

설치

./configure  --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs

--with-apache-install=/apm/httpd(아파치 설치 디렉토리)

--with-mysql=/usr/local/mysql 

--with-config-file-path=/usr/local/apache2/conf --with-char=euc_kr

( --with-aspx2=/usr/local/apache2/bin/apxs : 공유된 APACHE2 모듈을 함께 연동하기 위한 컴파일 옵션

 

--with-mysql : MYSQL PHP 연동하기 위한 옵션 MYSQL 설치된 위치를 지정하지

않는다면 기본적으로 /usr/local/mysql 디폴트다

--with-freetype-dir : FreeType2 지원하기 위한 옵션이다.

--with-zlib-dir : PHP에서 zlib 지원하기 위한 옵션이다. 설치된 디렉토리까지 지정하려

?with-zlib-dir=/usr/local/zlib 같이 하면된다.

--with-jpeg-dir: PHP에서 jpeg 지원하기 위한 옵션

-?with-gd: PHP에서 GD라이브러리관련 함수를 사용하여 GD 지원하기 위한 옵션이다.

-?disable-debug: PHP ZendOptionmizer 사용하기 위해서 deugging, 사용하지 않는다.

         따라서 debugging 사용하지 않도록 설정하기 위한 옵션이다….  )

make

make install

 

설정

cp  /usr/local/php/php.ini-dist  /usr/local/apache2/conf/php.ini

a 컴파일이 끝난 디렉토리에는 php.ini-dist 라는 파일이 있는데 파일을 /usr/local/lib/php.ini

이름을 바꿔 복사한다.

 

 

vi /usr/local/apache2/conf/httpd.conf

 

    a 아래와 같이 DirectoryIndx 수정

DirectoryIndx  index.html  index.htm  index.php  index.php3  index.php5

 

    a AddTYPE application/x-tar .tgz <= 라인 밑에 아래 내용 추가

      AddTYPE application/x-httpd-php  .php  .php3  .php5  .html  .htm

AddTYPE application/x-httpd-php-source  .phps

 

service apachectl restart

service mysql.server restart

 

APM 연동이 되었는지 확인

 

-          /usr/local/apache2/htdocs  index.php 생성

vi  index.php

 <?

    phpinfo();

 ?>

 

   - 웹브라우져를 통해 확인 http://localhost/index.php

 

 

참고

-----------------------------------------------------------------------------------------------

 

라이브러리 설치

이름

간단한 설명

Zlib

가장 보편적으로 사용하는 데이터 압축 라이브러리

Libpng

png포맷의 이미지파일을 사용하기 위한 포터블 네트워크 그래픽 라이브러리.

Freetype

텍스트의 임지 출력등을 하기 위한 공개 폰트엔진

Jpeg

JPEG 압축/압축해제 라이브러리 소프트웨어

Gd

동적이미지 생성 ANSI C라이브러리

libxml2

XML C 파서

PHP ZendOptimizer

PHP소스코드를 최적화하여 속도를 향상시켜주는 Optimizer

 

 

zlib 설치(http://www.zlib.org 또는 http://www.gzip.org/zlib )

 

tar ?xzvf zlib-버전.tar.gz

./configure (설정 하기)

make (컴파일 하기)

make install (설치 하기)

 

libpng 설치(http://www.libpng.org )

 

tar ?xzvf libpng-버전.tar.gz

cp scripts/makefile.linux makefile

( libpng에서는 configure 실행하지 않고 여러종류의 makefile 가운데 linux버전으로 되어있는 makefile.linux 파일을 cp 복사하여 사용 a 과정이 configure 라고 생각하면 된다 )

make test ( libpng관련 목적파일과 헤드파일을 생성)

make install (설치하기)

 

freetype 설치(http://www.freetype.org )

 

tar ?xvzf freetype-버전.tar.gz

./configure (설정 하기)

make (컴파일 하기)

make install (설치 하기)

jpeg 설치(http://www.ijg.org)

 

tar ?xvzf jpeg-6b-버전.tar.gz

./configure ?enable-shared ?enable-static (설정 하기)

--enable-shared ( GNU libtool 이용한 공유라이브러리를 생성하기 위한 옵션 )

--enable-static (GNU libtool 이용한 static라이브러리를 생성하기 위한 옵션 )

make

make install : 설치도중 에러가 나는 것을 발견할수 있는데 mkdir/usr/local/man/man1

디렉토리를 생성해 줌으로써 해결

 

gd 설치

 

tar ?xzvf gd-버전.tar.gz

./configure (설정 하기)

make (컴파일 하기)

make install (설치 하기)

 

libxml2 설치(http://xmlsoft.org/ )

 

tar ?xvzf libxml2-버전.tar.gz

./configure (설정 하기)

Make (컴파일 하기)

make install (설치 하기)


:
Posted by sfeg