CentOS 4.4에서 Apache + Mysql + PHP 컴파일 해서 깔기
우선
rpm -qa | grep mysql
rpm -qa | grep httpd
rpm -qa | grep php
에 나온 리스트를 몽땅 지운다.
1. MySQL 컴파일 하기
MySQL사이트 다운로드 하기 (http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.33.tar.gz/from/http://mysql.holywar.net/)
[root@localhost /] CC=gcc CXX=gcc ./configure --prefix=/usr/local/mysql --with-charset=euckr --without-debug
(CC=gcc CXX=gcc ./configure --prefix=/usr/local/mysql --with-charset=euckr --without-debug --with-example-storage-engine --with-archive-storage-engine --with-csv-storage-engine --with-blackhole-storage-engine --with-federated-storage-engine)
[root@localhost /] make
[root@localhost /] make install
[root@localhost /] groupadd mysql
[root@localhost /] adduser mysql –g mysql
[root@localhost /] ./scripts/mysql_install_db
[root@localhost /] chown -R mysql:mysql /usr/local/mysql
[root@localhost /] chmod 766 -R /usr/local/mysql/var
[root@localhost /] cd /usr/local/src/mysql-5.1.XX
[root@localhost /] cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost /] su - mysql
[root@localhost /usr/local/mysql] cd bin
[root@localhost /usr/local/mysql/bin] ./mysqld_safe --user=mysql &
[root@localhost /usr/local/mysql/bin] ps -ef|grep mysqld
mysql 21810 21786 0 05:38 pts/0 00:00:00 /bin/sh ./mysqld_safe --user=mysql
mysql 21832 21810 0 05:38 pts/0 00:00:00 /usr/local/mysql//libexec/mysqld --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql//var --pid-file=/usr/local/mysql//var/localhost.localdomain.pid --skip-external-locking --port=3306 --socket=/tmp/mysql.sock
[root@localhost /usr/local/mysql/bin] ./mysqladmin -u root password 123456
[root@localhost /usr/local/mysql/bin] ./mysqladmin -u root -p reload
Enter password:
삭제하기
make uninstall
2. apache 2.2.X 컴파일 방법
CC="mgcc" CFLAGS="-O2" \
./configure --prefix=/usr/local/httpd \
--enable-rewrite=shared \
--enable-speling=shared
make
make install
vi /usr/local/httpd/conf/httpd.conf 수정
가동하기
/usr/local/httpd/bin/apachectl start
정지하기
/usr/local/httpd/bin/apachectl start
3. php.5.2.0 컴파일 방법
yum install libjpeg-devel
yum install libpng-devel
./configure \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-zlib --with-gd --with-ttf --with-png \
--with-expat-dir=/usr --with-gmp --with-xml \
--with-mysql=/usr/local/mysql \
--with-language=korean \
--with-charset=euc_kr \
--disable-debug --disable-posix --disable-rpath \
--enable-safe-mode --enable-magic-quotes \
--disable-dmalloc --enable-bcmath \
--enable-dio --enable-gd-native-ttf \
--enable-sysvsem --enable-sysvshm \
--enable-wddx --enable-versioning \
--enable-pic --enable-inline-optimization \
--enable-memory-limit --enable-mbstring \
--enable-mbregex --enable-mbstr-enc-trans \
--with-config-file- --enable-ftp --disable-debug --enable-track-vars=yes \
--with-jpeg-dir \
--enable-gd-native-ttf --enable-dl
make
make install
php.ini 설정
cp php.ini-dist /usr/local/lib/php.ini
PHP 옵션을 설정하기 위해 .ini를 수정할 수 있습니다. php.ini를 다른
위치에 놓기를 원한다면, ./configure 단계에서 --with-config-file-path=/some/path를 사용하십시오.
php.ini-recommended를 선택한다면, 안에 쓰여있는 변경점을 주의깊게 읽어보십시오. 그 옵션들은 PHP의 작동에 영향을 미칩니다.
http.conf 수정
PHP 4는:
LoadModule php4_module libexec/libphp4.so
PHP 5는:
LoadModule php5_module libexec/libphp5.so
ntsysv에 httpd와 mysqld 등록하기
mysql:
#]cp /usr/local/src/mysql/support-files/mysql.server /etc/init.d/mysqld
#]chmod +x mysqld
#]chkconfig --add mysql
apache:
#]head -7 network >> httpd
#]cp /usr/local/httpd/bin/apachectl /etc/inti.d/httpd
#]chkconfig --add httpd
이렇게 하면 추가되어 진다. 디렉토리를 설치디렉토리이거나 소스 디렉토리 이건 알겠지 ㅎㅎ
Junios World