-
Centos 서버 구축하기Full-Stack/Back-end 2009. 1. 19. 22:551. Centos 5.2 설치하기
파티션은 각 서버의 역할에 맞게 정한다
참고문서 http://fillgun.tistory.com/33
2. 설치가 완료되면 커널 업데이트를 한다
콘솔에서 한글이 깨지경우
vi /etc/sysconfig/i18n
LANG="ko_KR.eucKR" 추가
명령어 : # yum update kernel kernel-devel kernel-headers
만약 업데이트가 잘되지 않는다면 아이피 설정이나 네임서버 설정의 문제이다
ip설정 : setup
네임서버설정 : vi /etc/resolv.conf
nameserver 210.94.0.73
nameserver 221.139.13.130 를 추가한다 네임서버 아이피는 검색후 등록
/etc/rc.d/init.d/network restart 인터페이스 재시작이 필요함
3.방화벽 사용 체크시 포트 열어주기
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport portnumber -j ACCEPT
service iptables stop
service iptables start
4. apache, php, mysql 설치시 필요한 패키지 설치
yum -y install gcc cpp gcc-c++ compat-gcc-34-g77 flex openssl*
yum -y install libjpeg-devel libpng-devel freetype-devel gd-devel libtermcap-devel ncurses-devel libxml2-devel libc-client-devel bzip2-devel
#yum -y install libtermcap-devel [MYSQL컴파일에_적용]
#yum -y install ncurses-devel
#yum -y install libxml2-devel [PHP컴파일에_적용]
#yum -y install openssl*
#yum -y install libc-client-devel
#yum -y install bzip2-devel
rpm -qa gcc* cpp* compat-gcc* flex* openssl*
rpm -qa libjpeg* libpng* freetype* gd-*
만약 php와 mssql 연결을 하려고 할때는 다음 문서 참고 (http://fillgun.tistory.com/38 )
5. apache, php, mysql 다운로드
서버와 관련된 프로그램 관리를 쉽게하기 위해 폴더생성
/usr/local/server -> 프로그램 설치폴더
/usr/local/server/tmp -> 다운로드폴더
apache 다운로드 http://apache.org
wget http://mirror.korea.ac.kr/apache/httpd/httpd-2.2.13.tar.gztar xvzf httpd-2.2.11.tar.gz
mysql다운로드 http://www.mysql.com (http://dev.mysql.com/downloads/mirrors.html)wget http://mysql.byungsoo.net/Downloads/MySQL-5.4/mysql-5.4.1-beta-linux-i686-glibc23.tar.gz
php 다운로드 http://php.net
wget http://kr.php.net/get/php-5.3.0.tar.gz/from/this/mirro
tar xvzf php-5.2.6.tar.gz
6. mysql 설치
사용자 추가 useradd -M -s /bin/false mysql
#pwd
/usr/local/server/tmp/mysql-5.0.67
./configure --prefix=/usr/local/server/mysql --with-charset=utf8 --with-extra-charsets=all
make && make install
정상설치가 되었는지 확인하기
ls -al /usr/local/server/mysql
환경설정파일 복사
my-huge.cnf : 메모리가 1G ~2G 사이
my-large.cnf : 메모리가 512M
my-medium.cnf : 메모리가 64~256M
my-small.cnf : 메모리가 64M 보다 작을때
#pwd
/usr/local/server/tmp/mysql-5.0.67
cp support-files/my-huge.cnf /etc/my.cnf
DB 생성하기
/usr/local/server/mysql/bin/mysql_install_db --user=mysql
디렉토리 권한설정
chown -R root.mysql /usr/local/server/mysql
chown -R mysql /usr/local/server/mysql/var
환경변수 등록하기
vi /etc/skel/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/server/mysql/bin
vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/server/mysql/bin
환경변수 바로 적용하기 - > source ~/.bash_profile
보통은 재부팅후 적용
자동실행 설정
#pwd
/usr/local/server/mysql
cp share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
등록확인
chkconfig --list | grep mysqld
mysqld 0:해제 1:헤제 2:활성 3:활성: 4:활성 5: 활성 6:해제
mysql 실행
/etc/init.d/mysqld start
root 암호설정
#pwd
/usr/local/server/mysql
mysqladmin -u root password 암호
7.apache 설치
cd /usr/local/server/tmp/httpd-2.2.11
vi /usr/local/server/tmp/httpd-2.2.11/server/mpm/prefork/prefork.c
# define DEFAULT_SERVER_LIMIT 2048 로 수정
vi /usr/local/server/tmp/httpd-2.2.11/server/mpm/worker/worker.c
# define DEFAULT_SERVER_LIMIT 512
# define DEFAULT_THREAD_LIMIT 204
./configure --prefix=/usr/local/server/apache --enable-mods-shared=all --enable-so --enable-ssl --enable-modules=ssl --enable-rewrite --with-mpm=prefork
configure: error: APR-util not found 에러시 yum install apr apr-devel apr-util
그래도 에러가 나면 강제적으로 경로 추가
--with-included-apr
make && make install
자동실행 설정
cp /usr/local/server/apache/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
2번째줄부터 추가
# 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 httpd
service httpd start
11.php설치
#pwd
/usr/local/server/tmp/php-5.2.6
./configure --with-config-file-path=/etc --prefix=/usr/local/server/php --prefix=/usr/local/server/freetds --with-apxs2=/usr/local/server/apache/bin/apxs --with-mysql=/usr/local/server/mysql --with-mysqli=/usr/local/server/mysql/bin/mysql_config --disable-debug --enable-safe-mode --enable-sockets --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-gd-native-ttf --enable-inline-optimization --enable-bcmath --with-zlib --with-jpeg-dir --with-png-dir --with-freetype-dir --with-libxml-dir --enable-exif --with-gd --with-ttf --with-gettext --enable-sigchild --enable-mbstring --with-openssl --with-imap --with-imap-ssl --with-kerberos --with-mssql=/usr/local/server/freetds
./configure \
--with-config-file-path=/etc \
--prefix=/usr/local/server/php \
--prefix=/usr/local/freetds \
--with-apxs2=/usr/local/server/apache/bin/apxs \
--with-mysql=/usr/loca/serverl/mysql \
--with-mysqli=/usr/local/server/mysql/bin/mysql_config \
--disable-debug \
--enable-safe-mode \
--enable-sockets \
--enable-sysvsem=yes \
--enable-sysvshm=yes \
--enable-ftp \
--enable-gd-native-ttf \
--enable-inline-optimization \
--enable-bcmath \
--with-zlib \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-libxml-dir \
--enable-exif \
--with-gd \
--with-ttf \
--with-gettext \
--enable-sigchild \
--enable-mbstring \
--with-openssl \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-mssql=/usr/local/server/freetds
* mssql 연결시 --prefix=/usr/local/freetds \ 추가
mssql 연결시 Directory /usr/local/server/freetds is not a FreeTDS installation directory' 에러가 나올경우
# cp /usr/local/server/tmp/freetds/include/tds.h /usr/local/freetds/include/
또는
# cp /usr/local/server/tmp/freetds/src/tds/.libs/tds.h /usr/local/freetds/include/
Could not find /usr/local/server/freetds/lib/libtds.a|so 에러시
cp /usr/local/server/tmp/freetds/src/tds/.libs/libtds.a /usr/local/freetds/lib/
cp /usr/local/server/tmp/php-5.2.3/php.ini-dist /etc/php.ini
12 apache 와 php 연결하기
vi /usr/local/server/apache/conf/httpd.conf
추가
LoadModule php5_module modules/libphp5.so
수정
<IfModule !mpm_winnt_module>
#User daemon
#Group daemon
User nobody
Group nobody
</IfModule>
수정
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
맨아래에 추가 하면 위에 두줄은 필요없음AddType application/x-httpd-php .php .html .htmDirectoryIndex index.php
아파치 재시작
service httpd restart
아파치 재시작시 /libphp5.so: cannot restore segment prot after reloc: Permission denied 에러시
chcon -t texrel_shlib_t /usr/local/server/apache/modules/libphp5.so
vi /etc/sysconfig/selinux
#SELINUX=enforcing
SELINUX=disabled
로 수정하기
13. ZendOptimizer 설치
ZendOptimizer 다운 http://zend.com
wget http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz./install.sh
댓글