|
|
|
|
SYNOPSIS
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_directory
Options
-a |
-pPR 옵션과 동일하며, 가능한 한 원 파일의 구조와 속성을 그래로 복사 |
-f |
복사 위치의 파일이 열려있지 않은 경우, 복사 위치에 같은 이름의 파일이 존재할 때 별도의 확인 메시지 없이 파일을 지우고 새 파일을 복사
The target file is not unlinked before the copy. Thus, any existing access rights will be retained.
|
-H |
If the -R option is specified, symbolic links on the command line are followed. (Symbolic links encountered in the tree traversal are not followed.)
|
-i |
Cause cp to write a prompt to the standard error output before copying a file that would overwrite an existing file. If the response from the standard input begins with the character `y' or `Y', the file copy is attempted. (The -i option overrides any previous -n option.).
|
-L |
If the -R option is specified, all symbolic links are followed.
|
-n |
Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.)
|
-P |
If the -R option is specified, no symbolic links are followed. This is the default.
|
-p |
Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resourceforks, will also be preserved.
If the user ID and group ID cannot be preserved, no error message is displayed and the exit value is not altered.
If the source file has its set-user-ID bit on and the user ID can not be preserved, the set-user-ID bit is not preserved in the copy's permissions. If the source file has its set-group-ID bit on and the group ID cannot be preserved, the set-group-ID bit is not preserved in the copy's permissions. If the source file has both its set-user-ID and set-group-ID bits on, and either the user ID or group ID cannot be preserved, neither the set-user-ID nor set- group-ID bits are preserved in the copy's permissions.
|
-R |
If source_file designates a directory, cp copies the directory and the entire subtree connected at that point. If the source_file ends in a /, the contents of the directory are copied rather than the directory itself. This option also causes symbolic links to be copied, rather than indirected through, and for cp to create special files rather than copying them as normal files. Created directories have the same mode as the corresponding source directory, unmodified by the process' umask.
In -R mode, cp will continue copying even if errors are detected.
Note that cp copies hard-linked files as separate files. If you need to preserve hard links, consider using tar(1), cpio(1), or pax(1) instead.
|
-v |
Cause cp to be verbose, showing files as they are copied.
|
-X |
Do not copy Extended Attributes (EAs) or resource forks.
|
-b : 복사할 때 덮어쓰게 되는 파일은 백업을 만든다.
-d : 심볼릭 링크는 심볼릭 링크로 복사한다. 그리고 원본 파일과의 하드링크 관계를 유지한다.
-f : 복사 위치에 존재하는 파일을 제거하고 복사한다.
-i : 복사 시 같은 이름의 파일이 존재한다면 덮어쓸것인가 확인한다.
-P : 원본 파일의 소유자, 그룹, 권한 시간 기록을 그대로 복사한다.
-R,-r : 파일과 하위 디렉토리에 포함된 파일 모두를 복사한다.
-s : 디렉토리가 아닌 파일의 심볼릭 링크를 만든다. 소스 파일의 이름은 전체 경로 이름으로 한다 목적지 파일 이름은 전체 결오를 주지 않아도 현재 디렉토리로 간주 되므로 상관 없다.
-u : 새로 수정된 파일만 복사 한다.
-x : 다른 파일 시스템인 하위 디렉토리는 무시한다.
ex) cp -dRP /oracle /mnt
|
|
|
|
Apache 기본 서비스 디렉토리 (DocumentRoot) 변경 |
|
|
|
|
|
|
MacPorts로 Apache + PHP5 + PostgreSQL 설치하기 |
|
|
오픈 소스를 쉽게 설치하기 위한 툴은 MacPorts를 이용해서 프로그램을 설치하는 방법을 알아보도록 한다. MacPorts를 설치하는 방법은 이전 Post인 아래의 Post를 참고하기 바란다.
Mac OS X Lion에서 MacPorts 설치 및 사용
설치순서로는 Apache -> PHP -> postgreSQL 순으로 설치하기로 합니다.
1. Apache 웹서버 설치
sudo port install apache2
2. PHP5 설치
sudo port install php5 +apache2 +postgresql91 + pear
Apache와 PHP5를 설치하였다면 Apache에 PHP5를 사용할 수 있도록 모듈을 추가하고 활성화시켜야 한다.
$ cd /opt/local/apache2/modules
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
모듈추가가 완료되었다면 다시 Apache의 httpd.conf의 환경파일을 수정해 주어야 한다. 아래의 노란색 글자부분을 추가 또는 수정해 주어야 한다.
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
|
<IfModule mime_module>
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
|
# User home directories
Include conf/extra/httpd-userdir.conf
|
다음으로 Apache를 시작시키기 위한 Alias를 등록하여 시작을 편리하게 할 수 있도록 한다.
$ vi ~/.profile
프로파일에 아래의 내용을 추가하고 저장하도록 한다.
alias apache2ctl='sudo /opt/local/apache2/bin/apachectl'
|
3. PostgreSQL 설치
$ sudo port install postgresql91-server
위의 명령으로 PostgreSQL을 설치한다.
$ sudo mkdir -p /opt/local/var/db/postgresql90/defaultdb
$ sudo chown postgres:postgres /opt/local/var/db/postgresql90/defaultdb
$ sudo su postgres -c '/opt/local/lib/postgresql90/bin/initdb -D /opt/local/var/db/postgresql90/defaultdb'
위와 같이 3차례에 걸쳐서 명령을 실행한다. 다음으로 실제 서버를 스타트 하는 명령을 실행한다. 아래의 명령어는 2줄로 보이지만 1줄이다. 붙여서 명령을 실행시켜야 한다.
$ /opt/local/lib/postgresql90/bin/postgres -D /opt/local/var/db/postgresql90/defaultdb
위의 작업을 마치면 본격적으로 사용한 PostgreSQL 서버가 완성된다. 향후 PostgreSQL에 대해 외부에서 접근할 수 있도록 접근권한을 설정하기 위해서는 각 생성된 데이터베이스 내의 pg_hba.conf 파일에 접근권한이 있는 호스트를 등록하여야 접근이 가능하다.
|
|
|
|
Mac OS X Lion에서 MacPorts 설치 및 사용 |
|
|
MacPorts는?
지난 2002년에 OpenDarwin 프로젝트의 하나로 출발한 'MacPorts'는 Mac OS X과 Darwin 위에 오픈 소스 소프트웨어를 쉽게 설치할 수 있도록 한다는 목표 하에 개발되었다. 처음에는 'DarwinPorts'라는 이름으로 시작했으나 2006년 8월 Mac OS Forge(http://macosforge.org)에 새롭게 둥지를 틀면서 프로젝트의 이름은 MacPorts(http://macports.org)로 바뀌게 된다.
MacPorts는 복잡한 의존성 문제를 자동으로 해결하기 위한 간단한 명령어 입력으로 X11 응용 프로그램을 설치하고 업데이트할 수 있도록 도와주며, 현재(2011-08-21) 버전 2.0.1까지 발표된 상태다. 지원하는 패키지 수는 무려 12,135개.
MacPorts를 설치하기 전에 먼저 설치해야 하는 프로그램
MacPorts는 소스를 가져온 후 자동으로 빌드해주는 도구이기 때문에 gcc 등과 같은 컴파일러와 X11 응용 프로그램을 컴파일하기 위한 X11 SDK 등이 반드시 사전에 설치되어 있어야 하며, Mac OS X Lion의 경우에는 Xcode를 설치함으로써 이를 대신할 수 있다. 즉, Xcode만 설치하면 되며, Xcode(http://itunes.apple.com/kr/app/xcode/id448457090?mt=12)는 App Store를 통해서 무료로 설치할 수 있다.
Xcode 설치하기
Xcode 최신 버전(4.1 Build 4B110)은 Mac OS X Lion의 경우에 App Store에서 무료로 다운로드 받아 설치할 수 있다. 그리고 소프트웨어 구성요소 가운데 응용프로그램(Application) 카테고리에 있는 'X11 SDK'를 반드시 설치해야 한다고 하나 필자의 경우에 MacPorts를 설치하기 이전에 Xcode가 미리 기본설정으로 설치되어 있어서 어디서 선택해서 설치해야 하는지는 잘 모르겠다. 현재까지 MacPorts를 사용하는데 문제가 없는 것으로 봐서는 X11 SDK 설치는 기본설정인 것으로 생각되며 그냥 설치하면 자동으로 X11 SDK가 설치되는 것으로 생각된다. 물론 필자가 다시 설치해서 알아보면 되지만 그 정도까지의 정성은 부족하다.
MacPorts 설치 및 환경 변수 등록하기
MacPorts의 Mac OS X Lion 버전은 다운로드 페이지(https:distfiles.macports.org/MacPorts-2.0.1.-10.7-Lion.dmg)에서 내려받을 수 있다. MacPorts를 다운로드 받아서 설치하도록 한다. dmg파일이기 때문에 설치하는 방법을 따로 설명하지는 않는다.
설치가 끝났다면 이제 MacPorts를 사용하기 위한 환경 변수를 등록해줘야 한다. Mac OS X 유틸리티 폴더에 있는 터미널을 실행하고 다음과 같이 입력하자.
sudo port selfupdate
참고로 이 명령어를 입력하고 [return]키를 누르면 암호를 물어보는데, 이때 자신의 계정 암호를 입력하면 된다.
MacPorts 사용 방법
MacPorts는 내려받은 응용 프로그램의 압축을 해제하고 설치하는 과정을 자동으로 처리해주는 도구이기 때문에 프로그램 소스를 어디서 내려받아야 하는지, 이렇게 받은 소스를 어떻게 빌드하는 지와 같은 정보를 받드시 가지고 있어야 한다. 즉 'MacPorts가 패키지를 지원한다'고 당당히 말하기 위해서는 MacPorts가 해당 패키지에 관한 앞서와 같은 정보들을 가지고 있어야만 한다는 뜻이며, 이런 정보들은 Portfile이란 이름으로 저장돼 있다. 보통 Protfile들을 모아 놓은 것을 'port tree'라고 부르며, 최신 패키지들을 설치하기 위해서는 port tree를 최신 상태로 업데이트해야 한다.
이제 본격적으로 port 명령어를 이용해 port tree를 최신 상태로 업데이트한 후 X11 응용 프로그램을 설치하고 제거하는 명령어에 대해 알아보자. 지금부터 나오는 명령어들은 모두 터미널을 실행시킨 후 입력하면 되고 입력이 끝나면 [return]키를 누르면 된다.
MacPort를 최신 상태로 업데이트
sudo port sync
port tree에 어떤 패키지들이 있는지 알아보기
port list
port tree에서 이름 내에 특정 단어가 들어간 패키지 찾아보기
port search 검색어
예) port search font
특정 패키지에 관한 정보 입수하기
port info 패키지이름
예) port info fontforge
패키지 설치하기
sudo port install 패키지이름
예) sudo port install fontforge
이미 설치된 패키지 확인하기
port installed
패키지 제거하기
port uninstall 패키지이름
예) port uninstall fontforge
이미 설치된 패키지들 가운데 새롭게 업데이트된 패키지 찾기
port outdated
업데이트된 패키지들을 모두 업데이트하기
sudo port upgrade outdated
특정 패키지만 업데이트하기
sudo port upgrade 패키지이름
설치된 파일 확인하기
port contents 패키지이름
파일이 어떤 패키지를 통해 설치되었는지 확인하기
port provides 파일경로
예) port provides /opt/local/bin/fontforge
참고문헌
- Mac Madang, Fub 2007, 정태영(master@mytears.org), "Mac OS X에서 UNIX 소프트웨어 한번 써 볼까?"
- MacPorts Guide, " http://guide.macports.org/"
|
|
|
|
|
|
« 2025/04 »
일 |
월 |
화 |
수 |
목 |
금 |
토 |
|
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
|
|
|
|
Total :
Today :
Yesterday : |
|
|
 |
 |
 |
|