http 2.2.22, mysql 5.5.20, php 5.3.10 소스 컴파일 설치를 해보았습니다.
@ 설치경로는 아래와 같으니 참조 하시길....
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
@ 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.5.20
# yum remove mysql
# cd /usr/local/src
# wget http://www.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.27.tar.gz/from/http://mirror.khlug.org/mysql/
http://www.mysql.com/downloads/mysql/ 에서 Source Code 중,
Generic Linux (Architecture Independent), Compressed TAR Archive 최신버전을 Download 수행한다.
# tar zxvf mysql-5.5.27.tar.gz (최신버전)
# cd mysql-5.5.27 (최신버전)
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DENABLED_LOCAL_INIFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DWITH_SSL=system -DWITH_ZLIB=system -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_VALGRIND=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_DATADIR=/usr/local/mysql/data
# 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-huge.cnf /etc/my.cnf --> 메모리 1G 이상
# cp support-files/my-medium.cnf /etc/my.cnf
# vi /etc/init.d/mysqld ##### datadir 찾아서 datadir=/usr/local/mysql/data 라고 입력
# 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:
root 비밀번호를 잊어버린 경우,
$ mysql -u root
Error 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
위와 같은 에러가 난다면, mysql password를 재설정 해야한다.
(RHEL 5.6 환경)
# killall mysqld
# service mysqld stop
# cd /usr/bin
# mysqld_safe --skip-grant-tables
실행 후에 다른 터미널에서 아래를 수행한다.
# mysql
mysql> use mysql;
mysql> UPDATE user SET password=PASSWORD('newpassword') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
# /usr/local/mysql/bin/mysql -u root -pmysql> exit;
기존 터미널로 돌아와서 [Ctrl]+z를 누른 후에
# ps -ef | grep mysql
수행하여 수행되고 있는 모든 프로세스를
# kill -9 프로세스번호
수행하여 강제종료 시킨 후에 아래와 같이 mysql을 다시 시작한다.
# service mysqld start
지정한 password를 phpMyAdmin 등을 사용하여 (사용을 위해 지정한 도메인명 등으로) 로그인하면 정상 접근된다.
참고로, user에 대한 정보는 /usr/local/mysql/data/mysql 디렉토리의 아래의 같은 3개의 파일에 저장되는데,user.frm
user.MYD
user.MYI
정상처리된 파일을 백업하여 두었다가 문제가 발생할 경우, 덮어쓰기를 수행하여 복구하는 것도 한가지 방법일 것이다.
만약, 위와 같은 처리 후에도 정상 start 시에 로그인이 불가하여, mysql을 완전히 제거 후에 재설치를 원할 경우,
# yum remove mysql 을 수행 후에
반드시, /usr/local의 mysql 디렉토리를 통째로 삭제 후에 재설치를 수행해야 한다.
@ 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
@ 아파치 설치 2.2.21
# cd /usr/local/src
# wget http://mirror.khlug.org/apache//httpd/httpd-2.2.22.tar.gz
# wget http://linux-files.com/httpd/httpd-2.2.22.tar.gz
# tar zxvf httpd-2.2.22.tar.gz
# cd httpd-2.2.22
# make clean
# vi server/mpm/prefork/prefork.c
@ #define DEFAULT_SERVER_LIMIT 256 부분을 :sh 명령으로 잠시 나가서
# ulimit -a max user processes 를 수행하여
위의 해당 값을 확인하여 설정된 값을 넘지 않도록 256의 배수만큼 수정 후, 저장해준다. Ex) 1024
<주의> 2.4부터 변경된 부분은 apr과 apr-util을 별도로 다운 받아야 함. 그전에는 apr과 apr-util이 포함되어 있었음.
- Apache HTTP Server : http://httpd.apache.org/download.cgi
- APR & APR-util : http://apr.apache.org/download.cgi
apr & apr-util copy
prompt> cp -R ./apr-1.4.6 ./httpd-2.4.1/srclib/apr |
# ./configure --prefix=/usr/local/apache --enable-shared=max --enable-rule=SHARED_CORE --enable-so --enable-rewrite --enable-ssl --enable-proxy --enable-modules=all
configure
- apr & apr-util을 별도로 설치해서 사용할 경우,
옵션으로 "--with-apr=apr 설치 디렉토리 --with-apr-util=apr-util 설치 디렉토리" 사용
prompt> cd httpd-2.4.1 |
# ./configure --prefix=/usr/local/apache --enable-shared=max --enable-rule=SHARED_CORE --enable-so --enable-rewrite --enable-ssl --enable-proxy --enable-modules=so --enable-mpms-shared=all --with-included-apr
# make; make install
# /usr/local/apache/bin/apachectl -l
Compiled in modules:
core.c
mod_so.c
http_core.c
event.c
# 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 를 실행했을 때,
httpd: Syntax error on line 144 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/mod_mpm_event.so into server: /usr/local/apache/modules/mod_mpm_event.so: cannot open shared object file: No such file or directory
와 같은 오류가 발생하는 경우, 해당 라인으로 이동(:144)하여 주석처리 후 재실행 하되,
AH00557: httpd: apr_sockaddr_info_get() failed for 도메인명
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
와 같은 오류가 추가로 발생하는 경우,
# cd /etc
# cp hosts hosts.old 를 수행하여 백업하고,
# vi hosts 를 수행하여,
127.0.0.1 localhost.localdomain localhost 도메인명
서버에할당된주소 도메인주소
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
로 수정하고 저장한 후,
# /etc/init.d/httpd start 를 실행하면 정상 수행되어야 한다.
@ 접속이 안될경우 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
@ 기타 모듈 설치
# cd /usr/local/src
# mkdir etc
# cd etc
# wget http://download.savannah.gnu.org/releases/freetype/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/1.5.9/libpng-1.5.9.tar.gz
# wget http://www.youtu.kr/mirror/imap-2004g.tar.bz2
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/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.9.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.9
# 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
@ PHP 설치
# yum install net-snmp net-snmp-devel
# yum -y install libjpeg-devel libpng-devel freetype-devel gd-devel libtermcap-devel ncurses-devel libxml2-devel libc-client-devel bzip2-devel
# rpm -qa gcc* cpp* compat-gcc* flex* openssl*
# rpm -qa libjpeg* libpng* freetype* gd-*
# cd /usr/local/src
# wget http://kr2.php.net/get/php-5.3.10.tar.gz/from/kr.php.net/mirror
# tar zxvf php-5.3.10.tar.gz
# cd php-5.3.10
# 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 --with-pdo-mysql=/usr/local/mysql --enable-mod-charset --enable-safe-mode --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-snmp --with-zlib-dir --with-ttf --enable-exif --with-xpm-dir --with-libxml-dir --with-pcre-dir --with-ncurses --enable-sqlite-utf8 --with-regex=php --with-bz2
...
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
--with-ncurses
위와 같이 표시되어야 정상수행된 것입니다. 확인하시기 바랍니다.
# make -j4; make install
# cp php.ini-production /usr/local/lib/php.ini --> 5.3.0 이후 버전
# vi /usr/local/apache/conf/httpd.conf
KeepAlive ON
주석을 해제하고 서버이름이나 IP주소를 설정합니다.
ServerName localshot:80
서버관리자 메일주소 설정
ServerAdmin webmaster@localhost
인터넷주소 rewrite 모드 사용을 위한 설정
AllowOverride None –> AllowOverride All
웹 페이지 접속시 기본적으로 읽어 들일 파일명 설정
DirectoryIndex index.html 를 찾아 DirectoryIndex index.html index.htm index.php index.php3 index.cgi index.jsp 로 수정
아래와 같이 추가 합니다.
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .htm .html .php .ph php3 .php4 .phtml .inc -->추가
AddType application/x-httpd-php-source .phps -->추가
주석제거
# AddHandler cgi-script .cgi
몇가지 주석 및 제거 - 필요에 따라 더 적용해도 무방함
Include conf/extra/httpd-mpm.conf <-- 주석제거
Include conf/extra/httpd-userdir.conf <-- 주석제거
Include conf/extra/httpd-vhosts.conf <-- 주석제거
Include conf/extra/httpd-default.conf <-- 주석제거
<Directory />
Options FollowSymLinks
AllowOverride All <-- 수정
Order deny,allow
#Deny from all <-- 주석처리
</Directory>
#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
내용을 모두 삭제하고 구문만 적용후 저장 - 저장방법은 :wq 인 것은 아시죠...^^
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /usr/local/apache/htdocs/
ServerName *
</VirtualHost>
#NameVirtualHost *:80
# vi /root/.bash_profile
PATH=$PATH:$HOME/bin 를
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/apache/bin:/usr/local/php/bin 로 수정
@ php.ini 설정
# vi /usr/local/lib/php.ini
post_max_size = 100M (Default: 8M)
file_uploads = On
upload_max_filesize = 100M (Default: 2M)
allow_url_fopen = Off (Default: On)
allow_url_include = Off
short_open_tag = On (Default: Off)
disable_functions = exec,passthru,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source
(Default: disable_functions =)
LoadModule userdir_module /etc/httpd/modules/mod_userdir.so 부분의 주석을 제거
# ntsysv <--- 서비스 상태확인
# reboot <-- 설정을 마치면 한번쯤 리부팅 해 주세요...^^
'Linux > CentOS' 카테고리의 다른 글
Adding Modules to httpd.conf With Apache 2 (0) | 2012.03.08 |
---|---|
CentOS 6.3 APM 설치 (0) | 2012.03.07 |
웹서버 세팅에 관한 문서2 (0) | 2012.03.06 |
웹서버 세팅에 관한 문서1 (0) | 2012.03.06 |
CentOS phpMyAdmin 설치 (0) | 2012.03.05 |