본문으로 바로가기

서버 재설치 2

category 일상생활/우리들의 이야기 2009. 7. 27. 12:55
 한글 설정
vi /etc/sysconfig/i18n
LANG="ko_KR.eucKR"
SUPPORTED="en_US.iso885915:en_US:en:ko_KR.eucKR:ko_KR:ko"
SYSFONT="lat0-sun16"
SYSFONTACM="iso15"
# 매뉴얼 설정 수정
vi /etc/man.config
수정
PAGER /usr/bin/less -isr
--------------------------> 위 두가지 한글 설정은 터미널이나 기타부분에서 한글깨짐현상을 고치기 위해서다
# 디렉토리 색상 수정
vi /etc/DIR_COLORS.xterm
수정
DIR 00;33


==================================================================
서버 설치전 기본 유틸리티 설치와 설정 

# yum -y install gcc cpp gcc-c++ compat-gcc-32-g77 flex libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel



# zlib 소스 설치
cd /usr/local/src
wget 
http://www.zlib.net/zlib-1.2.3.tar.bz2
tar xfj zlib-1.2.3.tar.bz2
cd zlib-1.2.3
make
make install

# freetype 2 설치
#글짜를 그릴 때 쓰는 라이브러리 입니다.

cd /usr/local/src
wget 
http://ftp.superuser.co.kr/pub/etc/freetype-2.1.5.tar.gz
tar xvfz freetype-2.1.5.tar.gz
cd freetype-2.1.5
./configure
make
make install

# openssl 소스 설치
cd /usr/local/src
wget 
http://www.openssl.org/source/openssl-0.9.8a.tar.gz
tar xfz openssl-0.9.8a.tar.gz
cd openssl-0.9.8a
./config
make
make install


# curl 소스 설치
cd /usr/local/src
wget 
http://curl.haxx.se/download/curl-7.15.1.tar.bz2
tar xfj curl-7.15.1.tar.bz2
cd curl-7.15.1
./configure --with-ssl
make
make install

# gd lib 설치
cd /usr/local/src
wget 
http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
tar xfz gd-2.0.33.tar.gz
cd gd-2.0.33
./configure
make
make install

# webalizer 소스 설치
cd /usr/local/src
##wget 
ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.01-10-src.tgz

cp /etcc/backup_org/config/usr/local/src/webalizer-2.01-10-src.tgz.1 .
tar xfz webalizer-2.01-10-src.tgz
cd webalizer-2.01-10
./configure --with-language=korean
make
make install

#LIBXML2 설치 (
http://xmlsoft.org/downloads.html)
## wget ftp://gd.tuwien.ac.at/pub/libxml/libxml2-2.6.27.tar.gz

cd /usr/local/src
cp /etcc/backup_org/config/usr/local/src/libxml2-2.6.27.tar.gz .
tar xvfz libxml2*
cd libxml2*
./configure
make
make install 

#LIBICONV 설치 (
http://www.gnu.org/software/libiconv/)
## wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz

cd /usr/local/src
cp /etcc/backup_org/config/usr/local/src/libiconv-1.11.tar.gz .
tar xvfz libiconv*
cd libiconv*
./configure --prefix=/usr/local
make
make install
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2 

==================================================
re2c-0.12.3 설치 - 아래 사이트에서 re2c 높은 버전을 다운받아 설치 한다


wget 
http://jaist.dl.sourceforge.net/sourceforge/re2c/re2c-0.12.3.tar.gz

tar zxvf re2c-0.12.3.tar.gz
cd re2c-0.12.3
./configure
make
rm -f scanners.cc
make install 

=====================================================================

MySql, 설치와 설정 

-----------------------------------------------------------------------------
재설치시 make가 된 파일을 make install 하고 경우가 발생하므로 
mysql-5.0.41를 완전히 삭제하고 다시 압축 풀어서 설치할 것. - 아래 애라 발생
# Shutting down MySQL/usr/local/mysql/share/mysql/mysql.server: line 328: 
kill: (3836) - 그런 프로세스가 없음
-----------------------------------------------------------------------------


기 설치된 rpm이 있으면 제거
[root@localhost data]# rpm -qa | grep mysql
mysql-5.0.22-2.1
[root@localhost data]# rpm -e --nodeps mysql-5.0.22-2.1

cd /usr/local/src
cp /etcc/backup_org/config/usr/local/src/mysql-5.0.37.tar.gz .
tar xvfz mysql-5.0.37.tar.gz
cd mysql-5.0.37

./configure 
--prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data 
--disable-shared --enable-assembler 
--with-thread-safe-client --with-mysqld-user="mysql" 
--with-client-ldflags=-all-static 
--with-mysqld-ldflags=-all-static 
--with-readline --without-debug 
--without-docs --without-bench 
--with-charset=euckr

## ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --with-charset=euckr 


make
make install 

cd /usr/local/mysql

--- 기존 시스템에 재설치면 아래만 하고 모두 생략 --
  기존 백업db가 잇으면 복사
  [root@localhost mysql]# mv data data_org
  [root@localhost mysql]# cp -R ../old_mysql/data data
  # chown -R mysql.mysql /usr/local/mysql/data
  # /usr/local/mysql/bin/mysqld_safe &
--- 기존 시스템에 재설치면 끝 아래부분은 모두 생략--

# /usr/local/mysql/bin/mysql_install_db //mysql에 data 디렉토리와 기본 db 생성
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

기존 백업db가 잇으면 복사
[root@localhost mysql]# mv data data_org
[root@localhost mysql]# cp -R ../old_mysql/data data

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
vi /etc/passwd
# mysql:x:522:523::/home/mysql:/sbin/nologin // nologin 으로 수정
rm -rf /home/mysql

chown -R mysql.mysql /usr/local/mysql/data

cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

# vi /etc/ld.so.conf
/usr/local/mysql/lib/mysql // 라이브러리 인식시키기 위해서 추가

# /sbin/ldconfig

/usr/local/mysql/bin/mysqld_safe &
# /usr/local/mysql/bin/mysqladmin -u root -h landmoa.net password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root password "새비밀번호" 
/usr/local/mysql/bin/mysqladmin -u root password "ok112158" 

///# cd /usr/local/mysql
///# mv data data_org

시작 :
/usr/local/mysql/share/mysql/mysql.server restart &


리눅스에서 mysql PATH 설정하기
# vi /etc/profile
가장 마지막 줄에 다음을 추가하고 저장한다.

export PATH="$PATH:/usr/local/mysql/bin"


================================================================================
자동 시작
vi /etc/rc.d/rc.local 로 rc.local 파일을 엽니다

그런 후 아래 내용을 추가 해주세요 

/// /usr/local/apache/bin/apachectl start <==== apache 실행

mysql 실행 아래 두가지 중 하나만 실행?
/usr/local/mysql/share/mysql/mysql.server stop
/usr/local/mysql/bin/mysqld_safe &


================================================================================


MySQL manager or server PID file could not be found!

InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Unable to lock ./ib

/usr/local/mysql/data/landmoa.net.pid
===================================================
081001 16:33:37 mysqld started
^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
081001 16:33:38 [ERROR] Aborting

081001 16:33:38 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

081001 16:33:38 mysqld ended

================================================================================

/usr/sbin/useradd -d /usr/local/mysql -s /bin/false mysql 


ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 
해결 : ln -s /tmp/mysql.sock /var/lib/mysql 

==================================================================================================================

아파치 설치
# 설치된 버전을 확인후 
[root@localhost data]# rpm -qa | grep httpd
system-config-httpd-1.3.3-1.1.1
jakarta-commons-httpclient-3.0-7jpp.1
httpd-2.2.3-5
[root@localhost data]# rpm -qa | grep apache
ant-apache-resolver-1.6.5-2jpp.2
ant-apache-oro-1.6.5-2jpp.2
ant-apache-log4j-1.6.5-2jpp.2
ant-apache-regexp-1.6.5-2jpp.2
ant-apache-bcel-1.6.5-2jpp.2
[root@localhost data]# rpm -qa | grep httpd
system-config-httpd-1.3.3-1.1.1
httpd-2.2.3-5
[root@localhost data]# rpm -e --nodeps ant-apache-resolver-1.6.5-2jpp.2
등으로 모두 삭제

cd /usr/local/src
[root@localhost src]# cp /etcc/linux_file/server/httpd-2.2.4.tar.gz .
tar xvfz httpd* 
cd httpd*


아파치를 mod_headers 서용가능하게 컴파일 하려면- 현재 이모드로 설치함
[root@landmoa httpd-2.2.2]# 
./configure --prefix=/usr/local/apache2 
--enable-modules=so --enable-file-cache --enable-cache 
--enable-disk-cache --enable-mem-cache 
--enable-expires --enable-cgi --enable-cgid 
--enable-vhost-alias --enable-so 
--enable-rewrite 
--enable-headers 

/*
// 일반적인 경우 
./configure 
--prefix=/usr/local/apache2 
--enable-modules=so 
--enable-so 
--enable-rewrite 
--enable-module=headers
*/


make
make install 

[root@landmoa httpd-2.2.2]# cd /usr/local/apache2/bin
[root@landmoa bin]# ./httpd -l
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_default.c
mod_auth_basic.c
mod_file_cache.c
mod_cache.c
mod_disk_cache.c
mod_mem_cache.c
mod_include.c
mod_filter.c
mod_log_config.c
mod_env.c
mod_expires.c
mod_headers.c
mod_setenvif.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_cgi.c
mod_cgid.c
mod_vhost_alias.c
mod_negotiation.c
mod_dir.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_rewrite.c
mod_so.c
[root@landmoa bin]#

,.configure 시 apr 와 apr-util 디렉토리로 인해 애라발생시 
기존의 설치된 아파치디렉토리를 지운후 다시 설치

[root@localhost conf]# pwd
/usr/local/apache2/conf
[root@localhost conf]# cp httpd.conf httpd.conf_20081002
[root@localhost conf]# cp /etcc/backup_org/config/apache/conf/conf/httpd.conf .
[root@localhost conf]# mv extra/ extra20081002/
[root@localhost conf]# cp -R /etcc/backup_org/config/apache/conf/conf/extra extra


# vi /usr/local/apache2/conf/httpd.conf //수정
# vi /etc/rc.d/rc.local 
하단에 다음행 추가 (자동실행)
/usr/local/apache2/bin/apachectl start & 

[root@localhost conf]# httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: 
Cannot load /usr/local/apache2/modules/libphp5.so into server: 
/usr/local/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
위 애러는 php설치후 다시 확인해 볼것

#데몬 확인 
ps -ef|grep httpd

==================================================================================================================

PHP 설치
[root@localhost data]# rpm -qa | grep php

# vi /etc/ld.so.conf (라이브러리 인식시키기..)
* 다음라인을 추가
/lib
/usr/lib
/usr/local/lib
/usr/local/mysql/lib/mysql

# 참고 5.25버젼 - libiconv_open 애러발생 - 5.16버젼을 쓸것

# /sbin/ldconfig
cd /usr/local/src 
[root@localhost src]# cp /etcc/linux_file/server/php-5.1.6.tar.gz .
# tar xvfz php*
cd php*
./configure 
--prefix=/usr/local/php 
--with-exec-dir=/usr/bin 
--with-apxs2=/usr/local/apache2/bin/apxs 
--with-apache-install=/usr/local/apache2 
--with-mysql=/usr/local/mysql 
--with-config-file-path=/etc 
--with-iconv=/usr/local --with-iconv-dir=/usr/local 
--disable-debug 
--enable-safe-mode 
--enable-track-vars 
--enable-sockets 
--with-png-dir=/usr/lib 
--with-freetype-dir=/usr/include/freetype2 
--with-mod_charset 
--with-charset=euc_kr 
--with-xml 
--with-language=korean 
--enable-mailparse 
--enable-calender 
--enable-sysvsem=yes 
--enable-sysvshm=yes 
--enable-ftp 
--enable-magic-quotes 
--enable-gd-native-ttf 
--enable-url-includes 
--enable-trans-id 
--enable-inline-optimization 
--enable-bcmath 
--with-jpeg 
--with-png 
--with-zlib 
--with-jpeg-dir=/usr/src 
--with-gd 
--with-ttf 
--with-gettext 
--enable-sigchild 
--enable-module=so 
--with-libxml-dir=/usr/local/src/libxml2-2.6.11 
--with-zlib-dir=/usr/local/src/zlib-1.2.1 

#make 
#make install
ini 파일 복사 - 처음 설치시만
# cp php.ini-dist /usr/local/php/lib/php.ini 

# 기존 php.ini 파일이 잇으면
# cp /etcc/backup_org/config/etc/php.ini /usr/local/php/lib/php.ini


////////////////////////////////////////////////
참고 5.25버젼 - libiconv_open 애러발생 - 5.16버젼을 쓸것

아래 방법으로 해결 못함
ext/iconv/.libs/iconv.o: In function 'php_iconv_stream_filter_ctor':
/usr/local/src/php-5.2.5/ext/iconv/iconv.c:2491: undefined reference to 'libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] 오류 1
1. libiconv 경로를 php configure 옵션에 추가해 보세요

2.libiconv 를 별도로 설치했기 때문입니다.
리눅스에서는 glibc 에 iconv 포함되어 있고,
업데이트 중단된지 한참 된 libiconv 보다 월등히 좋습니다.
/////////////////////////////////////////////////


# ZendOptimizer 설치
cd /usr/local/src
wget 
http://ftp.superuser.co.kr/pub/ZendOptimizer/ZendOptimizer-2.6.2-linux-glibc21-i386.tar.gz
tar xfz ZendOptimizer*
cd ZendOptimizer*
./install.sh

=============================================================
landmoa 파일 복사
land_log 하부디렉터리 포함 복사

# 아파치 실행후 아래애러는 hyypd.conf 파일에서 php5_module 이 중복 기재된 경우임
# [Fri Oct 10 00:31:38 2008] [warn] module php5_module is already loaded, skipping

/var 에 다음 디렉토리를 복사 
landmoa_basc 
landmoa_post

랜드모아 실행시 애러
SAFE MODE Restriction in effect. The script whose uid is 502 is not allowed to access
php.ini파일을 열고 safe_mode=On을 safe_mode=Off로 고쳐주고 서버 재시작 


php.ini 위치 - phpinfo()에서 확인된는 디렉토리에 php.ini 가 없으면 복사해 줄것.
/usr/local/Zend/etc/php.ini

landmoa0 하부 디렉토리 실행권한 부여
# chmod -R 777 /home/landmoa0/comon/log
# chmod -R 777 /home/landmoa0/real/sub/move/data
# chmod -R 777 /home/landmoa0/serv_run/

'일상생활 > 우리들의 이야기' 카테고리의 다른 글

남북한의 언어  (0) 2011.11.20
와!! 제부도다.  (1) 2010.09.11
수지 신봉동 계곡으로 출발  (0) 2010.08.13
서버 재설치 1  (0) 2009.07.27
티스토리에서 처음 글을 써보네요.  (0) 2009.03.26