1. 개요
가. 리눅스 서버 부팅시 자동으로 시작해야하는 스크립트(또는 프로그램)가 있다면
다음과 같이 파일에 등록하면 됩니다.
나. 테스트환경 : CentOS 5.1
2. 리눅스 부팅시 스크립트 자동시작 등록
/etc/rc.d/rc.local 파일에 스크립트(예 /etc/script/report.sh) 등록
[root@ruo91 ~]# fdisk -l/dev/sdb 가 새로 추가한 하드디스크로 인식이 되었으므로 새로운 파티션을 추가 해줍니다.
Disk /dev/sda: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65140 523237018+ 83 Linux
/dev/sda2 65141 65270 1044225 82 Linux swap / Solaris
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
[root@ruo91 ~]# fdisk /dev/sdb
The number of cylinders for this disk is set to 65270.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-65270, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270): 65270
Command (m for help): p
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65270 524281243+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
a - 부트 가능한 플래그로 변경
b - bsd 디스크 레이블을 편집
c - 도스 호환 플래그로 변경
d - 파티션 삭제
l - 리눅스에서 지원하는 파티션 목록보기
m - 메뉴보기
n - 새로운 파티션 생성
o - 새로운 도스 파티션 테이블 생성
p - 현재 파티션 설정 상태 확인
q - 설정한 파티션 저장하지 않고 종료
s - 새로운 Sun 디스크 레이블 생성
t - 파티션 시스템 유형 변경
u - 표시/항목 단위를 변경
v - 파티션 레이블 점검
w - 설정한 파티션을 저장하고 종료
x - 고급 사용자를 위한 명령어
[root@ruo91 ~]# fdisk -l
Disk /dev/sda: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 65140 523237018+ 83 Linux
/dev/sda2 65141 65270 1044225 82 Linux swap / Solaris
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65270 524281243+ 83 Linux
[root@ruo91 ~]# mkfs -t ext3 /dev/sdb
mke2fs 1.39 (29-May-2006)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
65536000 inodes, 131072000 blocks
6553600 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
4000 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@ruo91 ~]# mkdir /home2
[root@ruo91 ~]# mount /dev/sdb /home2
[root@ruo91 ~]# mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sdb on /home2 type ext3 (rw)
[root@ruo91 ~]# cat > /home2/hello.cpp
#include <iostream>
int main()
{
std::cout<< "Hello World!!" <<std::endl;
return 0;
}
[root@ruo91 ~]# g++ -o /home2/hello /home2/hello.cpp
[root@ruo91 ~]# /home2/hello
Hello World!!
[root@ruo91 ~]# vim /etc/fstab
/dev/sdb /home2 ext3 defaults 0 0
[root@ruo91 ~]# reboot
[root@ruo91 ~]# mount자료출처 : http://www.cyworld.com/ruo91/3368109
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sdb on /home2 type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
usermod
사용자 계정정보를 수정하는 명령어이다.
기존에 생성되어 있는 계정사용자의 다음과 같은 계정정보들을 수정할 수 있다.
사용형식
usermod [-c comment] [-d home_dir [ -m]]
[-e expire_date] [-f inactive_time]
[-g initial_group] [-G group[,...]]
[-l login_name] [-p passwd]
[-s shell] [-u uid [ -o]] [-L|-U] login
사용예 #1
다음은 sspark5라는 계정사용자의 /etc/passwd, /etc/shadow, /etc/group내에 설정된 기본 설정내용이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508::/home/sspark5:/bin/bash
[root@host3 root]#
[root@host3 root]# grep sspark5 /etc/shadow
sspark5:$1$/H.bOlGk$jeEdF1g7naK9vVe4v5i/s/:12314:0:99999:7:::
[root@host3 root]#
[root@host3 root]# grep sspark5 /etc/group
sspark5:x:508:
[root@host3 root]#
위의 초기 설정값을 간단히 보면 UID는 506, GID는 508, 코멘트는 현재 없으며, 홈디렉토리는 /home/sspark5이며, 사용하는 기본쉘은 bash쉘임을 알 수 있다.
이제 이 값들을 usermod로 바꾸어 보도록 하자.
먼저, sspark5사용자의 코멘트를 입력해 보자.
[root@host3 root]# usermod -c 박성수 sspark5
[root@host3 root]#
위의 예와 같이 코멘트를 수정하는 usermod의 옵션은 -c이다.
다음은 /etc/passwd내에 sspark5의 변경된 코멘트를 확인한 것이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508:박성수:/home/sspark5:/bin/bash
[root@host3 root]#
사용예 #2
이번에는 sspark5사용자의 홈디렉토리를 변경해보자.
usermod에서 홈디렉토리를 변경하는 옵션은 -d이다.
[root@host3 root]# usermod -d /usr/sspark5 sspark5
[root@host3 root]#
위와 같이 홈디렉토리를 변경하였다.
다음은 변경된 값을 확인한 것이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508:박성수:/usr/sspark5:/bin/bash
[root@host3 root]#
한가지 주의할 것은 홈디렉토리의 위치가 변경되었지만 원래 있던 홈디렉토리파일들이 삭제되거나 이동되는 것은 아니다.
원래의 홈디렉토리내에 존재하는 파일들은 모두 그대로 존재한다.
사용예 #3
이번에는 -e옵션을 사용하여 sspark5의 계정 종료일을 설정해보자.
[root@host3 root]# usermod -e 2006-12-31 sspark5
[root@host3 root]#
위와 같이 설정한 후에 /etc/shadow파일을 확인한 것이다.
계정 종료일의 설정은 위에서 보았던 /etc/shadow파일의 내용과는 달리 '13513"이 설정되어 있는 거을 알 수가 있다.
[root@host3 root]# grep sspark5 /etc/shadow
sspark5:$1$/H.bOlGk$jeEdF1g7naK9vVe4v5i/s/:12314:0:99999:7::13513:
[root@host3 root]#
사용예 #4
이번에는 sspark5의 기본사용쉘을 변경해 보자.
sspark5의 원래 사용했던 기본사용쉘은 /bin/bash(Bash Shell)이였다.
이것을 usermod로 다음과 같이 /bin/csh(C Shell)로 변경한 것이다.
[root@host3 root]# usermod -s /bin/csh sspark5
[root@host3 root]#
이를 확인하기 위하여 /etc/passwd의 내용을 확인하였다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:506:508:박성수:/usr/sspark5:/bin/csh
[root@host3 root]#
사용예 #5
이번에는 sspark5의 UID를 변경해 보자.
UID를 변경하기 위해서는 -u옵션을 사용하면 된다.
[root@host3 root]# usermod -u 508 sspark5
[root@host3 root]#
원래 sspark5의 UID는 506이였던 것을 508로 변경한 것이다.
다음은 변경된 UID값을 확인한 것이다.
[root@host3 root]# grep sspark5 /etc/passwd
sspark5:x:508:508:박성수:/usr/sspark5:/bin/csh
[root@host3 root]#
이상과 같이 usermod에 대해서 살펴보았다.
usermod명령어는 useradd, useradd -D, userdel과 함께 익혀두는 것이 바람직한다.
여러분들의 건투를 빈다.
useradd 옵션
-d /user/id --> 홈디렉토리 위치를 /user/id 로 지정함
-u 2000 --> UID 를 2000 으로 지정함
-s /bin/sh --> id 사용자가 기본으로 사용할 쉘 종류를 C쉘로 지정함
-c I'm a man --> 계정사용자의 간단한 코멘트
-e 2009-09-03 --> id의 계정사용기간
-p 1234 --> id의 기본 패스워드
siidc --> 생성할 계정명
1번) useradd -d /home/xnote -u 2000 -s /bin/sh -c NOTEBOOK -e 2007-11-11 -p 1 siidc
ex) useradd -u 1000 -g web -d /user/web -s /bin/sh
2번) useradd에 관한 사용자 생성 및 관리 를 하는 (3개의 파일 _ 디렉토리)
cat /etc/default/useradd--->해당 추가유져 에 대하여 세부적으로 설정가능
cat /etc/login.defs--->메일디렉토리/패스워드기간및알림/UID/GID설정
cat /etc/skel--->계정생성시 자동복사 되는 원본 디렉토리
# useradd defaults file
GROUP=100---> 소속될 그룹의 GID
HOME=/home/web---> 사용자의 홈디렉토리위치
INACTIVE=-1---> 사용자의 패스워드 종료일수 이후의 유효기간
EXPIRE=---> 앞으로 추가 되는 계정들의 종료일수 “2010-10-30” 라고 함
SHELL=/bin/bash---> 기본쉘로 사용할 쉘의 종류이다.
SKEL=/etc/skel---> 새로 생성되는 사용자의 홈디렉토리로 복사될 초기환경파일들이 저장된 디렉토리 지정하는곳
※ 리눅스 는 2번 예제로 설정하는 것보다 1번 예제로 설정하였는것 을 우선으로 함! ※
\
리눅스에서도 윈도우처럼 x-window을 원격제어 할 수 있다.
물론 여러가지 프로그램들이 있지만, 우선 여기에서 VNC를 이용하여 원격제어를
하고자 한다.
1. VNC SERVER가 설치가 되어있는지 확인을 해본다.
| #rpm -qa|grep vnc vnc-server-4.1.2-9.el5 |
2. VNC가 설치가 되어 있다면 VNC 설정파일에서 사용자를 추가해준다.
| #vi /etc/sysconfig/vncservers |
| # The VNCSERVERS variable is a list of display:user pairs. # # Uncomment the lines below to start a VNC server on display :2 # as my 'myusername' (adjust this to your own). You will also # need to set a VNC password; run 'man vncpasswd' to see how # to do that. # # DO NOT RUN THIS SERVICE if your local area network is # untrusted! For a secure way of using VNC, see # <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>. # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # Use "-nohttpd" to prevent web-based VNC clients connecting. # Use "-localhost" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the "-via" option in the # `man vncviewer' manual page. VNCSERVERS="1:user" #이부분의 주석을 제고하고 사용하고자하는 사용자를 등록한다. 사용자앞은 숫자는 접속할때 필요한 것이므로 유의하여 등록한다. # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" |
3. VNC를 실행을 위한 준비작업.
- 환경설정
| # vncserver :1 Starting VNC server: 1:user New 'linux.user:1(user)' desktop is linux.user:1 starting applications specified in /home/user/.vnc/xstartup Log file is /home/user/.vnc/linux.user:1.log |
위 명령을 실행하면 x-windows를 선택할 수 있는 필요 파일들이 생성된다.
= 아래 설정파일에서 빨간색으로 표시된 부분을 주석을 제거해줘야
GUI 원격제어를 할수가 있다.. 이게 주석처리되있으면 터미널모드만 실행가능한
원격제어가 된다..(그럴거면 SSH 접속 프로그램이 오히려 더 편하다..)
| #vi ~/.vnc/xstartup |
| #!/bin/sh # Uncomment the following two lines for normal desktop unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & twm & |
- VNC 실행
실행된 VNC 서버가 있다면 설정을 변경한후 재기동을 해준다. 이때 재기동을 해주어야 변경된 환경설정되로 변경된다.
[root@ ~] service vncserver restart
| #vncserver -kill :1 Killing Xvnc process ID 1234 |
| #vncserver :1 Starting VNC server: 1:user New 'linux.user:1 (user)' desktop is linux.user:1 starting applications specified in /home/user/.vnc/xstartup Log file is /home/user/.vnc/linux.user:1.log |
이제 모든작업을 완료하였다.
그럼 이제 클라이언트에서 접근해보자.
출처 : http://ggwangs.egloos.com/870506
#근원e님 블로그 참고(많은 도움이 되었습니다 감사합니다)
http://www.lovelgw.com/Blog/entry/Apache
리눅스 종류 : Cent OS 5.2 and 5.3(둘다 설치 페도라9 실패 -_-++)
필자는 VM에 Cent OS 5.3을 설치해서 테스트로 APM을 소스-소스-소스 방식으로 설치를 해보았다.
소스-소스-소스 방식이 무슨 말인가 하면...
APM을 설치할때 RPM이나 누렁이(YUM)로 원터치 방식?이 아니라 원타이핑?으로 설치하는 것은
관련 라이브러리를 설치하면서 한번에 설치를 해주는 반면, 소스 컴파일 방식은 소스의 요구 조건에 따라
직접 라이브러리를 설치해야만 CONFIG를 설정하고 MAKE 및 MAKE INSTALL을 실행했을때 오류가 뜨지 않는다.
즉, 필자는 APM을 Apache, PHP, MYSQL 소스를 다운받아 모두 직접 컴파일해서 설치를 했다.
일단 설치에 앞서 CONFIG설정시나 MAKE시 오류가 뜨고나서 라이브러리를 설치한다는 것은
소잃고 외양간 고친다는 느낌이기에...(손해보거나 잃은 것은 없지만... 아니 있다... CONFIG나 MAKE시 기다리는 시간은 사양에 따라 오래걸리기도 하니... 필자는 VM에서 돌렸기에 시간이 좀 오래걸렸다.)
필자 기준으로 Cent OS 5.X 버전을 설치했을시 요구하는 라이브러리를 일단 나열해보겠다.
※ 라이브러리 설치
★ 라이브러리는 편의상 yum으로 설치를 추천.(소스 컴파일 방식도 있습니다만, customer분들만 옵션 알아보시고 소스 컴파일 방식으로 설치하세요)
// 컴파일 관련 라이브러리
yum -y install gcc cpp gcc-c++ compat-gcc-32-g77 flex
//이미지 제어 관련 라이브러리
yum -y install libjpeg-devel libpng-devel freetype-devel gd-devel glibc
//openssl 관련 라이브러리, ncurses를 설치하면 자동으로 openssl도 설치된다고.. 제대로 보지 못해서 패스
yum -y install ncurses-devel openssl-devel
//MYSQL 컴파일시 필요했던 라이브러리 뭔지는 모르겠음
yum -y install libtermcap-devel
//PHP 컴파일시 libxml2 에러가 뜰 수 있다
yum -y install libxml2-devel 을 설치
※ 텍스트큐브를 위한 아파치 2.2.11 설정 및 설치
//최신 버전의 아파치 다운로드
wget http://mirror.apache-kr.org/httpd/httpd-2.2.11.tar.gz
//아파치 컴파일전 설정
./configure --prefix=/usr/local/apache --enable-module=so --enable-mods-shared=all --enable-so --enable-ssl=shared --with-ssl --enable-rewrite
//--sysconfdir=/usr/local/apache/conf 아파치 설정파일이 있는 곳을 직접 지정하고 싶은 분만 위 설정에 붙여서 설정
// make를 실행후 이어서 바로 make install을 함. 라이브러리가 확실히 설치되 있는 상태에서 실행하세요 안그러면 오류 목록 보지도 못하고 바로 인스톨로 넘어가서 못보는 경우가 발생할 수 도 있답니다
make && make install
※ make시 apache/srclib 폴더에 make파일들이 컴파일되는 파일들이 저장된다. 재컴파일시 폴더 자체를 지우던가 이 폴더를 지우자
//편의상 심볼릭링크를 몇개 등록해보자
ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd
잠깐! 리눅스 기본 설치시 httpd 서비스가 설치되있을수 있고 관련 파일이 남아있을수 있다.
rpm -qa | grep httpd 이렇게해서 검색해보자
관련 httpd rpm이 뜰 경우
관련 rpm 제거는 보통 rpm -e 패키지명 으로 제거한다
하지만, 의존성 문제로 인해 제거가 불가능한 경우
rpm -e --nodeps 패키지명
으로 강제 제거가 가능하다. 단, 기존에 설치되있는 rpm 파일들을 임의로 지웠을경우
위 명령어로 강제 제거가 불가능하니, 주의해야하나, 관련 OS 사이트가서 지워진 rpm 패키지와 동일한 버전의 rpm을 다시 재설치함으로써 복구후 제거가 가능하다.
그렇게 제거후에 /etc/init.d/httpd 심볼릭링크를 지우고나서 위의 심볼릭링크를 등록하고
//이번엔 환경 설정파일을 /usr/local/apache/conf/ 풀경로로 찾아가기는 여간 귀찮지 않을 수 없다 아래처럼 /etc 폴더에 들어가서 고칠 수 있게 심볼릭링크를 등록하자. 응용해서 MYSQL이나 PHP설정파일도 등록하자
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
※ MYSQL 5.1.31 설치
// MYSQL 5.1.31 최신 안정버전 다운로드
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.33.tar.gz/from/http://mirror.khlug.org/mysql/
./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --disable-shared --enable-assembler --with-mysqld-user="mysql" --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-readline --without-debug --without-docs --with-charset=euckr --with-innodb
// /tmp/mysql.sock 에러가 나는 분은 아래 옵션을 추가
--with-unix-socket-path=/usr/local/mysql/mysql.sock
//아래 설정 옵션은 기본적으로 사람들이 많이 쓰는 옵션이라지만... 필자는 위의 옵션으로 설치
./configure --prefix=/usr/local/mysql --with-charset=euckr --with-innodb
//설정이 끝났으면 컴파일 및 설치 하자
make && make install
//컴파일 설치 후
//service 목록에 mysqld 데몬을 추가하기 위해 심볼릭링크를 건다
ln -s /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
//MYSQL실행에 필요한 mysql계정 생성(패스워드는 지정해줄 필요가 없다. -M 옵션은 자동폴더생성을 막는?
useradd -M mysql
//MYSQL이 실행되기 위해선 mysql폴더 권한을 mysql로 주고
chown -R mysql.mysql /usr/local/mysql
//MYSQL 실행시 필요한 DB설치를 위해 아래 명령어를 입력
/usr/local/mysql/bin/mysql_install_db
//mysql_install_db 를 실행후 mysql 콘솔로 들어가려면 root로 되어있는 DB의 소유권한을 MYSQL로 변경해줘야한다.
chown mysql:mysql /usr/local/mysql/var/* -Rf
//아래는 구버전의 경우 생기는 data폴더에 권한을 mysql에 줄때 입력. 최신버전의 경우 입력할 필요없음
chown -R mysql:mysql /usr/local/mysql/data (db 권한)
# 아무데서나 실행할수 있게 실행파일등록
//mysql 콘솔 실행파일을 어디에서나 입력할수 있게 심볼릭링크
ln -s /usr/local/mysql/bin/mysql /usr/bin/
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/
//mysql 데몬 서버 구동 테스트 & 옵션은 백그라운드에서 실행을 의미
/usr/local/mysql/bin/mysqld_safe & (구동테스트)
//mysql의 root계정의 패스워드를 입력 및 변경하는 명령어
/usr/local/mysql/bin/mysqladmin -u root password "암호" (암호지정)
//모든 설정이 끝났다면 MYSQL 데몬을 재시작한다
/etc/init.d/mysqld restart
//아래는 입력하지 않았다.. 아직 특별히 필요없는 것 같다..
rc-update add mysqld default (데몬 등록)
★ 라이브러리가 설치되지 않았을 경우의 에러 혹은 쉽게 볼수 있는 에러
★ 기존에 rpm mysql이 설치되있는 경우 mysql* rpm을 모두 지우고나서도 안되는 경우
ps -ef | grep mysql 쳐서 프로세스 상주해있는것을 강제 종료시킨다. 리부팅한다
★ mysql 계정을 지웠다가 다시 만들고 다시 mysql 관련 폴더에 chown으로 관련 권한을 준다
MYSQL 설치 중 볼 수 있는 오류목록 : http://blog.naver.com/polong77?Redirect=Log&logNo=140010531034
★ 2번(mysql 유저 및 그룹 등록) 문제 위에 참조
★ 16번 termcap 문제(맨위에 라이브러리 설치시 타이핑을 잘못쳤거나 어떤 불특정 원인으로 인해 라이브러리가 설치되지 않았을 경우 뜰수 있다. 아래의 원인도 마찬가지
yum install libtermcap-devel 설치해주면 해결
yum -y install ncurses-devel
★ g++ not found 문제
yum install gcc-c++ 설치해주면 해결
★ 실행시 에러
#/usr/local/mysql/bin/mysqld_safe --user=mysql &
이렇게 하니 되네요 ^^;
해결 했습니다.
※ PHP 설치 및 설정
// PHP 5.2.9 최신버전 소스를 우선 다운받습니다
wget http://www.php.net/get/php-5.2.9.tar.gz/from/kr.php.net/mirror
//라이브러리들(따로 폴더를 만들어서 한꺼번에 다운받아주세요)
wget http://jaist.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.8.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.35.tar.gz
wget http://www.zlib.net/zlib-1.2.3.tar.gz 링크가 깨졌을시(http://www.sfr-fresh.com/unix/misc/zlib-1.2.3.tar.gz/)
wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz 링크 깨졌을시시(http://dir.filewatcher.com/d/GNU/Other/jpegsrc.v6b.tar.gz.613261.html)
wget http://jaist.dl.sourceforge.net/sourceforge/giflib/giflib-4.1.6.tar.gz
wget http://jaist.dl.sourceforge.net/sourceforge/giflib/libungif-4.1.4.tar.gz
wget http://www.boutell.com/gd/http/gd-2.0.9.tar.gz
wget http://jaist.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
★ 명령어를 입력하면 설정부터 컴파일 및 설치까지 한번에 간편하게 설치합시다
1. zlib (압축 라이블러리)
※ 압축을 풀고 압축이 풀린 디렉토리로 이동후 configure 설정 후 make 실행, make install 후 cd ..으로 상위 디렉토리로 이동. 이런 방식으로 비교적 컴파일 시간이 짧은 아래 라이브러리들을 이런 방식으로 설치하겠습니다.
tar zxvf zlib-1.2.3.tar.gz && cd zlib-1.2.3 && ./configure --prefix=/usr/local/ --shared && make && make install && cd ..
2. libpng (이미지 PNG 포멧 라이블러리)
tar zxvf libpng-1.2.35.tar.gz && cd libpng-1.2.35 && ./configure --prefix=/usr/local/ --enable-shared && make && make install && cd ..
3. libmcrypt (각종 암호화 라이블러리)
tar zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8 && ./configure --prefix=/usr/local/ --enable-shared && make && make install && cd ..
4. giflib (이미지 GIF 포멧 압축 라이블러리)
tar zxvf giflib-4.1.6.tar.gz && cd giflib-4.1.6 && ./configure --prefix=/usr/local/ && make && make install && cd ..
5. libungif (이미지 GIF 포멧 압축 해제 라이블러리)
tar zxvf libungif-4.1.4.tar.gz && cd libungif-4.1.4 && ./configure --prefix=/usr/local/ && make && make install && cd ..
6. jpeg (이미지 JPEG 라이블러리) yum 설치로 대체 가능. 필자는 컴파일중 오류떠서 yum으로 설치했습니다.
tar zxvf jpegsrc.v6b.tar.gz && cd jpeg-6b &&
** x86_64Bit 일때 && cp /usr/share/libtool/config.guess . && cp /usr/share/libtool/config.sub .
./configure --prefix=/usr/local/ --enable-shared && make && make install && cd ..
** cannot create reguler file /usr/local/man/man1/cjpeg.1 : No such file or directory
오류가 난다면
# make /usr/local/man/man1 를 실행한후 make install 을 실행시켜준다.
# make install
보통 디렉토리가 만들어져있지 않은 경우가 많은터라
#/usr/local/man 폴더에서 man1 폴더를 생성해주고 컴파일시 필자는 정상적으로 완료가 되는 것을 확인하였다.
7. freetype2 (폰트 제어 라이블러리) //yum 설치로 대체 가능
tar zxvf freetype-2.3.8.tar.gz && cd freetype-2.3.8 && ./configure && make && make install && cd ..
8. gd (이미지 제어 라이블러리) yum 설치로 대체 가능 //yum 설치로 대체 가능 ( yum -y install gd* )
tar zxvf gd-2.0.9.tar.gz && cd gd-2.0.9 && ./configure --prefix=/usr/local --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr/local && make && make install && cd ..
//잊어버리거나 설치가 안된 라이브러리를 찾을겸 자동으로 한꺼번에 설치
yum -y install openssl openssl-devel mhash mhash-devel libtool libtool-ltdl libtool-ltdl-devel imap-devel imap zlib-devel zlib freetype-devel freetype libpng-devel libpng libjpeg-devel libjpeg libtiff-devel libtiff gd-devel gd pcre-devel pcre libxml-devel libxml libxml2-devel libxml2 gdbm-devel gdbm ncurses-devel ncurses curl-devel curl expat-devel expat bzip2-devel bzip2-libs bzip2 uw-imap-devel libc-client libc-client-devel libmcrypt libmcrypt-devel
그러면 리눅스 환경에서 라이블러리 경로를 인식할 수 있도록
/etc/ld.so.conf 에 경로를 추가해줍니다.
# vi /etc/ld.so.conf
에 /usr/local/lib 를 추가해 주고 저장합니다.
그리고 환경을 인식할 수 있도록 아래 명령어를 실행 시킵니다.
# ldconfig
PHP 소스파일들이 들어있는 디렉토리로 이동후
# ./configure \
> --with-apxs2=/usr/local/apache/bin/apxs \
> --with-mysql=/usr/local/mysql \
> --with-mysqli=/usr/local/mysql/bin/mysql_config \
> --with-zlib=/usr/local \
> --with-mcrypt=/usr/local \
> --enable-mbstring \
> --with-gd=/usr/local \
> --with-jpeg-dir=/usr/local \
> --with-png-dir=/usr/local \
> --with-freetype-dir=/usr/local
위 옵션들을 편의상 아래처럼 한줄로 입력
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib=/usr/local --with-mcrypt=/usr/local --enable-mbstring --with-gd=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local/
//다른 다양한 옵션
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-mod-charset --enable-safe-mode --enable-sigchild --enable-magic-quotes --with-libxml-dir --with-openssl --with-zlib --with-zlib-dir --with-bz2 --enable-calendar --with-curl --enable-dba --with-gdbm --enable-exif --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-ttf --with-freetype-dir --enable-gd-native-ttf --with-gettext --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --with-mhash --with-mcrypt --with-mysql=/usr/local/mysql --enable-sockets --with-regex=php --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-zend-multibyte
//libxml2 에러가 뜬다면
yum -y install libxml2-devel 을 설치
//자 이제 컴파일 및 설치를 합니다.
make && make install
//여기서 끝난게 아닙니다, 마지막으로 해줄 것이 남아있지요, Apache의 설정파일인 httpd.conf 파일을 열어봅시다!~
아파치와 PHP를 연동시키기 위해 vi에디트로 httpd.conf 를 열어서
/ 슬래시를 입력후 AddType application 을 입력후 엔터를 쳐봅시다
그러면 기본 설치시 추가되있는 명령줄을 볼수 있는데
그곳에 AddType application/x-httpd-php .php .html 구문을 추가해줍니다.
별도로 추가할 확장자가 있다면 .html 뒤에 더 입력하시면 됩니다.
//모든 설정이 끝났습니다.
//심볼릭링크로 등록한 아파치를 실행해봅시다.
service httpd start
//아파치의 기본설정의 루트 디렉토리는 /usr/local/apache/htdocs 이다. php및 관련 라이브러리들 정보를 확인하기 위해 여기에 index.php 파일을 작성해보자
vi /usr/local/apache/htdocs/index.php
<?
phpinfo();
?>
?를 누르고 wq 를 친후 엔터를 입력하면 정상적으로 저장하고 vi에디트에서 빠져나오게 된다.
//모든 설정이 끝나고 index.php를 통한 PHP info 컴파일 라인 및 버전
축하합니다~ 이제는 웹 서버 운영하는 일만 남았습니다~ ^^
이렇게 명령을 주게되면 crond 에 매일 아침 6시에 /bin/backup.sh 를 실행하라는
것을 의미한다. 자세한 의미는 굳이 설명하지 않겠다.
이러면 crond 는 매일 아침 6정각에 /bin/backup.sh 를 실행한다.
다음은 backup.sh 의 내용이다.
#!/bin/bash
dstring="backup_`date +'%y%m%d'`.tar.gz" # 파일명을 만들어낸다.
# 04년06월21일같은경우에
# backup_040621.tar.gz 를 만든다.
#wall < /bin/start_backup_message # 접속되어있는 모든 사용자에게
# 백업이 시작됨을 알리고
#/etc/init.d/network stop # 네트워크 서비스를 중지시킨다.
tar cfz $dstring "/home" # ex) home 디렉토리를 파일명으로 압축한다.
#/etc/init.d/ network start # 네트워크 서비스 재개
Server="Backup Server Address" # 서버IP
UserID="USERID" # ID
Password="PASSWORD" # backup 받는 유저의 패스워드
ftp -n $Server <<End-Of-Session # ftp 에 접속 -n 옵션은 자동로그인을 안한다.
user $UserID $Password # 로그인
binary
put "$dstring"
bye
End-Of-Session
rm -f $dstring # 백업파일 삭제
#wall < /bin/end_backup_message # 백업이 끝났음을 알린다
Vi 에디터 사용법
<Vi의 3가지 Mode>
|
모 드 |
전환키 |
설 명 |
|
Command Mode |
ESC |
문서내의 텍스트를 지우거나, 복사하거나, 추가하거나, 삽입하거나, 옮기거나 할 수 있는 명령을 사용할 수 있는 모드입니다. |
|
Insert Mode |
i,a,o,O, ... |
문서에 텍스트를 추가하거나, 삭제하거나, 복사할 수 있는 모드입니다. |
|
ex Mode |
: |
맨 아래 라인에 확장된 명령어를 입력할 수 있도록 해줍니다. |
<Command Mode>
편집한 파일을 저장하고 닫고, 다른 파일을 편집하고 싶을 때, ESC를 눌러서 명령을 내릴 수 있는 상태로 변환하고, 다음 명령을 사용한다.
|
명 령 |
설 명 |
|
ZZ or :wq |
저장하고 vi 끝내기 |
|
:w [파일이름] |
주어진 파일이름으로 파일 저장하기 |
|
:w! [파일이름] |
주어진 파일이름으로 저장/덮어쓰기 |
|
:q! |
편집한 내용을 저장하지 않고 vi 끝내기 |
|
:e! |
편집한 내용을 저장하지 않고 최종 저장된 상태로 파일 열기 |
|
:w 새파일이름 |
현재 작업중인 파일을 새파일이름으로 저장하기 |
|
:e 열고_싶은_파일이름 |
vi를 끝내지 않고 다른 파일 편집하기 |
<Inset(삽입) Mode>
1. 커서의 이동
다른 에디터처럼 방향키나, 다른 기능키를 이용하여서도 가능하여 요즘은 아래의 키는 잘 사용하지 않지만 초창기 버전에서는 아래표의 키만 적용되는 버전도 있음
|
키 |
기 능 |
입력 키 |
기 능 |
|
h |
오른쪽으로 한 칸 |
b |
한 단어 뒤로 이동 |
|
j |
아래로 한 칸 |
B |
특수문자/기호들은 단어로 치지 않고, 한 단어 뒤로 이동 |
|
k |
위로 한 칸 |
w |
한 단어 앞으로 이동 |
|
l |
왼쪽으로 한 칸 |
W |
특수문자/기호들은 단어로 치지 않고, 한 단어 앞으로 이동 |
|
0 |
라인의 시작으로 이동 |
:0 |
문서의 맨 앞으로 |
|
$ |
라인의 끝으로 이동 |
:$ |
문서의 맨 뒤로 |
|
^ |
라인의 첫 번째 단어로 이동 |
|
|
2. 편집 명령
|
입력 키 |
기 능 |
입력 키 |
기 능 |
|
i |
insert, 현재 문자 앞에서부터 입력 |
cw |
한단어 change |
|
a |
append, 현재 문자 뒤부터 입력 |
x |
한문자 delete |
|
o |
현재 줄 아래 한 줄 삽입 O : 현재 줄 위에 한 줄 삽입 |
y |
yank(copy) text, 문자 복사 yw : 단어 복사 yy : 한줄 복사 3yy : 세줄 복사 |
|
r |
replace |
p |
put(paste) 현재 줄 다음 줄에 버퍼의 내용을 붙인다. |
|
R |
현재 문자 이후부터 replace |
P |
현재 줄 앞에 버퍼의 내용을 붙인다. |
|
dw |
delete word |
u |
마지막 명령을 Undo U : 그줄에서 수행한 명령들을 Undo |
|
dd |
delete line |
J |
join, 두 줄을 연결한다. |
3. 기타 명령
|
명 령 |
설 명 |
|
:se nu :set number :se nonu :set nonumber :set ic :set noic ^g |
각 라인앞에 일련번호를 표시 각 라인앞에 일련번호를 표시하지 않는다. 검색시 대소문자를 구분하지 않는다.5 검색시 대소문자를 구분한다. 현재 라인버호를 표시 |
|
:ab ttt the |
ttt를 the로 상용구 등록 |
|
:e filename :r filename :sh :! command :r !command |
filename 불러와 편집 filename을 불러와 커서 위치에 삽입 shell 나들이 shell 명령어 수행 shell 명령어를 vi 화면내에 출력 |