테스트 사이트 - 개발 중인 베타 버전입니다

CentOS 5.5 + httpd-2.2.17 + MySql 5.0.92+ php 5.2.16 소스 컴파일 설치

· 14년 전 · 4312 · 7
Centos 5.5 linux text 로 설치후

APM 소스 컴파일로 설치를 진행해 보자

기존에 설치된 http 또는 mysql을 삭제 하자

[root@localhost]# yum -y remove httpd* php* mysql*


APM 설치전에 필수 라이브러이 먼저 설치
[root@localhost]# yum -y install gcc gcc-c++ compat-gcc-34-g77 flex openssl* termcap libtermcap libtermcap-devel gdbm-devel gd* php-gd zlib* pam* curl* pid* libiconv libmcrypt* libmhash libxml* freetype* ncurses* libpng* libjpeg* bzip2-devel openldap-devel libc-client-devel php5-dev

[ APM 다운로드 ]

[root@localhost]# cd /usr/local/src

[root@localhost src]# wget http://download.softagency.net/MySQL/Downloads/MySQL-5.0/mysql-5.0.92.tar.gz

[root@localhost src]# wget http://apache.naggo.co.kr/httpd/httpd-2.2.17.tar.gz

[root@localhost src]# wget http://kr2.php.net/get/php-5.2.16.tar.gz/from/kr.php.net/mirror

[ APM 설치 ]

- MySQL 설치

[root@localhost src]# tar xvzf mysql-5.0.92.tar.gz
[root@localhost src]# cd mysql-5.0.92

[root@localhost src]# ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-charset=utf8 --with-mysql-user=mysql --with-extra-charsets=all --enable-thread-safe-client --enable-large-files --with-readline --with-innodb --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --without-debug --without-docs

[root@localhost src]# make && make install

[root@localhost src]# groupadd mysql
[root@localhost src]# useradd -M -o -r -d /usr/local/mysql -s /sbin/nologin -c "Mysql Server" -u 27 -g mysql mysql >/dev/null 2>&1 || :

[root@localhost src]# chown -R root:mysql /usr/local/mysql
[root@localhost src]# /usr/local/mysql/bin/mysql_install_db
[root@localhost src]# chown -R mysql:mysql /usr/local/mysql/data
[root@localhost src]# /usr/local/mysql/bin/mysqld_safe &
[root@localhost src]# /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
[root@localhost src]# echo /usr/local/mysql/lib/mysql >> /etc/ld.so.conf && ldconfig
[root@localhost src]# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
[root@localhost src]# chkconfig --add mysqld
[root@localhost src]# chkconfig --level 35 mysqld on (런레벨 35일때 자동 실행 된다)
[root@localhost src]# chkconfig --list | grep mysqld
[root@localhost src]# /etc/init.d/mysqld start

마지막으로 익명접근권한을 삭제하자.. mysql 콘솔에 그냥 접근을 못하게 해야 한다.

root 권한으로 접근하여.. mysql 데이터베이스를 선택한 후 다음 쿼리문을 실행한다.

USE mysql;
delete from user where password = "";

그 후에 mysql을 재시작 한다 일단은 콘솔을 종료하고... 쉘에서..

mysqladmin -u root -p reload
password

다음은 설치파일의 support-files폴더에 있는 my.cnf파일을 복사한다.

cp /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf #### my-huge.cnf (메모리1~2Gbyte)
cp /usr/local/mysql/share/mysql/my-large.cnf /etc/my.cnf #### my-large.cnf (메모리512Mbyte)
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf #### my-medium.cnf (메모리64M~256Mbyte)
cp /usr/local/mysql/share/mysql/my-small.cnf /etc/my.cnf #### my-small.cnf (메모리 64Mbyte보다 작을때)




- Apache 2 설치
[root@localhost src]# tar xvzf httpd-2.2.17.tar.gz
[root@localhost src]# cd httpd-2.2.17

configure 는 아래 둘 중 하나만 사용....^^
[root@localhost src]# ./configure --prefix=/usr/local/apache2 --enable-module=so --with-mpm=worker --enable-dav --enable-so --enable-rewrite --enable-dav=shared --enable-dav-fs=shared --with-included-apr

[root@localhost src]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-auth-digest --enable-authn-dbm --enable-authn-dbd --enable-authz-dbm --enable-dav --enable-dav-fs --enable-dav-lock --enable-deflate --enable-headers --enable-expires --enable-dbd --enable-dumpio --enable-log-forensic --enable-rewrite --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache --enable-unique-id --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-ssl --with-z=/usr/local --with-ssl=/usr/local/ssl --with-mpm=worker

[root@localhost src]# make && make install

[root@localhost src]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
[root@localhost src]# cd /etc/rc.d/init.d
[root@localhost src]# head -7 network >> httpd
[root@localhost src]# chkconfig --add httpd
[root@localhost src]# ntsysv (httpd 서비스 추가여부 확인)
[root@localhost src]# service httpd start
[root@localhost src]# service httpd restart

아파치 환경설정은 /usr/local/apache2/conf/httpd.conf 에서 하면 된다.
환경설정은 APM 설치후 따로 진행 하겠슴다.


- PHP 5.2.16 설치
[root@localhost src]# tar xvzf php-5.2.16.tar.gz
[root@localhost src]# cd php-5.2.16

[root@localhost src]# ./configure --prefix=/usr/local/php --with-libdir=lib --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --with-gd --with-ttf --with-png --with-expat-dir=/usr --with-gmp --with-xml --with-charset=utf_8 --disable-debug --disable-rpath --with-iconv --enable-mailparse --enable-safe-mode --enable-magic-quotes --enable-bcmath --enable-dio --enable-gd-native-ttf --enable-sysvsem --enable-sysvshm --enable-wddx --enable-pic --enable-inline-optimization --enable-mbstring --enable-mbregex --enable-mbstr-enc-trans --with-config-file- --enable-ftp --disable-debug --enable-track-vars=yes --with-jpeg-dir --with-freetype-dir --enable-gd-native-ttf --enable-dl --enable-gd-imgstrttf --with-curl --with-xml2 --with-xpm-dir=/usr --with-mcrypt --enable-exif --with-openssl --enable-soap

[root@localhost src]# make && make install

[root@localhost src]# cp /usr/local/src/php-5.2.16/php.ini-dist /usr/local/php/lib/php.ini
[root@localhost src]# vi /usr/local/php/lib/php.ini (PHP 설정)
-> post_max_size=적정수M (적당한 값)
-> upload_max_filesize = 적정수m (적당한 값 ,한번에 올리는 업로드 용량조정)
-> 검색을 통해서 설정방법을 터득하여 수정하세요...^^

[root@localhost src]# vi /usr/local/apache2/conf/httpd.conf
-> LoadModule php5_module modules/libphp5.so (확인)


APM 설치가 끝났다 그런데 몇가지 수정을 해주어야 정상적으로 작동을 한다.
httpd.conf 를 수정해 주어야 한다.

[root@localhost src]# vi /usr/local/apache2/conf/httpd.conf

httpd.conf 를 열고

DirectoryIndex index.html 를 찾아 DirectoryIndex index.html index.htm index.php index.php3 index.cgi index.jsp 로 수정

359번째줄의
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
를 아래와 같이 추가 수정 한다.
AddType application/x-compress .Z
AddType application/x-httpd-php .php4 .php3 .php .htm .html .phtml .ph .inc
AddType application/x-httpd-php-source .phps
AddType application/x-gzip .gz .tgz

몇가지 주석 및 제거 - 필요에 따라 더 적용해도 무방함
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 None
Order deny,allow
#Deny from all <-- 주석처리
</Directory>

[root@localhost src]# vi /usr/local/apache2/conf/extra/httpd-userdir.conf

Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 를
Options MultiViews SymLinksIfOwnerMatch IncludesNoExec 로
Indexes 를 삭제 한다.

[root@localhost src]# vi /usr/local/apache2/conf/extra/httpd-vhosts.conf

내용을 모두 삭제하고 아래 문구 만 적용후 저장 - 저장방법은 :wq 인 것은 아시죠...^^

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /usr/local/apache2/htdocs/
ServerName *
</VirtualHost>


[root@localhost src]# vi /root/.bash_profile

PATH=$PATH:$HOME/bin 를
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/apache2/bin 로 수정


이제 APM 작업이 모드 끝났으니
service httpd restart
service mysqld restart
실행하고 서버 테스트를 해보자....^^

위의 작업이 끝난후에도 아래와 같이

리눅스 자체 방화벽(iptables) 최적화 및 ModSecurity 웹방화벽 설치, OpenSSH Chroot 적용, Bind + vsftp + Qmail or Sendmail + Webmail, 포트모니터링, 트래픽 모니터링, 웹로그 분석기, 장애 모니터링, phpmyadmin, WebFTP, 호스팅 컨트롤 판넬 등......

아직 설치 및 설정 할 것이 많이 있다는....에효~~~~

더 많은 정보는 블로그에 포스트 합니다.

퍼가시는것은 자유이나 출처는 남겨 주세요....^^<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:32:05 Linux에서 이동 됨]</div>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 7개

혹시 ssh 상위폴더 제한 하는거 정보 좀 가지고 있으신지요?
/home/1,2,3,4,5

이렇게 서비스가 되고 있을때,

1의 서비스 받는 유저가 /home 의 디렉토리를 못보게 할려면?

chmod 711 /home 하면 됩니다.

웹페이지 서비스에는 지장이 없습니다.
14년 전
도움 많이 되었습니다
APM 설치 후에...

yum -y install yum-fastestmirror

이거 한번씩들 하세요 가까운 미러 사이트 자동으로 갱신해줍니다
14년 전
다시 php에 발을 담그는데 많은 도움이 되네요...감사합니다.^^
이 버젼대로 하면 그누보드 설치 가능할까요??
네 설치해서 잘 쓰고 있습니다....^^

게시글 목록

번호 제목
20318
20317
20316
20315
20314
20313
20312
20311
20310
20309
20308
20307
20306
20303
20302
20301
20300
20299
20298
20297
20296
20295
20294
20293
20292
8222
20291
20290
20289
20288
20287
20286
20285
20284
20283
20282
20281
20280
20276
20275
20274
20273
8216
20272
20271
20270
20269
20268
20267
20265
20264
20263
20262
20261
20259
20258
20257
20256
20255
20254
20253
20252
20251
20250
20249
31028
20248
20247
20246
8215
20245
20244
20243
20242
20241
20240
20239
20238
20237
20236
20235
20234
20233
8197
20232
20231
20230
20229
20228
20227
20225
20224
20223
20222
20221
20220
20219
20218
20217
20216