글목록

2014. 1. 20.

[CentOS 6.4] httpd2.4.4 + mysql5.6.15 + php 5.5.8 컴파일설치


@ mysql /usr/local/mysql/
@ apache /usr/local/apache/
php /usr/local/php/
@ apache-log /logs/
@ db 파일 저장 위치 /usr/local/mysql/data
@ 패키지 제거 및 설치

# rpm -qa httpd php mysql
# yum remove -y httpd php mysql
# yum -y install ORBit2 PyXML a2ps acpid alsa-lib amtu aspell at atk audiofile audit-libs-python autoconf autofs automake avahi avahi-glib bc bind bind-chroot bind-libs bind-utils cairo ccid compat-libstdc++-33 conman cpp cpuspeed crash createrepo crypto-utils cryptsetup-luks cups-libs cvs cyrus-sasl-md5 cyrus-sasl-plain db4-devel dbus-python device-mapper-multipath dhcp dhcp-devel dialog dmraid dos2unix dosfstools dump e2fsprogs-devel ed eject elfutils elfutils-libs enscript expat-devel expect expect-devel expectk fetchmail file finger flex fontconfig fontconfig-devel foomatic freetype freetype-devel ftp gcc gcc-c++ gd gd-devel gd-progs gdb gdbm-devel gettext gfs2-utils glib2-devel glibc-devel glibc-headers gmp-devel gnutls gpm gtk2 hal hdparm hesiod hicolor-icon-theme imake iptraf iptstate ipvsadm irqbalance jwhois kernel-devel kernel-headers keyutils-libs-devel kpartx krb5-devel krb5-workstation ksh lcms lftp libICE libSM libX11 libX11-devel libXau libXau-devel libXcursor libXdmcp libXdmcp-devel libXext libXfixes libXft libXi libXinerama libXpm libXpm-devel libXrandr libXrender libXt libXxf86vm libaio libaio-devel libart_lgpl libbonobo libc-client libcurl-devel libdaemon libevent libfontenc libgomp libgssglue libhugetlbfs libhugetlbfs-devel libidn-devel libjpeg libjpeg-devel libmng libnl libnl-devel libpcap libpng libpng-devel libselinux-devel libselinux-python libsepol-devel libsmi libstdc++-devel libsysfs libtiff libtool libtool-ltdl libwvstreams libxml2-devel libxml2-python libxslt libxslt-python lksctp-tools logwatch lrzsz lsof m2crypto mailcap mailx make man man-pages man-pages-ko mc mcstrans mdadm memtest86+ mesa-libGL mesa-libGL-devel mgetty microcode_ctl mkbootdisk mlocate mrtg mt-st mtools mtr mutt nc ncurses-devel net-snmp-libs netpbm nfs-utils nfs-utils-lib nmap nscd nss_db ntp ntsysv numactl oddjob openssh-clients openssl-devel pam-devel pam_krb5 pam_passwdqc pam_pkcs11 pango parted parted-devel patch pax pciutils pcsc-lite perl perl-Archive-Tar perl-BSD-Resource perl-Compress-Zlib perl-DBI perl-Digest-HMAC perl-Digest-SHA1 perl-HTML-Parser perl-HTML-Tagset perl-IO-Socket-INET6 perl-IO-Socket-SSL perl-IO-Zlib perl-Net-IP perl-Net-SSLeay perl-Newt perl-Socket6 perl-String-CRC32 perl-URI perl-libwww-perl pkgconfig pm-utils postgresql-libs prelink procmail psacct psutils pulseaudio-esound-compat pyOpenSSL pykickstart pyorbit pyparted python-pyblock pyxf86config quota rdate rdist readahead rmt rpcbind rpm-build rsh rsync rusers rwho samba samba-client samba-common samba-swat sendmail sendmail-cf setools setserial setuptool shared-mime-info sip sos spamassassin squashfs-tools strace stunnel symlinks sysfsutils syslinux sysstat system-config-date system-config-firewall talk tcl tcp_wrappers tcpdump tcsh telnet telnet-server time tk tmpwatch traceroute tree ttmkfdir unix2dos unixODBC unzip usbutils usermode vconfig vim-common vim-enhanced vsftpd wget wireless-tools words xfsprogs xfsprogs-devel xinetd xorg-x11-proto-devel yp-tools ypbind ypserv zip zlib-devel GConf2 ImageMagick ImageMagick-perl avahi-libs bwidget cloog-ppl crda cryptsetup-luks-libs cups db4-cxx deltarpm desktop-file-utils device-mapper-multipath-libs dmidecode dmraid-events docbook-dtds flac foomatic-db foomatic-db-filesystem foomatic-db-ppds ghostscript ghostscript-fonts gnome-doc-utils-stylesheets gnome-python2 gnome-python2-canvas gnome-user-docs gnome-vfs2 gpm-libs groff-perl gstreamer gstreamer-tools hal-info hal-libs html2ps hunspell iw jasper-libs kpathsea lcms-libs libIDL libX11-common libXcomposite libXdamage libXdamage-devel libXext-devel libXfixes-devel libXfont libXres libXtst libXxf86vm-devel libasyncns libcanberra libcanberra-gtk2 libcom_err-devel libcroco libdrm-devel libedit libglade2 libgnomecanvas libgsf libnetfilter_conntrack libnfnetlink libnotify libogg libpaper librsvg2 libsamplerate libsndfile libtalloc libtasn1 libtdb libthai libtirpc libusb1 libvorbis libwmf-lite libwnck libxcb libxcb-devel lm_sensors-libs mesa-dri-drivers mozilla-filesystem mpfr mrtg-libs netpbm-progs notification-daemon ntpdate openjpeg-libs pcsc-lite-libs perl-Compress-Raw-Zlib perl-Crypt-OpenSSL-Bignum perl-Crypt-OpenSSL-RSA perl-Crypt-OpenSSL-Random perl-Date-Manip perl-Digest-SHA perl-Encode-Detect perl-ExtUtils-MakeMaker perl-ExtUtils-ParseXS perl-IO-Compress-Base perl-IO-Compress-Zlib perl-Mail-DKIM perl-MailTools perl-Module-Pluggable perl-Net-DNS perl-Net-LibIDN perl-NetAddr-IP perl-Package-Constants perl-Pod-Escapes perl-Pod-Simple perl-SNMP_Session perl-Test-Harness perl-Time-HiRes perl-TimeDate perl-YAML-Syck perl-devel perl-libs perl-version pixman poppler poppler-data poppler-utils portreserve ppl psutils-perl pulseaudio pulseaudio-libs pycairo pygobject2 pygtk2 pygtk2-libglade python-decorator python-deltarpm python-slip python-slip-dbus rarian rarian-compat rtkit samba-winbind-clients setools-console setools-gui setools-libs setools-libs-tcl sgml-common sgpio sound-theme-freedesktop speex startup-notification system-config-date-docs system-config-firewall-tui tex-preview texinfo texinfo-tex texlive texlive-dvips texlive-latex texlive-texmf texlive-texmf-dvips texlive-texmf-errata texlive-texmf-errata-dvips texlive-texmf-errata-fonts texlive-texmf-errata-latex texlive-texmf-fonts texlive-texmf-latex texlive-utils tokyocabinet urlview urw-fonts usermode-gtk xcb-util xml-common xorg-x11-font-utils xulrunner xz xz-lzma-compat yelp lksctp-tools-devel apr-util apr-util-devel libtool-ltdl-devel libmcrypt libmcrypt-devel gmp mhash mhash-devel gdbm zlib curl g++ openssl bzip2-devel libc-client-devel bison system-config-securitylevel libc-client-devel


@ 기타 모듈 설치
# cd /usr/local/src
# mkdir etc
# cd etc
# wget https://lnamp-web-server.googlecode.com/files/freetype-2.4.8.tar.gz
# wget http://www.peregrinehw.com/downloads/gd/gd-2.0.33.tar.gz
# wget http://www.youtu.kr/mirror/jpegsrc.v6b.tar.gz
# wget http://sourceforge.net/projects/libpng/files/libpng15/older-releases/1.5.10/libpng-1.5.10.tar.gz 
# wget http://www.youtu.kr/mirror/imap-2004g.tar.bz2
# wget http://lnamp-web-server.googlecode.com/files/pcre-8.30.tar.gz
# wget http://heanet.dl.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
# tar zxvf freetype-2.4.8.tar.gz; tar zxvf gd-2.0.33.tar.gz; tar zxvf jpegsrc.v6b.tar.gz; tar zxvf libpng-1.5.10.tar.gz; tar jxvf imap-2004g.tar.bz2; tar zxvf pcre-8.30.tar.gz; tar zxvf libmcrypt-2.5.8.tar.gz; tar zxvf libiconv-1.14.tar.gz 
# cd /usr/local/src/etc/jpeg-6b; mkdir -p /usr/local/libjpeg/bin; mkdir -p /usr/local/libjpeg/man/man1; make clean;make -j4; make install; cp -f libjpeg.a /usr/local/lib; cp -f *.h /usr/include 
# cd /usr/local/src/etc/libpng-1.5.10 
# cp scripts/makefile.linux Makefile 
# make clean;make -j4;make install 
# cd /usr/local/src/etc/freetype-2.4.8 
# make clean;./configure --prefix=/usr/local/freetype;make -j4;make install 
# cd /usr/local/src/etc/gd-2.0.33 
# make clean;./configure --prefix=/usr/local/gd;make -j4;make install 
# cd /usr/local/src/etc/imap-2004g 
# make clean;make slx SPECIALS="SSLDIR=/usr SSLINCLUDE=/usr/include SSLLIB=/usr/lib" 
# cd /usr/local/src/etc/imap-2004g/c-client 
# cp -f c-client.a /usr/lib; cp -f rfc822.h mail.h linkage.h /usr/include 
# cd /usr/local/src/etc/pcre-8.30 
# make clean;./configure --prefix=/usr/local;make -j4;make install 
# cd /usr/local/src/etc/libmcrypt-2.5.8 
# make clean;./configure --prefix=/usr/local;make -j4;make install 
# cd /usr/local/src/etc/libiconv-1.14 
# make clean;./configure --prefix=/usr/local;make -j4;make install 
# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2 


@ cmake 설치
# cd /usr/local/src
# wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
# tar zxvf cmake-2.8.7.tar.gz
# cd cmake-2.8.7
# ./bootstrap
# make; make install

 


@ mysql 설치 5.6.15
# cd /usr/local/src/
# wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz
# tar zxvf mysql-5.6.15.tar.gz
# cd mysql-5.6.15
# cmake -DCMAKDE_INSTALL_PREFIX=/usr/local/mysql -DWITH_EXTRA_CHARSETS=all -DMYSQL_DATADIR=/usr/local/mysql/data -DEFAULT_CHARSET=utf8
# make; make install
# groupadd mysql
# useradd -M -o -r -d /usr/local/mysql -s /sbin/nologin -c "Mysql Server" -u 27 -g mysql mysql >/dev/null 2>&1 || :
# chown -R root:mysql /usr/local/mysql; chown -R mysql:mysql /usr/local/mysql/data
# cd /usr/local/mysql; ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
@ 비밀번호 설정
# cp support-files/mysql.server /etc/init.d/mysqld
# cp support-files/my-default.cnf /etc/my.cnf
# vi /etc/init.d/mysqld ##### datadir 찾아서 datadir=/usr/local/mysql/data 라고 입력 ( 찾을때는 /datadir, 다음찾기 n )
# service mysqld start
# chkconfig --add mysqld
# chkconfig --level 35 mysqld on (런레벨 35일때 자동 실행 된다)
# chkconfig --list | grep mysqld
@ 리부팅시 서비스 실행하지 않으려면 - chkconfig mysqld off
# /usr/local/mysql/bin/mysqladmin -u root password
설치 작업이 끝났다면 익명접근권한을 삭제하자. ( mysql 콘솔에 그냥 접근을 못하게 해야 함.)
# /usr/local/mysql/bin/mysql -u root -p
# Enter password:
# mysql> USE mysql;
# mysql> delete from user where password = "";
# mysql> exit
# /usr/local/mysql/bin/mysqladmin -u root -p reload
# Enter password:

@ cronolog 설치(apache log 분할)
# cd /usr/local/src
# wget http://www.youtu.kr/mirror/cronolog-1.6.2.tar.gz
# tar xvf cronolog-1.6.2.tar.gz
# cd cronolog-1.6.2
# ./configure
# make;make install
@ 아파치 설치전 apr 설치
#cd /usr/local/src
# wget http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz
# wget http://archive.apache.org/dist/apr/apr-util-1.4.1.tar.gz
# tar zxvf apr-1.4.6.tar.gz
# cd /usr/local/src/apr-1.4.6
# ./configure --prefix=/usr/local/apr
# make;make install
# cd /usr/local/src
# tar zxvf apr-util-1.4.1.tar.gz
# cd /usr/local/src/apr-util-1.4.1
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make;make install


@ 아파치 설치 2.4.4
# cd /usr/local/src
# wget http://archive.apache.org/dist/httpd/httpd-2.4.4.tar.gz
# tar zxvf httpd-2.4.4.tar.gz
# cd httpd-2.4.4
# make clean
# vi /usr/local/src/httpd-2.4.4/server/mpm/prefork/prefork.c
@ #define DEFAULT_SERVER_LIMIT 256  ##ulimit -a max user processes 값을 넘지 않도록 256의 배수만큼 주정해준다. Ex) 32768
# ./configure --prefix=/usr/local/apache --enable-rule=SHARED_CORE --enable-so --enable-rewrite --enable-vhost-alias --enable-ssl --enable-proxy --enable-shared=max --enable-modules=shared --enable-mods-shared=all --with-mpm=prefork --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
# make; make install
# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
@ chkconfig를 이용해서 자동실행 등록해야 하지만 이전에 실행 스크립트 파일에 아래 내용 추가가 선행되어야 한다.
# vi /etc/init.d/httpd
-httpd 파일
#chkconfig: 2345 90 90
#description: init file for Apache server daemon
#processname: /usr/local/apache/bin/apachectl
#config: /usr/local/apache/conf/httpd.conf
#pidfile: /usr/local/apache/logs/httpd.pid
이를 추가한다.
# chkconfig --add httpd
# chkconfig --list | grep httpd
# /etc/init.d/httpd start

@ 아파치 설정
# vi /usr/local/apache/conf/httpd.conf 


 
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all



ServerName localhost:80
서버관리자 메일주소 설정
ServerAdmin webmaster@localhost

웹 페이지 접속시 기본적으로 읽어 들일 파일명 설정
DirectoryIndex index.html 를 찾아 DirectoryIndex index.jsp index.php index.php3 index.html index.htm index.cgi로 수정
아래와 같이 추가 합니다.
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

### PHP 설치 후 없다면 추가
AddType application/x-httpd-php .htm .html .php .ph php3 .php4 .phtml .inc -->추가
AddType application/x-httpd-php-source .phps -->추가
LoadModule php5_module        modules/libphp5.so -->PHP 설치 후 없다면 추가

주석제거
# AddHandler cgi-script .cgi
몇가지 주석 및 제거 - 필요에 따라 더 적용해도 무방함
LoadModule vhost_alias_module modules/mod_vhost_alias.so 
LoadModule userdir_module modules/mod_userdir.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so 
Include conf/extra/httpd-mpm.conf 
Include conf/extra/httpd-userdir.conf 
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-default.conf


#vi /usr/local/apache/conf/extra/httpd-userdir.conf
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 를
Options MultiViews SymLinksIfOwnerMatch IncludesNoExec 로
Indexes 를 삭제 한다.

#vi /usr/local/apache/conf/extra/httpd-vhosts.conf

모두 주석 처리하고 아래 서버 localhost 경로를 추가 한다


  DocumentRoot /usr/local/apache/htdocs/


#service httpd restart
@ 접속이 안될경우 80포트 열어 주어야 한다.
#vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT =>추가
# /etc/init.d/iptables restart 또는 service iptables restart

@ PHP 설치
# cd /usr/local/src

# wget http://kr1.php.net/get/php-5.5.8.tar.gz/from/this/mirror
# tar zxvf php-5.5.8.tar.gz
# cd php-5.5.8
# make clean
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --with-gd --with-freetype-dir=/usr/local/freetype --with-zlib --enable-sockets --enable-gd-native-ttf --with-png-dir=/usr/local/lib --with-jpeg-dir=/usr/local/lib --enable-sigchild --enable-magic-quotes --with-gettext --enable-mbstring --enable-inline-optimization --enable-bcmath --enable-shmop --enable-calendar --enable-ftp --with-gdbm --with-iconv=/usr/local --enable-mbregex --with-imap --with-imap-ssl --with-openssl --with-curl --enable-soap --disable-debug --with-mcrypt=/usr/local/libmcrypt --with-kerberos --with-mysqli=/usr/local/mysql/bin/mysql_config
# make -j4; make install 
# cp php.ini-production /usr/local/lib/php.ini


# vi /root/.bash_profile
PATH=$PATH:$HOME/bin 를
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/apache/bin:/usr/local/php/bin 로 수정
service httpd restart


@ php.ini 설정
# vi /usr/local/lib/php.ini
memory_limit = 128M  (썸네일 생성이 안될 시에는 32M이상 설정하세요.)
register_globals = Off
post_max_size = 100M
file_uploads = On
upload_max_filesize = 100M
allow_url_fopen = Off
allow_url_include = Off
short_open_tag = On
disable_functions = exec,passthru,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
자주 살펴보는 파일은 심볼릭 링크를 설정해서 /root/conf 파일에 모아두자
# mkdir /root/conf
# cd /root/conf
# ln -s /usr/local/lib/php.ini /root/conf/php.ini
# ln -s /usr/local/apache/conf/httpd.conf /root/conf/httpd.conf
# ln -s /usr/local/apache/conf/extra/httpd-vhosts.conf /root/conf/httpd-vhosts.conf
# ln -s /etc/my.cnf /root/conf/my.cnf


 php test 페이지



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

### APACHE ###
 APACHE_HOME=/usr/local/apache

### MYSQL  ###
MYSQL_HOME=/usr/local/mysql


###JAVA###
export  JAVA_HOME=/usr/local/java/jdk
export  JRE_HOME=/usr/local/java/jdk/jre
export  PATH=$PATH:$JAVA_HOME/bin

###TOMCAT###

export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:$CATALINA_HOME/bin
CATALINA_LIB=$CATALINA_HOME/lib


PATH=$PATH:$JAVA_HOME/bin:$APACHE_HOME/bin:$MYSQL_HOME/bin:$CATALINA_HOME/bin:

CLASSPATH=./:$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/jre/lib/ext:$CATALINA_LIB/servlet-api.jar:$CATALINA_LIB/urlrewritefilter-4.0.3.jar:$CATALINA_LIB/commons-collections4-4.0.jar:$CATALINA_LIB/tomcat-dbcp.jar:$CATALINA_LIB/jimi.jar


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

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

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

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

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

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

libxm12
  XML C parser

MYSQL
  MYSQL 데이터베이스 DBMS

APACHE
  아파치 어플리케이션

PHP
  PHP 인터프리터

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

댓글 없음:

댓글 쓰기