[관리] 솔라리스 어드민 – 관리 기법 요약

솔라리스 어드민

1부. 솔라리스 소개

1. 유닉스 정의

유닉스는 1969년에 벨 연구소에서 인터랙티브 시분할 시스템으로서 만든 것이 그 시초가 된 운영체계이다. 켄 톰슨과 데니스 리치가 유닉스의 창시자로 알려져 있다. 유닉스라는 이름은 그 이전의 시스템인 멀틱스에 기반을 두고 지은 일종의 말장난이었다. 1974년에 유닉스는 C 언어로 쓰여진 최초의 운영체계가 되었다. 유닉스는 여러 회사들이나 대학 및 개인들에 의해 많은 확장판과 새로운 아이디어들이 다양한 버전의 유닉스에 추가됨으로써, 대형 프리웨어 제품의 한 종류로 진화하였다. 유닉스는 앞서가는 특정 컴퓨터 회사들에 의해 소유된 독점적인 운영체계가 아니었다는 것과, 또 그것이 표준 프로그래밍 언어로 작성되고, 대중적인 많은 아이디어를 받아들였다는 이유 때문에, 누구에 의해서도 개선되고 강화될 수 있는 최초의 개방형 표준 운영체계가 되었다. 다양한 버전의 유닉스로부터 나온 C 언어와 쉘 인터페이스의 복합체는 IEEE의 찬조 하에서 POSIX로 표준화되었다. POSIX 인터페이스들은 번갈아 가며, X/Open 프로그래밍 가이드 4.2 (“단일 유닉스 규격”과 “유닉스95″로 알려져 있다)에 명기되었다. 단일 유닉스 규격의 버전2는 유닉스98로도 알려져 있다. 유닉스의 공식적인 등록상표는 현재 산업표준기구인 오픈 그룹이 소유하고 있으며, 유닉스 관련 제품들의 인증과 상표부여 등을 관장하고 있다.

유닉스 운영체계는 널리 판매된 썬마이크로시스템즈(Solaris), 실리콘그래픽스(IRIX), IBM(AIX), 그리고 그 외 많은 회사들의 워크스테이션 제품들에서 사용된다. 유닉스 환경과 클라이언트/서버 프로그램 모델은 인터넷 개발과 네트워크 중심의 컴퓨팅 국면을 새로이 하기 위한 중요한 요소였다. 유닉스에서 파생하여, 현재 무료 소프트웨어와 상용버전이 모두 존재하는 리눅스는 독점 운영체계의 대안으로서 명성을 더해가고 있다.

2. 유닉스의 특징

– 멀티태스킹과 멀티유저 지원

– 용이한 이식성

– 계층적 파일 시스템 구조 (Hierarchical File System)

– Security 및 Protection 기능

– 입출력의 방향 전환 및 파이프 기능

– 확장성과 조직성이 풍부한 Shell

– 각종 Special Devices의 독립성

– 유연성 있는 커뮤니케이션을 할 수 있는 운영체제

– 언어 및 유틸리티가 다양하여 프로그램 개발이 용이

3. UNIX의 구성요소

1) Kernel : Unix의 핵이며 File system, Device, Memory, Process 관리.

2) Shell : Command Interpreter로 사용자와 커널간의 인터페이스 역할과 명령을 해석.

3) File System (Directory Tree)

파일 시스템은 커널이 데이터를 관리하기 위한 파일 또는 디렉터리의 관리 구조이다.

4. UNIX의 종류

– Sun OS : 썬 마이크로시스템즈에서 제공하는 BSD 계열의 UNIX

– Solaris : 썬 마이크로시스템즈에서 제공하는 System V 계열의 UNIX

– HP/UX : HP의 UNIX 시스템은 OSF/1(Open Software Foundation)의 여러 특징을 도입한 System V의 변형된 형태

– AIX : IBM에서 System V release 4의 4.4 BSD 버전과 OSF/1을 기반으로 만들어낸 UNIX

– Digital UNIX: OSF그룹에서 System VR3과 4.3 BSD버전을 결합시키고 OSF/1을 기반으로 발전된 DEC(현재 Compaq)의 UNIX

– IRIX : 실리콘 그래픽스에서 BSD와 System V계열의 UNIX를 기반으로 만들어진 UNIX

5. Solaris OS

4.2 버전까지 BSD를 만들던 버클리의 빌 조이가 썬 마이크로시스템즈로 옮겨가서 만든 것이 SUN OS이며 썬 마이크로시스템즈가 AT&T의 System V release 4.0의 라이선스를 받아 만든 것이 Solaris이다.

1) 버전간의 관계

Solaris 2.x = Sun OS 5.x + Open Windows + ONC+(Open Network Computing: NFS, NIS, NIS+등)

Solaris 7 = Sun OS 5.7 + Open Windows, CDE(Common Desktop Env) + ONC+(Open Network Computing: NFS, NIS, NIS+등)

Solaris 8 = Sun OS 5.8 + OpenWindows, CDE(Common Desktop Env) + ONC+(Open Network Computing: NFS, NIS, NIS+등)

Solaris 9 = Sun OS 5.9 + OpenWindows, CDE(Common Desktop Env) + ONC+(Open Network Computing: NFS, NIS, NIS+등)

2) 장비 별 지원 OS 버전

SunOS 5.x = Solaris 2.x

Sun dropped the “2.” when Solaris (2.)7 came out.

I.e. Solaris 7 = “Solaris 2.7” = SunOS 5.7,

Solaris 8 = “Solaris 2.8” = SunOS 5.8 and so on.

Sun2: SunOS 4.0.3 or earlier.

Sun386i: SunOS 4.0, 4.0.1, 4.0.2 only.

Sun3: SunOS 4.1.1 or earlier.

4/100, 4/200 series: SunOS 3.2, SunOS 4.0 through 5.4

4/300 series: SunOS 4.0.3 through 5.4

4/400 series: SunOS 4.1PSR_A through 5.4

600 models 120, 140: SunOS 4.1.2 through 5.5.1

600 model 41, 51: SunOS 4.1.3 through 5.5.1

SPARCstation 1, 1+, SLC, IPC: SunOS 4.0.3 through 5.7

SPARCstation 2, ELC, IPX: SunOS 4.1.1 through 5.7

SPARCstation 4: SunOS 4.1.4 or later.

SPARCstation 5: SunOS 4.1.3_U1B or later.

SPARCstation 10 models 20, 30, 40, 41, 51, 61, 71: SunOS 4.1.3 or later.

SPARCstation 20 models 50, 51, 61, 71: SunOS 4.1.3_U1B or later.

SPARCstation 20 model HS11, HS21, 151: SunOS 4.1.4 or later.

SPARCclassic, SPARCstation LX: SunOS 4.1.3C or later.

SPARCstation Voyager: Solaris 2.3 edition II or later.

Ultra 1 model 140, 170: Solaris 2.5 or later.

Ultra 1 model 140E, 170E, 200E: Solaris 2.5.1 or later.

Ultra 2: Solaris 2.5.1 or later.

Ultra 5, 10, 30, 60, 250, 450: Solaris 2.5.1HW1297 or Solaris 2.6HW0398 or later.

Ultra Enterprise: Solaris 2.5.1 or later.

SunBlade 100, SunBlade 1000, SunFire 280R: Solaris 8HW1000 or later.

SunFire 3800, 4800, 4810, 6800: Solaris 8HW0401 or later.

– OS 버전의 확인

# uname -a

SunOS sonamu 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-1

– 솔라리스 정보

솔라리스 9

http://kr.sun.com/products/software/os_platforms/solaris/index.html

솔라리스 8

http://kr.sun.com/products/software/os_platforms/solaris/8/index.html

전체 버전 간의 차이 비교

http://wwws.sun.com/software/solaris/fcc/fcc.html

솔라리스 x86(Intel) 하드웨어 호환 리스트(HCL)

http://www.sun.com/bigadmin/hcl/

6. SUN & Solaris 관련 사이트

1) 썬 관련 레퍼런스 (추천)

http://www.stokely.com/unix.sysadm.resources/faqs.sun.html

2) 썬 공식 도큐먼트

http://docs.sun.com

http://www.sun.com/bigadmin/(BigAdmin System Administration Portal)

3) SUN관련 FAQ

http://www.science.uva.nl/pub/solaris/solaris2.html(Solaris2 FAQ)

http://www.mreriksson.net/faqs/solaris8/(Ola Eriksson’s FAQ for Sun Solaris )

http://wks.uts.ohio-state.edu/sun/faqs/s86faq.html( Intel FAQ)

http://item-hunter.com/~chang/src/lecture/faq/sol2faq.html(한글)

http://hawk.com.kyungnam.ac.kr/~opti21/unix/faq/index.html(han.comp.sys.sun FAQ 한글)

4) Sun Managers Summaries & Archives Search

http://www.sunmanagers.org( 공식 홈페이지)

http://www.sunmanagers.org/archives.html( 아카이브 리스트)

http://www.latech.edu/sunman-search.html( 아카이브 검색)

http://news.google.co.kr( 모든 뉴스 그룹 검색)

5) 장비 관련

http://sunsolve.sun.com/handbook_pub/Systems/( SUN 시스템 핸드북)

http://sunsolve.sun.com/handbook_pub/Devices/( SUN 부붐별 핸드북)

2부. 솔라리스의 접근과 사용자 관리

1. 시스템의 접근

1) Consol로 직접 로그인과 telnet, rsh, ssh (Shell 사용), Xmanager(Windows 사용) 등의 원격 로그인

– telnet : 이 기종간의 시스템 접근 가능 ( Port 23)

– rsh : Unix 기종간의 시스템 접근 가능

– ssh: Unix 기종간의 시스템 접근 가능 (보안쉘, Port 22)

http://www.openssl.org

http://www.openssh.org

2) 시스템 사용자: root와 일반 사용자

root: 슈퍼유저, 시스템 어드민, 초기 설치 시 패스워드 결정, 모든 권한, 기본쉘은 /sbin/sh

일반유저: 일반사용자.

3) 관련 파일

/etc/passwd 파일

user1:x:102:10:User Account 1: /export/home/user1:/bin/ksh

/etc/shadow 파일

user01:haN3NqcDfof.2:::::::

/etc/group 파일

other::1:user01,user02

4) 사용자 관리

/usr/bin/passwd 명령 : 자신의 패스워드 변경 (일반 유저), 다른 사용자의 패스워드 변경(root)

* 패스워드 생성 규칙(일반유저)

– 6~8 문자

– 두 개의 알파벳과 하나의 특수문자 또는 숫자 포함

– 로긴 이름과 다르게

– 변경 전 패스워드와 다르게

– 공백을 포함할 수 있다.

/usr/sbin/groupadd 명령 : 그룹을 생성 ( GID는 100 ~ 60000 번까지)

ex) # groupadd -g 100 class1

/usr/sbin/useradd 명령 : 유저를 생성 ( UID는 100 ~ 60000 번까지)

ex) # useradd -u 501 -g 100 -d /export/home/user01 -m -c “User Account 1” -s /bin/ksh user01

/usr/sbin/groupdel 명령 : 그룹을 제거

ex) # groupdel class1

/usr/sbin/userdel 명령: 유저를 제거

ex) # userdel [-r] user01

/usr/sbin/usermod, /usr/sbin/groupmod 는 수정 시 사용

* 어드민 GUI 툴 : 사용자, 그룹, 호스트, 프린터, 직렬포트, 소프트웨어, 14(sysadmin) 그룹은 사용가능.

/usr/bin/admintool

3부. 사용자 기본 명령

사용자 기본명령은 다음을 참고한다.

http://www.gohtml.pe.kr/lec/unix1.html

http://unix.co.kr/data/solaris/?p=16

http://whoami21.com/~kimlee/telnet1.htm

http://www.hwaseong.ms.kr/unix1.htm

1. 정보 출력

1) 시스템 이름 및 OS버전 확인

$ uname -a

$ cat /etc/release (=> OS의 릴리즈 확인)

2) 현재 로그인한 사용자 정보

$ who (/var/adm/utmpx)

3) 최근 로긴했던 사용자 정보 + 재 부팅 정보

$ last (/var/adm/wtmpx)

$ last user01

$ last reboot

4) 프로세스 정보

$ ps -ef | grep netscape

$ pgrep netscape (solaris 8부터)

5) 날짜 및 시간 출력

$ date

$ cal

6) 맨 페이지

$ man man

$ man -k calendar

cf. # catman -w (관리자 root가 실행)

$ man -s5 man (5 section manual)

– Section Definition –

관련 파일: /usr/share/man/man.cf, /usr/share/man/entities/*

1: User Commands

1M: System Administration Commands

2: System Calls

3: Basic Library Functions

4: File Formats

5: Standards, Environments and Macros

6: Demos

7: Device and Network Interfaces

9: Device Driver Interfaces

– 맨페이지 위치

/usr/share/man/

/usr/openwin/man/

/usr/dt/man

– 맨페이지 추가

# vi /etc/profile



MANPATH=/usr/share/man:/usr/openwin/man:/usr/dt/man:<추가할 맨페이지 디렉토리>

export MANPATH

2. 파일과 디렉토리 접근

주의 – 파일과 디렉토리, 명령 등은 모두 대소문자를 구별한다.

1) 패스이름

– 절대경로(Absolute Path Name) : root(/)를 기준으로 기술, /usr/local/src/file1

– 상대경로(Relative Path Name) : 현재 디렉터리를 기준으로 .또는 ..으로 기술, dir1/subdir1/file2

2) 관련 명령어

– ls(list) : 파일 또는 디렉터리의 리스트를 출력

– pwd(print working directory) : 현재 작업 디렉터리의 위치를 출력

– cd(change directory) : 작업 디렉토리를 변경

3. 파일과 디렉토리를 다루는 명령

– file : 파일 타입을 확인 (text, data, executable or binary)

– cat(catenate) : 주로 짧은 text파일을 볼 때

– more : 주로 긴 text파일을 볼 때

– strings: 바이너리 파일의 문자열만 보고자 할 때

– head: text파일의 머리부분(디폴트 10줄)만 보고자 할 때

– tail: text파일의 끝부분(디폴트 10줄)만 보고자 할 때 (tail -f /var/log/messages)

– wc(word count) : text파일의 라인 수, 단어 수, 문자 수를 알고자 할 때 ( wc file1)

– touch : 빈 파일을 생성할 때

– tee : 화면 출력과 파일 저장을 동시에 하고자 할 때 (ls -lR | tee logfile | more)

– mkdir : 디렉토리를 생성할 때

– rmdir : 빈 디렉토리를 제거할 때

– rm -r : 디렉토리를 제거할 때

– cp : 파일을 복사할 때

– cp -r : 디렉토리를 복사할 때

– mv : 파일 또는 디렉토리를 이름변경 또는 옮길 때

4. 파일과 텍스트 검색

– find : 파일 또는 디렉토리를 찾을 때

$ find / -name core

$ find ~ -name core -exec rm {} \\;

$ find . -mtime +90

$ find ~ -size +57

$ find /usr -name ‘*tif’

– cmp, diff : 두 파일의 차이를 비교할 때

– sort : 파일의 내용 또는 리스트를 정렬할 때

$ ls -l | sort

$ du -ks /etc/* | sort -nr

– grep : 파일의 특정 문자열이 있는 라인을 출력

$ grep user01 /etc/passwd

$ ps -ef | grep ksh

5. 파일의 보안

$ ls -l

-rw-r–r– 1 borisu staff 8239 2002년 8월 29일 backup.txt

-rw-r–r– 1 borisu staff 2361 2002년 9월 3일 memo.txt

drwx—— 5 borisu staff 512 5월 20일 11:55 shell/

-rw-r–r– 1 borisu staff 1660 4월 25일 01:37 ssh-setup.sh

File Type: -, f , d, c, b

Permission: read(r:4), write(w:2), execute(x:1)

User, Group, Others

1) 퍼미션 설정

$ chmod u+x file1 (symbolic mode)

$ chmod a=rx file1 (symbolic mode)

$ chmod 644 file1 (octal mode)

2) 소유권 변경 (root)

# chown user01 file1 (파일 소유자 변경 시)

# chgrp class1 file1 (파일 그룹 소유자 변경 시)

# chown -R user01:class1 dir1 (디렉토리 변경 시)

3) umask : 기본 퍼미션 제한

$ umask (확인)

$ touch file1

$ mkdir dir1

$ umask 027 (재설정)

$ touch fie2

$ touch dir2

6. Visual Editor (VI)

유닉스의 기본 편집기는 vi가 있고, 그밖에 emacs 등이 있다. GUI로는 dtpad가 있다.

– vi의 세가지 모드

Command Mode (명령 모드)

Edit Mode (편집 모드)

Last Line Mode (마지막 명령 라인 모드)

– vi 레퍼런스 카드 및 메뉴얼

http://kldp.org/응용_프로그램/에디터/Vi/

7. Archiving User Data

1) Archive 관련 명령

tar – Creates and extracts files from a tape device or file archive

compress, uncompress – Compress and uncompress a file

zcat – Uncompress a compressed file and sends the output to the screen without changing the compressed file.

gzip, gunzip – Compresses and uncompressed

gzcat – Uncompress a gzipped file and sends the output to the screen without changing the gzipped file

zip, unzip – Packages and compresses files and uncompressed files.

jar – Packages and comresses multiple files to a single archive file

cpio – Copies and extracts files fro a file archive or tape device.

[ tar ]

내용만 볼 때: tar tvf name.tar

풀 때 : tar xvf name.tar

만들 때 : tar cvf name.tar file1 file2 file3

tar cvf name.tar dir1

$ cd

$ mkdir testdir

$ cd testdir

$ cp /etc/profile file1

$ man ls | col -b > file2

$ tar cvf first.tar file1 file2

$ rm file? ; ls

$ tar tvf first.tar

$ tar xvf first.tar

$ cd ..

$ tar cvf second.tar testdir

$ rm -rf testdir

$ tar tvf second.tar

$ tar xvf second.tar

[ compress & uncompress ]

$ compress second.tar

$ ls

$ uncompress second.tar.Z

$ tar xvf second.tar

cf. zcat second.tar.Z | tar xvf –

cf. compress -dc second.tar.Z | tar xvf –

cf. uncompress -c second.tar.Z | tar xvf –

[ gzip ]

$ cd

$ cd ..

$ ls

$ tar cvf /var/tmp/myhome.tar user01

$ cd /var/tmp; ls

$ gzip myhome.tar

$ ls

$ gzip -d myhome.tar.gz

$ tar tvf myhome.tar

$ tar xvf myhome.tar

cf. gzcat myhome.tar.gz | tar xvf –

cf. gzip -dc myhome.tar.gz | tar xvf –

cf. gunzip -c myhome.tar.gz | tar xvf –

cf. gtar xvfz myhome.tar.gz

[ jar ]

$ jar cvf dir1.jar dir1

$ jar tvf dir1.jar

$ jar xvf dir1.jar

8. 원격지 접속

원격지 접속은 telnet, rlogin, ftp, ssh등이 있다.

1) telnet

원격 호스트의 user name과 password가 필요

$ telnet host1

…(접속해서 사용)

$ exit (로그 아웃)

2) rlogin

원격 호스트에서 허락된 호스트 또는 유저의 경우 패스워드가 필요 없다.

자세한 사용법은 다음을 참고한다.

http://nscp.upenn.edu/aix4.3html/cmds/aixcmds4/rlogin.htm

– 일반유저: /etc/hosts.equiv, $HOME/.rhosts

– root : /.rhosts

– 파일 형식 : 호스트 명 유저

$ rlogin host2

…(접속해서 사용)

$ exit (로그 아웃)

cf. rsh host1 hostname

cf. rcp file1 host1:/tmp

3) ssh (secure Shell)

명령어: ssh, scp, sftp

관련사이트:

http://www.openssl.org

http://www.openssh.org

관련 문서:

ssh howto

http://kldp.org/~eunjea/ssh/index.html

ssh install for solaris

http://www.sunfreeware.com/openssh.html

4) ftp

[ 접속 및 연결 끊기 ]

1) 일반 유저로 로긴

$ ftp server_name

또는

$ ftp

ftp> open server_name

ftp> user login_id

ftp> close

ftp> open new_server

ftp> quit

2) Anonymous 로긴

$ ftp server_name

Login: ftp ( or anonymous)

password:user01@suned.co.kr

[ 기본 설정 옵션 ]

ftp> hash (on/off: 전송상태를 표시)

ftp> ver (on/off: Verbose mode)

ftp> bin (Binary mode)

ftp> asc (ASCII mode)

ftp> prompt (on/off: 다중 파일 전송시 프롬프트 on/off)

[ 기본 명령 ]

ftp> cd (디렉토리를 옮길 때: REMOTE )

ftp> ls (디렉토리 내용을 볼 때: REMOTE )

ftp> pwd (현재 디렉토리 위치 확인: REMOTE)

ftp> lcd (디렉토리를 옮길 때: LOCAL )

ftp> !ls (디렉토리 내용을 볼 때: LOCAL )

ftp> !pwd (현재 디렉토리 위치 확인: LOCAL)

ftp> ! (Shell로 잠시 빠져나감: LOCAL)

[ 파일 전송 ]

ftp> get remote_file [local_file] (받을 때)

ftp> mget file1 file2 file3 file4 (여러 파일을 받을 때)

ftp> put local_file [remote_file] (올릴 때)

ftp> mput file1 file2 file3 file4 (여러 파일을 받을 때)

[ 기타 명령어 ]

ftp> del file_name (파일 지우기: REMOTE)

ftp> mkdir dir_name (디렉토리 만들기: REMOTE)

ftp> help (도움말 보기: REMOTE)

5) X 서버로의 접근

윈도우용 Client프로그램으로는 Xmanager가 유명하다. 다음 문서를 참조한다.

– 사용법

http://compedu.inue.ac.kr/~chlee56/wowlinux/xmanager.htm

– 다운로드

http://netsarang.co.kr/download/download.html

9. 시스템 프로세스

process : 프로그램이 메모리에 올라와 동작하고 있는 상태.

PID : 프로세스의 고유 ID (커널이 관리)

Daemon: 백그라운드로 실행, 부팅 시 동작, 서버 프로세스

1) 프로세스 정보

$ ps -ef | more

UID PID PPID C STIME TTY TIME CMD

root 0 0 0 4월 25 ? 0:00 sched

root 1 0 0 4월 25 ? 0:05 /etc/init –

root 2 0 0 4월 25 ? 0:00 pageout

root 3 0 0 4월 25 ? 86:09 fsflush

root 279 1 0 4월 25 ? 0:00 /usr/lib/saf/sac -t 300

root 204 1 0 4월 25 ? 0:00 /usr/lib/utmpd

root 134 1 0 4월 25 ? 0:02 /usr/sbin/rpcbind

$ ps -ef | grep lp

$ pgrep -l lp (solaris 8부터)

2)프로세스 종료

– 시그널 정의

$ man -s 3HEAD signal

Name Value Default Event

SIGHUP 1 Exit Hangup (see termio(7I))

SIGINT 2 Exit Interrupt (see termio(7I))

SIGKILL 9 Exit Killed

SIGTERM 15 Exit Terminated (==> Control + C)

– 프로세스 종료

$ kill [-signal] PID …

$ kill <PID>

$ kill -9 <PID>

$ kill -KILL <PID>

$ pgrep -l mail

215 sendmail

12047 dtmail

$ kill 12047

$ pkill -KILL 프로세스 이름

– 자신이 사용하는 워크스테이션이 윈도우 hang시 처리요령

다른 시스템에서 다음과 같이 한다.

$ telnet (또는 rlogin) host1

$ pkill -9 <자신의 쉘이름, ex) ksh>

또는

$ pkill -KILL <자신의 쉘이름 ex) ksh>

3) 잡 제어 ( Job Control )

여러 개의 작업을 수행하고 이를 제어할 수 있다. 단 본쉘(sh)는 불가

$ find . -name core > list & ( Job을 background로 실행)

$ jobs ( Job을 확인)

[1] = running find . -name core > list &

$ fg %1 ( 백그라운드 잡을 포그라운드로)

Control + Z ( 포그라운드 잡을 중지)

$ jobs ( job을 확인)

$ bg %1 (중지된 잡을 백그라운드로 실행)

$ kill %1 (잡을 종료)

10. 쉘 (Shell)

명령해석기, 사용자 인터프리터라고도 한다. 쉘 각각의 자세한 문서는 다음을 참고한다.

http://dir.yahoo.com/Computers_and_Internet/Software/Operating_Systems/UNIX/Shells/

Shell 종류 Shell 프로그램 위치 프롬프트 프롬프트 변수 쉘초기화 파일

Bourn Shell /bin/sh, /sbin/sh #, $ PS1 /etc/profile, $HOME/.profile

Korn Shell /bin/ksh #, $ PS1 /etc/profile, $HOME/.profile, $HOME/.kshrc

C Shell /bin/csh hostname#, hostname% prompt /etc/.login, $HOME/.cshrc, $HOME/.login

– 현재 사용쉘 확인

$ ps

$ echo $SHELL

– 기타 쉘

bash, tcsh, zsh, ssh

– 관련 디렉토리

/etc/skell : 샘플 초기화 파일 위치

1) 입출력의 전환

$ mailx user1 < ~/myfile ( 입력의 방향을 파일로부터 )

$ ps -ef > file_list (출력의 방향을 파일로 전환)

$ cat /etc/passwd >> file_list (출력의 방향을 파일로 전환, append)

$ ls /var /no 1> dat 2>&1

2) 파이프 (프로세스 간 통신)

$ who | wc -l

$ ls -F /etc | grep “/”

$ head -10 file1 | tail -3 | lp

$ ps -ef | tail +2 | wc -l

3) Meta Character

– Backslashes (\\)

– Dollar signs ($)

– Back quotation marks (` `)

– quotation marks (‘ ‘)

– double quotation marks (” “)

$ rm \\*

$ echo ‘$SHELL’

$ echo “$SHELL”

$ echo “\\$SHELL”

$ echo date

$ echo `date`

11. Korn Shell Features

1) Aliases

alias aliasname=”command”

ex)

$ alias h=history

$ alias c=clear

$ alias home=’cd;ls’

$ alias ls=’ls -F’

$ alias copy=”cp -r”

2) Command line Editing

– Command line 편집 기능

$ set -o vi

$ [esc] + k (=> vi command mode )

3) History

– 128개를 유지 ( 변수 HISTSIZE -> .kshrc)

– $HOME/.sh_history (변수 HISTFILE -> .kshrc)

ex)

$ history ( 최근 16개 명령을 list)

$ history 23 (23 ~ 최근명령)

$ history -10 (최근 명령 10개)

cf)

$ r ( 가장 최근 명령 실행)

$ r p ( p로 시작된 가장 최근 명령어 실행)

$ r 23 ( 히스토리가 23번인 명령어 실행)

4) Ignore Control-d (ignoreeof)

– Control-d의 기능: 1) EOF, 2) EXIT

ex)

$ ^d

$ set -o ignoreeof (=>설정 eof:on, exit:off)

$ ^d

$ set +o ignoreeof (=>해제 eof:on, exit:on)

5) .profile과 분리된 초기화 파일 (.kshrc)

– $HOME/.kshrc (C쉘: $HOME/.cshrc)

– 환경변수는 .profile에 기록

– 기타변수 및 콘쉘 제공 기능 등은 .kshrc에 기록

ex)

$ . ~/.kshrc ( 재 초기화 )

6) Job Control

ex)

$ find / -name core -exec rm {} \\;

^Z (=> suspend)

[1] + stop … (=> [1]은 잡번호)

$ bg %1 ( 1번 잡을 백그라운드로 실행)

$ jobs ( 잡 확인)

$ fg %1 ( 1번 잡을 포그라운드로 실행)

$ ^+C ( 포그라운드 잡을 종료)

$ jobs

7) 덮어쓰기 방지 (noclobber)

ex)

$ touch testfile

$ cat /etc/passwd > testfile

$ cat testfile

$ cat /etc/profile > testfile

$ cat testfile

$ set -o noclobber

$ cat /etc/hosts > testfile ( => 경고메시지가 떨어짐)

12. Korn Shell Initialization

– Korn Shell 초기화 순서

(1) /etc/profile

(2) $HOME/.profile

(3) $HOME/.kshrc

1) $HOME/.profile 설정하기

$ vi ~/.profile

stty cs8 erase ‘^H’ -istrip ( -> 터미널 설정 )

PATH=$PATH:/usr/local/bin:/usr/ccs/bin:/usr/ucb (-> Path 설정)

EXINIT=”set ai nu ts=3 showmode” (-> vi 환경설정)

ENV=”$HOME/.kshrc” ( -> .kshrc 확장쉘 변수 설정)

LPDEST=”lp1″ (-> Default Printer Set )

EDITOR=”vi” ( -> Default Editor Set )

export PATH EXINIT ENV LPDEST EDITOR ( 전역변수 선언 )

$ . ~/.profile ( .profile 재 초기화)

2) $HOME/.kshrc 설정하기

$ vi ~/.kshrc

HOSTNAME=`uname -n`

PS1='[$LOGNAME@$HOSTNAME:$PWD]$ ‘ (-> 프롬프트 변경)

export PS1 HOSTNAME (-> 전역변수 선언)

## My Alias Def (-> 엘리어스 설정 )

alias ls=’ls -F’

alias rm=’rm -i’

alias mv=’mv -i’

alias cp=’cp -i’

alias home=’cd;ls’

alias c=clear

alias h=history

alias d=date

## Other ksh feature set

set -o noclobber

set -o vi

set -o ignoreeof

$ . ~/.kshrc (-> .kshrc 재 초기화)

13. 쉘 프로그래밍

– 쉘 프로그래밍 강좌

http://kldp.org/KoreanDoc/Shell_Programming-KLDP

http://myhome.naver.com/yskim511/21.htm

4부. 시스템 어드민

1. UNIX 파일의 종류와 특성

– 파일은 파일이름, inode, data block으로 구성되어 있다.

– 파일의 종류는 ls -l , ls -F, file 등의 명령어로 확인할 수 있다.

1) 파일의 종류

-: Regular File (Ordinary File) : vi, ed, cp, mv, cat, touch, cc 등에 의해 생성

d: Directory File : mkdir, cp -r 등에 의해 생성

c,b: Special File ( 디바이스 파일) : 장치 파일이며 drvconfig, devfsadm등에 의해 생성

brw-r—– 1 root sys 32, 0 2000년 7월 4일 /devices/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0:a

crw-r—– 1 root sys 32, 0 2000년 7월 4일 /devices/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0:a

l: Symbolic Link File: 심볼릭 링크 파일

lrwxrwxrwx 1 root root 12 2000년 7월 4일 /etc/hosts -> ./inet/hosts

$ ln -s file1 file2 (심볼릭 링크)

$ ln file2 file3 (하드 링크)

$ rm file1 (원본을 제거함)

$ cat file2 file3 ( file2는 볼 수 없음)

– 링크란 어떤 파일의 또 다른 이름이다.

– 하드링크는 같은 inode를 심볼릭 링크는 다른 inode를 갖는다.

– 하드링크는 디렉토리를 링크할 수 없다.

– 하드링크는 서로 다른 파일시스템 간에 링크할 수 없다.

– 하드링크는 원본파일의 데이터와 같은 데이터를 공유하며, 심볼릭 링크는 원본의 PATH값을 데이터로 갖는다.

– 심볼릭 링크의 예

/etc/hosts -> /etc/inet/hosts

/bin -> /usr/sbin

– 하드링크의 예

/etc/init.d/* -> /etc/rc#.d/*

2) inode

모든 파일은 하나의 inode를 가지며 이것은 해당 파일에 대한 정보를 가진다. inode table은 inode들로 구성되어 있으며

하나의 inode는 ls-l정보, 데이터블록 포인터, shadow inode 포인터로 이루어져 있다. 포인터들이 가리킬 수 있는 데이터 블록의

사이즈는 최대 1T까지 가능하다.

– 파일과 파일시스템의 최대 사이즈

solaris 2.6 이전 : 2G (파일), 1TB (파일 시스템)

solaris 2.6부터 : 2G이상 1TB (파일), 1TB (파일 시스템)

파일의 경우 실재로는 866G까지 가능하며, 파일 시스템의 1T이상은 Virtual Volume(Meta Device, Veritas Volume Manager)을 구성해야 한다.

2. Boot PROM (Programmable Read Only Memory)

– PROM 관련 문서

Frequently Asked Questions about Sun NVRAM/hostid

http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html

Sun Flash PROM Guide for Workstations and Workgroup Servers – Standalone Version

http://www.sun.com/products-n-solutions/hardware/docs/pdf/802-3233-23.pdf

Updating the Flash PROM on the Ultra 1, Ultra 2, Ultra 450, and Sun Enterprise 450 Systems

http://docs.sun.com/db/doc/816-2583-10/6m8u2cukc?a=view

Updating the Flash PROM on the Sun Enterprise 3×00, 4×00, 5×00, and 6×00 Systems

http://docs.sun.com/db/doc/816-2583-10/6m8u2cukk?a=view

1) PROM이 하는 역할

– Test the system hardware (POST: Power on Self Test)

– Boot the operating system

[ POST ]

– Initialize the system

– Probes Memory and the CPU

– Probes devices, interprets their devices and build a dev tree

– Install the console

2) PROM으로 가는 방법

– # halt

– # init 0

– # /usr/sbin/shutdown -y -g0 -i0

– Stop + A ( 부팅 시 바로 누르거나 시스템 hang시에만 적용)

3) PROM에서의 얻을 수 있는 정보

OK banner ( 시스템 모델명, 메모리, hostid, Ethernet Addr, Boot PROM 버전 )

OK probe-scsi ( 연결된 SCSI 장치들의 정보 확인)

4) PROM 버전

1.x : Original Sparc Boot PROM

2.x : Open Boot PROM (OBP) => sparc 시리즈 (sparc4,5,10,20…등)

3.x : Open Boot PROM with Flash Update (Flash PROM) => ultra sparc 시리즈

5) PROM에서 사용되는 명령어

OK help (도움말)

OK probe-scsi (스카시 장비 체크)

OK prebe-ide ( IDE장비 체크)

OK devalias (PROM에 설정되어 있는 장비의 물리적 장치명과 별명)

OK show-devs ( PROM에 설정되어 있는 물리적 장치의 트리구조 보기)

OK printenv (PROM에 설정되어 있는 부트 파라미터의 기본 값을 확인)

OK setenv <parameter_name> <value>

OK reset ( setenv에 의해 변경된 파라미터 값들을 재 저장하는 명령)

OK set-default <parameter_name> ( 지정한 파라미터 값을 초기화)

OK set-defaults ( 지정한 모든 파라미터 값들을 초기화 => STOP + N)

6) PROM의 부트 명령어

OK boot [ device name ] -[option]

OK boot [disk, net, cdrom] (=> default는 disk)

OK boot -s (싱글유저로 부팅)

OK boot -a (Interactive 모드로 부팅)

OK boot -r (Reconfiguration Boot => 장치를 추가했을 때)

7) OS의 PROM관련 시스템 명령어

# eeprom (확인)

# eeprom boot-device ( 확인)

# eeprom auto-boot?=false (설정)

# eeprom ‘auto-boot?=false’ (csh의 경우)

3. 부트 프로세스 (Boot Process)

1) 부팅의 단계는 다음과 같다.

(1) 부트 PROM 단계

– PROM이 POST(Power On Self Test)를 실행

– 부트 디바이스를 결정

– 부트 프로그램인 bootblk를 로드

(2) 부트 프로그램 단계

– bootblk는 두 번째 부트 프로그램인 ufsboot를 로드

– ufsboot는 커널을 로드( 32bit, 64bit kernel)

(3) 커널 초기화 단계

– 커널(/kernel/unix, /usr/kernel, /platform/`uname -m`/kernel)은 자신을 초기화하고 모듈을 로드 한다.

– Configuration 파일인 /etc/system을 읽는다.

(4) init 단계

– 커널이 /sbin/init을 실행한다.

– init은 /etc/initab을 읽는다.

– 필요한 데몬을 실행한다.

2) 32 또는 64 bit 커널의 확인 및 변경

64bit의 경우 OS는 Solaris7부터, 시스템 아키텍처는 sun4u(ultra sparc) 이상에서이다.

– 확인하기

# isainfo -kv

32-bit sparc kernel modules (=> 32일 경우)

64-bit sparc kernel modules (=> 64일 경우)

– 64bit -> 32bit

OK boot kernel/unix

– 32bit -> 64bit

OK boot kernel/sparcv9/unix

cf. 64bit 커널 지정하기

# vi /platform/sun4u/boot.conf



ALLOW_64BIT_KERNEL_ULTRASPARC_1_CPU=true

3) 커널 파라미터 수정

보다 자세한 사항은 다음을 참조한다.

– Solaris Tunable Parameters Reference Manual

http://docs.sun.com/db/doc/816-0607

i) 최대 사용자수 지정( maxusers)

set maxusers=100

ii) 최대 프로세스 개수 지정 (max_nprocs)

set max_nprocs=100

iii) 가상 단말기 개수 지정 ( pt_cnt)

– 리부팅시에는 반드시 reconfiguration boot

set pt_cnt=128

set npty=128

iiii) 최대 파일 디스크립트 개수 지정하기 (rlim_fd_cur)

– 하나의 프로세스가 동시에 오픈할 수 있는 최대 파일 개수

– # ulimit descriptors 512

– # ulimit -n 512

set rlim_fd_max=1500

set rlim_fd_cur=128

iiiii) 최대 UFS inode수 지정( ufs_ninode)

– 시스템에서 파일을 오픈 하면 하나의 파일에 대하여

하나의 ufs_ninode를 가지게 된다.

set ufs_ninode=10000

[ How to Setup Kernel Parameter ]

i) backup /etc/system file

# cp /etc/system /etc/system.org

ii) Edit /etc/system file

# vi /etc/system

… (다음을 추가)

set pt_max_pty=10

iii) Reconfiguration Boot

# reboot — -r

iiii) 윈도우에서 터미널을 여러 개 띄워 max값을 확인

[ How to recover /etc/system File ]

i) Edit /etc/system file

# vi /etc/system

… (다음을 추가)

exclude: drv/dad

ii) reboot

# reboot

iii) Boots the system interactively

OK boot -a



Enter filename of kernel (kernel/unix): <Enter>

Enter default directory for modules (kernel, /usr/kernel): <Enter>

Enter name of system file (etc/system): /etc/system.org

Enter default root file system type (ufs): <Enter>

Enter physical name of root device: <Enter>

iiii) Recover /etc/system file

# cp /etc/system.org /etc/system

# init 6

4. init 단계

kernel은 init을 실행하고 init은 /etc/inittab파일을 일고 초기화 하며 해당 설정대로 관련 명령을

수행한다. 시스템 운영에 필요한 데몬 들을 실행하고 동작레벨(Run Level)을 관리하는 것이 주 역할이다.

1) /etc/inittab 파일

ap::sysinit:/sbin/autopush -f /etc/iu.ap (*)

ap::sysinit:/sbin/soconfig -f /etc/sock2path (*)

fs::sysinit:/sbin/rcS sysinit >/dev/msglog 2<>/dev/msglog </dev/console (*)

is:3:initdefault: (*)

p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog (*)

sS:s:wait:/sbin/rcS >/dev/msglog 2<>/dev/msglog </dev/console (*)

s0:0:wait:/sbin/rc0 >/dev/msglog 2<>/dev/msglog </dev/console

s1:1:respawn:/sbin/rc1 >/dev/msglog 2<>/dev/msglog </dev/console

s2:23:wait:/sbin/rc2 >/dev/msglog 2<>/dev/msglog </dev/console (*)

s3:3:wait:/sbin/rc3 >/dev/msglog 2<>/dev/msglog </dev/console (*)

s5:5:wait:/sbin/rc5 >/dev/msglog 2<>/dev/msglog </dev/console

s6:6:wait:/sbin/rc6 >/dev/msglog 2<>/dev/msglog </dev/console

fw:0:wait:/sbin/uadmin 2 0 >/dev/msglog 2<>/dev/msglog </dev/console

of:5:wait:/sbin/uadmin 2 6 >/dev/msglog 2<>/dev/msglog </dev/console

rb:6:wait:/sbin/uadmin 2 1 >/dev/msglog 2<>/dev/msglog </dev/console

sc:234:respawn:/usr/lib/saf/sac -t 300 (*)

co:234:respawn:/usr/lib/saf/ttymon -g -h -p “`uname -n` console login: ” -T sun -d /dev/console -l console -m ldterm,ttcompat (*)

2) Run Level

0 : PROM monitor level. 부트 PROM의 OK 프롬프트 상태로 시스템을 종료하기 위한 Level이다. (==> halt, init 0, shutdown -i0)

s,S : Single User(관리자) 상태로서 마운트된 모든 파일 시스템을 접근할 수 있다.

1 : Single User(관리자) 상태로서 사용 가능한 모든 파일 시스템을 접근할 수 있다.

2 : 다중 사용자 레벨 (Multi User Level)

3 : 다중 사용자 레벨 (Multi User Level) with NFS(Network File Service)

4 : User Define Level (사용되지 않음)

5 : Shutdown(0) and power off (==> poweroff , init 5, shutdown -i5 )

6 : Shutdown(0) and reboot (==> reboot, init 6, shutdown -i6)

3) 각 Run Level별 데몬 프로세스의 실행

init –> /sbin/rc# –> /etc/rc#.d/{S##스크립트, K##스크립트} –> 데몬 실행

root(관리자) –> /etc/init.d/스크립트 –> 데몬 종료, 재실행

/etc/init.d/스크립트 ==> /etc/rc#.d/{S##스크립트, K##스크립트}는 하드링크 됨. 관련 파일 검색은 다음과 같다.

# ls -i /etc/init.d/nfs.server

28562 /etc/init.d/nfs.server*

# find /etc -inum 28562

/etc/init.d/nfs.server

/etc/rc0.d/K28nfs.server

/etc/rc1.d/K28nfs.server

/etc/rc2.d/K28nfs.server

/etc/rc3.d/s15nfs.server

/etc/rcS.d/K28nfs.server

4) RC 스크립트 추가하기

(1) Edit banner script in /etc/init.d

# cd /etc/init.d

# cp lp banner

# vi banner

#!/bin/sh

#

# Boot Process test script

#

case “$1” in

‘start’)

[ -f /usr/bin/banner ] && /usr/bin/banner “SYSTEM UP”

/usr/bin/audioplay /usr/demo/SOUND/sounds/rooster.au

;;

‘stop’)

[ -f /usr/bin/banner ] && /usr/bin/banner “SYSTEM DOWN”

/usr/bin/audioplay /usr/demo/SOUND/sounds/flush.au

;;

‘*’)

echo “Usage: $0 { start | stop }”

exit 1

esac

exit 0

(2) Test script

# chmod 744 banner

# chown root:sys /etc/init.d/banner

# ./banner start

# ./banner stop

(3) link to /etc/rc2.d

# cd /etc/rc2.d

# ln /etc/init.d/banner S22banner

(4) link to /etc/rcS.d

# cd /etc/rcS.d

# ln /etc/init.d/banner K99banner

(5) link to /etc/rc0.d

# cd /etc/rc0.d

# ln /etc/init.d/banner K99banner

(6) Test init state

# init s



# init 6



# halt

5. Device Configuration

1) 장치 명

– Logical Device Name ( 관리자)

– Physical Device Name ( kernel, system )

– Instance Name (kernel이 부팅 시 빠른 참조를 위해)

2) Logical Device Name

/dev/[r]dsk/c#t#t#d#s#

c# : Controller Number

t# : Target Number

d# : Disk Number

s# : Slice or partition number (0-7)

예) /dev/dsk/c0t0d0s0(raw device) /dev/rdsk/c0t3d0s (block device)

3) Physical Device Name

# ls -lL /dev/dsk/c0t0d0s0

brw-r—– 1 root sys 32, 0 2000년 7월 4일 /devices/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0:a

# ls -lL /dev/rdsk/c0t0d0s0

crw-r—– 1 root sys 32, 0 2000년 7월 4일 /devices/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0:a

4) Instance Name

시스템 커널에 의해 부여된 Physical Device Name의 축약된 이름이다.

# cat /etc/path_to_inst

“/sbus@1f,0” 0 “sbus”

“/sbus@1f,0/SUNW,fas@e,8800000” 0 “fas”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@f,0” 14 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/st@6,0” 6 “st”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@d,0” 12 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/st@4,0” 4 “st”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@e,0” 13 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/st@5,0” 5 “st”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@b,0” 10 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/st@2,0” 2 “st”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@c,0” 11 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/st@3,0” 3 “st”

“/sbus@1f,0/SUNW,fas@e,8800000/st@0,0” 0 “st”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@a,0” 9 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/st@1,0” 1 “st”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@6,0” 6 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@4,0” 4 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@5,0” 5 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@2,0” 2 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@3,0” 3 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0” 0 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@1,0” 1 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@8,0” 7 “sd”

“/sbus@1f,0/SUNW,fas@e,8800000/sd@9,0” 8 “sd”

“/sbus@1f,0/sbusmem@2,0” 2 “sbusmem”

“/sbus@1f,0/sbusmem@3,0” 3 “sbusmem”

“/sbus@1f,0/sbusmem@0,0” 0 “sbusmem”

5) 디바이스의 재구성

장치를 새로 장착하고 /devices 및 /dev의 장치파일을 재구성하기 위한 명령어는 다음과 같다.

– (재)부팅이 필요

i) # reboot — -r

ii) OK boot -r

iii) # touch /reconfigure

# reboot ( or init 6)

– (재)부팅이 불필요

i) # drvconfig -i sd ( Solaris 2.6부터 )

# disks (tapes, ports, devlinks)

ii) # devfsadm -c disk [ -c tape -c audio ]

6) 장치 추가 용례

– reconfigure file 생성

# touch /reconfigure

– 시스템의 정지

# init 5

– 시스템의 전원을 끈다

– 시스템에 새로운 디바이스를 연결한다.

– 외장형일 경우 외장 디바이스의 전원을 켠다.

– 시스템의 전원을 켠다.

– 부팅 후 추가된 장치의 Reconfiguration을 확인한다.

7) 장치의 연결확인

– PROM 단계에서

OK probe-scsi

– OS에서

# prtconf | grep -v not

# format (디스크의 경우, 확인만 하고 Control + d )

Searching for disks…done

AVAILABLE DISK SELECTIONS:

0. c0t0d0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>

/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0

1. c0t1d0 <IBM-DCAS-32160W-S65A cyl 8186 alt 2 hd 3 sec 171>

/sbus@1f,0/SUNW,fas@e,8800000/sd@1,0

Specify disk (enter its number):

6. DISK, SLICE, FORMAT

1) Disk Label (VTOC: Volume Table Of Contents)

– 디스크의 파티션 테이블 (Partition Table)

– 디스크 디바이스를 구별하는 볼륨명(volume name)

– Optional Partition Tag (각 파티션의 표준 마운트 포인트 이름으로 디스크 라벨에서만 사용되고 OS에서는 사용되지 않는 제한된 값)

– Optional Partition Flag (각 파티션이 Writable이지 Mountable인지를 결정하는 값으로 디스크 라벨에서만 사용되고 OS에서는 사용되지

않는 제한된 값)

VTOC의 정보확인은 prtvtoc로 변경(파티션)은 format을 이용한다

# prtvtoc /dev/rdsk/c0t3d0s2 (=> VTOC 정보 확인)

# format

2) 파티션 정하기

솔라리스에서는 하드디스크의 파티션을 하기 위해 format이라는 utility를 사용한다.

솔라리스에서는 하나의 디스크에 최대 8개의 파티션 까지 나눌 수 있으며 2번은 전체를 나타낸다. 따라서 실제 파티션 수는 7개이다.

디스크를 추가하고 파티션을 하기 위한 자세한 사용법은 다음을 참조한다.

http://www.ussg.iu.edu/usail/peripherals/disks/adding/solaris.html

http://docs.sun.com/db/doc/805-7228/6j6q7uet8

# format (==> 포맷하고자 하는 디스크 번호를 선택)

AVAILABLE DISK SELECTIONS:

0. c0t0d0 <SUN2.1G cyl 2733 alt 2 hd 19 sec 80>

/sbus@1f,0/SUNW,fas@e,8800000/sd@0,0

1. c0t1d0 <IBM-DCAS-32160W-S65A cyl 8186 alt 2 hd 3 sec 171>

/sbus@1f,0/SUNW,fas@e,8800000/sd@1,0

Specify disk (enter its number):

주의사항 1) 슬라이스 2번은 디스크 전체를 의미하므로 절대 수정하지 않는다.

주의사항 2) 파티션은 실린더 단위로 구성되는데 Offset이 정확히 일치해야 한다.

주의사항 3) 레이블 저장 명령 ( label)을 수행하지 않는다면 메모리에서만 변경되므로 디스크에는 영향을 주지 않는다.

[ 하드 디스크 추가하기 ]

# init 5

(디스크 연결하고 파워를 켠다)

OK probe-scsi

OK boot -r

# prtconf | grep -v not

# format (추가된 디스크를 선택하여 파티션 한다.)

# newfs /dev/rdsk/c0t1d0s6 (각 파티션을 파일시스템으로 만든다.)

# fsck /dev/rdsk/c0t1d0s6 (파일시스템을 체크한다.)

# mkdir /data (마운트할 디렉토리를 생성한다)

# mount /dev/dsk/c0t1d0s6 /data (마운트 한다)

# df -k 또는 mount (마운트 정보를 확인한다.)

# vi /etc/vfstab (해당 파티션의 정보를 추가하여 부팅 시 마운트 되도록 한다.)

7. Solaris 파일 시스템

1) 파일 시스템의 종류

– Disk Based File System : ufs(Unix File System), hsfs(High Sierra File System), pcfs(PC File System), udfs(Universal disk Format File System:sol7)

– Distributed File System: nfs ( Network File System)

– Pseudo File System: tmpfs(Temporary File System), swapfs(Swap File System), fdfs(File Descriptor File System), procfs(Process File System)

2) UFS의 파일 시스템 구조

– label(VTOC)(1 sector)

– Boot Bolck(15 sectors) : bootblk

– SuperBlock(16 sectors)

. 파일시스템 사이즈

. 레이블(파일 시스템명과 볼륨명)

. 파일 시스템의 Logical block 의 사이즈

. 마지막으로 업데이트된 날짜와 시간

. 실린더 그룹의 사이즈

. 실린더 그룹 안의 데이터 블록의 number의 fragment의 사이즈

. 데이터 블록의 요약 정보

. 파일 시스템 상태 값 (clean, stable, active, logging or unknown)

. 마지막 마운트 포인트의 경로명

– First Cylinder Group (보통 그룹당 16개의 실린더)

|__ backup Super Block

|__ Cylinder Group Block

| . inode 수

| . 실린더 그룹에서의 데이터 블록 수

| . 디렉터리의 수

| . free block의 map

| . 실린더 그룹에서 free block, free_inode, free fregment의 수

| . 사용된 inode의 map

|__ inode table

|__ Data Block(한 블록당 8K bytes, 1K는 fregment라 함)

– Second Cylinder Group

….

3) 파일 시스템의 생성

# newfs /dev/rdsk/c0t0d0s0

newfs: /dev/rdsk/c0t0d0s0 last mounted as /images

newfs: construct a new file system /dev/rdsk/c0t0d0s0: (y/n)? y

/dev/rdsk/c0t0d0s0: 4199508 sectors in 6603 cylinders of 4 tracks, 159 sectors

2050.5MB in 104 cyl groups (64 c/g, 19.88MB/g, 3392 i/g)

super-block backups (for fsck -F ufs -o b=#) at:

32, 40896, 81760, 122624, 162848, 203712, 244576, 285440, 325664, 366528,

407392, 448256, 488480, 529344, 570208, 611072, 651296, 692160, 733024,

773888, 814112, 854976, 895840, 936704, 976928, 1017792, 1058656, 1099520,

1139744, 1180608, 1221472, 1262336, 1302560, 1343424, 1384288, 1425152,

1465376, 1506240, 1547104, 1587968, 1628192, 1669056, 1709920, 1750784,

1791008, 1831872, 1872736, 1913600, 1953824, 1994688, 2035552, 2076416,

2116640, 2157504, 2198368, 2239232, 2279456, 2320320, 2361184, 2402048,

2442272, 2483136, 2524000, 2564864, 2605088, 2645952, 2686816, 2727680,

2767904, 2808768, 2849632, 2890496, 2930720, 2971584, 3012448, 3053312,

3093536, 3134400, 3175264, 3216128, 3256352, 3297216, 3338080, 3378944,

3419168, 3460032, 3500896, 3541760, 3581984, 3622848, 3663712, 3704576,

3744800, 3785664, 3826528, 3867392, 3907616, 3948480, 3989344, 4030208,

4070432, 4111296, 4152160, 4193024,

# newfs -m 1 /dev/rdsk/c0t0d0s0 ( Minfree 값을 조정, default는 10%)

# fstyp -v /dev/rdsk/c0t0d0s0 | grep minfree (기존의 minfree값을 확인)

# tunefs -m 2 /dev/rdsk/c0t0d0s0 ( newfs 이후 다시 재조정)

8. 파일 시스템 마운트 (File System Mount)

파일시스템을 사용하기 위해서는 트리구조의 임의 디렉토리(Mount Point)에 연결시켜야 하는데, 이를 마운트(mount)라 하며

마운트를 해제하는 것을 언마운트(unmount)라 한다.

마운트 포인트(mount point)는 빈 디렉터리로 파일 시스템을 연결할 포인트를 의미한다.

1) 마운트 정보

# mount

/ on /dev/dsk/c0t0d0s0 read/write/setuid/intr/largefiles/onerror=panic/dev=800000 on 금 4월 25 14:18:36 2003

/usr on /dev/dsk/c0t0d0s5 read/write/setuid/intr/largefiles/onerror=panic/dev=800005 on 금 4월 25 14:18:36 2003

/proc on /proc read/write/setuid/dev=3b00000 on 금 4월 25 14:18:35 2003

/dev/fd on fd read/write/setuid/dev=3bc0000 on 금 4월 25 14:18:37 2003

==> /etc/mnttab 을 참조함(마운트, 언마운트시 자동 업데이트. No Admin)

2) 마운트(Mount)

마운트는 mount 명령어를 이용하거나, 부팅 시 /etc/vfstab 파일 정보를 읽고 자동으로 마운트되는 두 가지 경우가 있다.

– 수동 마운트

# mount /dev/dsk/c0t3d0s7 /dir1

# mount -o ro /dev/dsk/c0t3d0s6 /dir2

# mount -o ro,nosuid,nolargefiles /dev/dsk/c0t0d0s5 /dir3

# mount -o ro,bg,soft host1:/usr/local /usr/local

– 자동 마운트

# mkdir /newdir

# mount /dev/dsk/c0t1d0s4 /newdir

# vi /etc/vfstab (엔트리를 추가)

# umount /newdir (테스트)

# mount /newdir (테스트)

cf. # mount /dir1 (=> /etc/vfstab에 이미 등록되어 있는 경우)

cf. # mountall [-r|-l] (=> /etc/vfstab에 “mount at boot” 값이 yes인 것만)

[ /etc/vfstab 파일 ]

#device device mount FS fsck mount mount

#to mount to fsck point type pass at boot options

#

#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes –

fd – /dev/fd fd – no –

/proc – /proc proc – no –

/dev/dsk/c0t0d0s1 – – swap – no –

/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no –

/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /usr ufs 1 no –

/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /var ufs 1 no –

/dev/dsk/c0t1d0s0 /dev/rdsk/c0t1d0s0 /usr/local ufs 2 yes –

/dev/dsk/c0t1d0s1 /dev/rdsk/c0t1d0s1 /export/home ufs 2 yes nosuid,rq

swap – /tmp tmpfs – yes –

3) 언마운트

# umount /dir1

# umount /dev/dsk/c0t3d0s7

cf. # umountall [-r|-l] (=> /, /usr, /var, /var/run, /proc, /dev/fd, /tmp 는 제외)

[ umount 되지 않은 경우 조치 사항 ]

– 자신 또는 다른 사용자가 해당 파일시스템을 사용하고 있다면, 모든 사용을 중지하고 작업 디렉터리도 다른 곳으로 이동한다.

– 특정 프로세스가 해당 파일시스템을 사용하는 경우 이를 종료한다.

# fuser -u /export/home

/export/home: 4006c(root) 6399c(user01)

# fuser -u -k /export/home

/export/home: 4006c(root)Killed 6399c(user01)Killed

또는

# umount -f /export/home ( Solaris 8 부터)

4) 플로피 디스크와 CDROM 마운트

솔라리스에서는 volume Management를 제공하며, 쉽게 사용할 수 있도록 자동으로 마운트하여 서비스 한다.

[ Volume Management ]

– 서비스 데몬 : /usr/sbin/vold

– 서비스 데몬 제어 스크립트 : /etc/init.d/volmgt {stop|start}

– 설정 파일 : /etc/vold.conf, /etc/rmmount.conf ( 특별히 설정을 할 필요는 없다)

– 플로피 마운트 포인트 : /floppy/floppy0

– CDROM 마운트 포인트 : /cdrom/cdrom0

[ 플로피의 마운트 ]

플로피를 삽입한다.

# volcheck

# mount (마운트 확인)

# cd /floppy/floppy0 (필요한 작업 수행)

# cd /

# eject floppy

# mount (언마운트 확인)

cf. 수동마운트

# /etc/init.d/volmgt stop

# pkill -9 vold

# mount -F pcfs /dev/diskette /mnt (=> msdos file system)

# mount /dev/diskette /mnt (=> ufs file system)

cf. 플로피 포맷

# fdformat -d /dev/rdiskette (msdos 포맷)

# newfs /dev/rdiskette (ufs포맷)

[ CDROM 마운트 ]

CDROM을 삽입한다.

# mount (마운트 확인)

# cd /cdrom/cdrom0 (필요한 작업 수행)

# cd /

# eject cdrom

# mount (언마운트 확인)

cf. 수동마운트

# /etc/init.d/volmgt stop

# pkill -9 vold ( vold가 종료되지 않는 경우에만)

# mount -F hsfs -o ro /dev/dsk/c0t2d0s0 /mnt

cf. CDROM이 빠져 나오지 않거나 마운트, 언마운트가 되지 않는 경우 조치사항

# ps -ef | grep vold (데몬을 확인)

# /etc/init.d/volmgt stop

# /etc/init.d/volmgt start

… (해결이 안되면)

# pkill -9 vold

# ps -ef | grep vold (vold 프로세스가 확실히 종료했는지 확인)

# /etc/init.d/volmgt start

# ps -ef | grep vold (vold가 새로 동작하였는지 확인)

[ ISO 9660 파일 시스템 마운트 ]

– ISO 파일 생성하기

# mkisofs -o test.iso /etc/init.d

# ls -l test.iso

– 루프 백 디바이스 설정하기

# lofiadm

Block Device File

# lofiadm -a /usr/local/test.iso

/dev/lofi/1

# lofiadm /dev/lofi/1

/usr/local/test.iso

– 마운트

# mount -F hsfs -o ro /dev/lofi/1 /mnt

# ls /mnt

(사용한 후)

# umount /mnt

# lofiadm

# lofiadm -d /dev/lofi/1

5) 파일 시스템을 정의하는 파일

mount 명령을 수행할 때 특별히 파일시스템 타입을 명시하지 안는 경우 로컬파일 시스템은 /etc/vfstab, /etc/default/fs순이며

원격파일 시스템은 /etc/vfstab, /etc/dfs/fstypes이다.

/etc/vfstab

ex) /dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s5 /usr ufs 1 no –

/etc/default/fs

ex) LOCAL=ufs

/etc/dfs/fstypes

ex) nfs NFS Utilities

autofs AUTOFS Utilities

cachefs CACHEFS Utilities

9. 파일 시스템 관리

시스템의 부적절한 중지(정전, 비정상 종료 등..)로 인해 파일 시스템이 손상될 경우 fsck 유틸을 이용하여 복구해 주어야 한다.

fsck는 superblock, inode, indirect block, data block 을 검사하고 치료한다.

– Superblock 검사

파일 시스템 사이즈, inode number, free block count, free inode count

– inode 검사

format and type, link count, duplicate block, bad block number, inode size

– Indirect block 검사

블록이 다른 inode에 의해 이미 점유되어 있는 것

블록의 수가 파일 시스템의 범위에 어긋난 것

– data block 검사

평범한 data block

심볼릭 링크 data block

디렉토리 data block

1) fsck (file system check ) 명령의 수행 순서

– Phase 1 : Check Blocks and Sized

– Phase 2 : Check Pathnames

– Phase 3 : Check Connectivity

– Phase 4 : Check Reference Counts

– Phase 5 : Check Cyl groups

주의사항) 마운트 되어 사용하고 있는 파일 시스템은 fsck를 쓸 수 없다. 언마운트하거나 싱글유저 모드에서 처리한다.

2) fsck 명령 사용법

fsck [ -F FSType] [-V] [-m] [special] /dev/rdsk/장치 명

# umount /export/home

# fsck -V /export/home (실행하지는 않고 실행 명령어를 보여줌)

fsck -F ufs /dev/rdsk/c0t0d0s7 ( => /etc/vfstab을 참조한다.)

# fsck /dev/rdsk/c0t0d0s6

cf. SuperBlock 이 손상되어 복구되지 않는 경우

# newfs -N /dev/rdsk/c0t3d0s7 (=> 백업 수퍼블럭 번호를 확인)

/dev/rdsk/c0t3d0s7: 4199508 sectors in 6603 cylinders of 4 tracks, 159 sectors

2050.5MB in 104 cyl groups (64 c/g, 19.88MB/g, 3392 i/g)

super-block backups (for fsck -F ufs -o b=#) at:

32, 40896, 81760, 122624, 162848, 203712, 244576, 285440, 325664, 366528,

407392, 448256, 488480, 529344, 570208, 611072, 651296, 692160, 733024,

773888, 814112, 854976, 895840, 936704, 976928, 1017792, 1058656, 1099520,

1139744, 1180608, 1221472, 1262336, 1302560, 1343424, 1384288, 1425152,

1465376, 1506240, 1547104, 1587968, 1628192, 1669056, 1709920, 1750784,

1791008, 1831872, 1872736, 1913600, 1953824, 1994688, 2035552, 2076416,

# fsck -F ufs -o b=40896 /dev/rdsk/c0t3d0s7 (=> 파일 시스템 체크 )

3) 디스크 사용 관리

– df 명령 : 마운트된 각 파일 시스템의 사용에 관한 정보를 보여주는 명령어

# df -k (Kb 단위로 보여줌)

# df -n (파일 시스템의 유형을 보여줌)

# df -k -F ufs ( ufs 파일 시스템만 보여줌)

– du 명령 : 파일과 디렉터리에 대한 사용 정보를 보여주는 명령어

# du -k . (현재 디렉터리 이하의 사용량)

# du -ks /etc ( /etc 전체의 사이즈)

– quot 명령 : 각 파일시스템에 대한 유저별의 사용량을 보여줌

# quot -a ( 모든 파일시스템을 Kb 단위로 보여줌)

# quot -af ( 디스크 사용량과 함께 파일 수도 보여줌)

4) quota 에 대한 설정

사용자들에 제한된 용량만 사용할 수 있도록 설정하고 관리할 수 있다.

자세한 설정 방법은 다음을 참고한다.

http://docs.sun.com/db/doc/805-7229/6j6q8svfc?a=view

http://www.unix.co.kr/data/solaris/?p=sa13

http://www.jic.co.kr/ypct110.htm

5) swap의 추가

# swap -l (현재 설정된 스왑 정보를 출력)

# mkdir /files (추가할 swap파일이 위치할 디렉토리 생성)

# mkfile 24m /files/swapfile (스왑을 위한 덩어리 파일 생성)

# swap -a /files/swapfile (스왑을 추가, 주의: 절대경로로 써야 한다.)

# swap -l (확인)

# vi /etc/vfstab (부팅 시 자동으로 마운트 되도록 수정)

/files/swapfile – – swap – no –

# swap -d /files/swapfile ( 제거할 경우 )

# rm /files/swapfile

# vi /etc/vfstab (추가된 스왑 설정 라인을 제거)

# swap -l (확인)

10. 솔라리스 설치 (Solaris Installation)

* 솔라리스 9 소개

http://kr.sun.com/products/software/os_platforms/solaris/index.html

* 솔라리스 8 소개

http://kr.sun.com/products/software/os_platforms/solaris/8/index.html

* 전체 버전 간의 차이 비교

http://wwws.sun.com/software/solaris/fcc/fcc.html

* Solaris 9 Installation Guide

http://docs.sun.com/db/doc/806-5205

* Solaris 8 (SPARC Platform Edition) Installation Guide

http://docs.sun.com/db/doc/806-0955

* Solaris for Intel 설치(한글)

http://myhome.naver.com/yasicom/solaris.htm

1) 솔라리스 8 설치 전 준비 사항

설치에 필요한 최소한의 CD (국제판)

– Solaris 8 Installation CD

– Solaris 8 Software 1/2 CD

– Solaris 8 Software 2/2 CD

– Solaris 8 Language CD

2) 하드웨어 요구사항

– Sparc Base 또는 Intel Based 시스템

– 64 MB 메모리

– 2.1 GB 디스크 스페이스

– CD-ROM 드라이브

3) Solaris 8 설치 전 정보 수집

– 호스트 이름

– IP 주소

– 네이밍 서비스(DNS, NIS, NIS+, 없음)의 유형 및 구성 정보

– subnet mask

– root password

– 소프트웨어 그룹

Entire Distribution(2.1G 권장) + OEM, Entire Distribution(1.9G 권장), Developer(1.5G 권장), End User(1.2G 권장), Core(718M 권장)

– OS를 설치할 디스크 설정 및 파티션 설정

4) 설치 방법

– WebStart Installation ( Install CD)

– JumpStart Installation ( from Jumpstart Server System)

– Interactive Installation ( Software 1/2 CD)

5) 설치 순서

CDROM 넣고

# shutdown -i0 -y -g0 ( init 0 또는 Stop + A)

OK set-defaults

OK boot cdrom

– 시스템 식별

– 디스크 선택 및 파티션 설정

– 소프트웨어 그룹 설정

– 설치 후 재부팅

– Software 2/2 CD, Language CD 차례로 설치

6) 설치 시 유의사항

– 32Bit, 64Bit Kernel 선택 ( OS install 후 확인은 isainfo -kv)

– 설치 후 소프트웨어 그룹 유형확인 ( # cat /var/sadm/system/admin/CLUSTER )

SUNWCXall(Entire +OEM), SUNWCall(Entire), SUNWCprog(Developer), SUNWCuser(End User), SUNWCreq(Core)

– 파티션 권장사항 ( / 100M, /usr 500M~1G, /var 128M이상, swap 메모리2~3배, /opt 400M이상, /export/home 필요한 만큼)

11. 패키지 관리

1) 패키지 정보

# pkginfo | more (전체 보기)

# pkginfo | grep SUNWman (특정 패키지 설치여부)

# pkginfo -l SUNWman (특정 패키지의 자세한 정보)

# pkginfo -d /cdrom/solarisxxx/Solaris_8/Product | more (CDROM 내의 패키지 정보)

# pkginfo -d /cdrom/solarisxxx/Solaris_8/Product -l SUNWaudio (CDROM 내의 특정 패키지 정보)

# pkginfo | wc -l ( 설치된 총 패키지 수)

# grep /usr/bin/audioplay /var/sadm/install/contents (audioplay 의 패키지 이름 알아내기1)

# pkgchk -l -p /usr/bin/audioplay (audioplay의 패키지 이름 알아내기2)

# pkgchk SUNWaudio ( 설치 성공 여부 확인, 성공 시 메시지 없음)

# pkgchk -v SUNWaudio (특정 패키지에 대한 자세한 설치 위치)

# pkgchk -p /etc/passwd (특정 파일에 대한 초기 패키지 설치후의 변경 정보)

2) 패키지 추가

# pkgadd -d /cdrom/solxxxx/Solaris_8/Product SUNWaudio

# pkgadd -d /cdrom/solxxxx/Solaris_8/Product -s spool SUNWaudio ( /var/spool/pkg에 패키지 스풀)

# pkgadd -d /cdrom/solxxxx/Solaris_8/Product -s /export/pkgs SUNWaudio ( /export/pkgs에 패키지 스풀)

* GUI의 어드민 툴(admintool)을 이용하여 설치할 수도 있다.(cf. sysadmin(14) 가능)

3) 패키지 제거

# pkgrm SUNWaudio

# pkgrm -s spool SUNWaudio (/var/spool/pkg 의 스풀 패키지 제거)

# pkgrm -s /export/pkgs SUNWaudio (/export/pkgs의 스풀 패키지 제거)

* GUI의 어드민 툴(admintool)을 이용하여 제거할 수도 있다.(cf. sysadmin(14) 가능)

4) 기타 Freeware 패키지 활용

http://www.sunfreeware.com에서 다양한 무료 패키지를 제공한다.

– 업데이트 및 설치를 위한 편리한 pkg-get 툴도 제공한다. 자세한 정보는 아래 참조.

http://www.sunfreeware.com/pkg-get.html

– 패키지를 직접 제작하고 싶을 경우에는 다음을 참조한다.

http://www.sunfreeware.com/pkgadd.html

12. 패치 관리

패치에 관한 다양한 정보와 패치 파일은 아래 사이트를 참조한다.

http://sunsolve.sun.com

ftp://sunsolve.sun.com/pub/patches

패치를 관리하거나 설치하기 위해서는 패치 번호를 먼저 파악해야 하고, 이는 Solaris#.PatchReport를 다운 받아 확인한다.

OS설치 후 반드시 Recommended Patch및 최신 보안 패치를 해 주어야 한다. 패치번호는 다음과 같이 구성되어있다.

109320-02 (패치번호-revision number)

1) 패치 정보

# showrev -p (시스템에 설치된 패치 정보 보기)

# patchadd -p (Solaris 2.6부터, Shell script)

# showrev -p | grep 109320

# patchadd -p | grep 109320

2) 초기 설치해야 할 패치와 참고 문서

Solaris8.PatchReport : Solaris8의 모든 recommended 패치 정보

8_Recommended.zip : Solaris8의 모든 recommended 패치 파일들

8_Recommended.README : Solaris8의 모든 recommended 패치 설치 방법과 설명

3) 패치 정보 및 저장 디렉토리

/var/sadm/patch

4) 패치 설치

# /usr/bin/unzip 109320-03.zip ( Solaris 7부터)

# /usr/bin/zcat 104040-01.tar.Z | tar xvf – (Solaris2.6)

# more 109320-03/README (반드시 관련 README를 읽어본다.)

# patchadd 109320-03 (패치를 수행)

# showrev -p | grep 109320 (설치 여부를 확인)

# patchrm 109320-03 (패치를 제거)

# showrev -p | grep 109320 (제거 여부를 확인)

– 주의사항 : Solaris2.6이전은 패치 디렉토리 내의 스크립트를 이용한다.

[설치 시]

# cd 109320

# ./installpatch .

[제거시]

# cd /var/sadm/patch/109320

# ./backoutpatch 109320

5) 패치 정보의 관리

http://sunsolve.sun.com의 Patch Portal에는 패치를 체계적이고 편리하게 다룰 수 있는 Patch finder, Patch Pro, Patch Check등을

제공한다.

6) 패치 에러 코드 정리

0 No error

1 Usage error

2 Attempt to apply a patch that’s already been applied

3 Effective UID is not root

4 Attempt to save original files failed

5 pkgadd failed

6 Patch is obsoleted

7 Invalid package directory

8 Attempting to patch a package that is not installed

9 Cannot access /usr/sbin/pkgadd (client problem)

10 Package validation errors

11 Error adding patch to root template

12 Patch script terminated due to signal

13 Symbolic link included in patch

14 NOT USED

15 The prepatch script had a return code other than 0.

16 The postpatch script had a return code other than 0.

17 Mismatch of the -d option between a previous patch install and the current one.

18 Not enough space in the file systems that are targets of the patch.

19 $SOFTINFO/INST_RELEASE file not found

20 A direct instance patch was required but not found

21 The required patches have not been installed on the manager

22 A progressive instance patch was required but not found

23 A restricted patch is already applied to the package

24 An incompatible patch is applied

25 A required patch is not applied

26 The user specified backout data can’t be found

27 The relative directory supplied can’t be found

28 A pkginfo file is corrupt or missing

29 Bad patch ID format

30 Dryrun failure(s)

31 Path given for -C option is invalid

32 Must be running Solaris 2.6 or greater

33 Bad formatted patch file or patch file not found

34 The appropriate kernel jumbo patch needs to be installed

13. 백업

백업에 대한 자세한 문서는 다음을 참조한다.

http://docs.sun.com/db/doc/805-7228/6j6q7uf0u?a=view

– Full dump : 파티션 전체를 백업

– Incremental dump: 전체 백업 후 변경된 것만 백업

– 선택적 backup: 특정 파일이나 디렉토리를 백업

– Multivolume Backup : 여러 의 미디어를 이용한 백업

1) 백업 디바이스 종류

1/2-inch reel tape(140MB)

2.5-Gbyte 1/4 inch Cartridge(QIC) tape (2.5GB)

DDS3 4mm cartridge tape (DAT) (12-24GB)

14-Gbyte 8-mm cartridge tape (14GB)

DLT 7000 1/2-inch cartridge tape (35~70GB)

cf. /dev/rmt/xyn

x: 장치 번호 (0,1,2…)

y; 밀도 (h, m, l, c, u)

n: rewind 여부

2) mt 명령어 (tape을 제어하기 위해 사용)

# mt -f /dev/rmt/0 status (-> backup device의 상태를 표시 )

# mt -f /dev/rmt/0n eom (-> tape의 맨 끝으로 이동 )

# mt -f /dev/rmt/0 rewind (-> tape를 제일 처음으로 되감는다. )

# mt -f /dev/rmt/0n fsf [count] (-> count 개수 만큼 파일 뒤로 건너 띈다. )

# mt -f /dev/rmt/0n nfsf [count] ( -> count+1 개수 만큼 파일 뒤로 건너 띈다. )

# mt -f /dev/rmt/0n bsf [count] (-> count 개수 만큼 파일 앞으로 건너 띈다. )

# mt -f /dev/rmt/0n nbsf [count] (-> count+1 개수 만큼 파일 앞으로 건너 띈다. )

# mt -f /dev/rmt/0 erase (-> tape의 모든 내용을 지운다. tape나 device에 따라 다르나 시간이 많이 걸린다. )

# mt -f /dev/rmt/0 offline (-> tape가 eject 된다. )

3) tar, dd 명령어

# tar tvf /dev/rmt/0 ( -> tape의 내용을 확인함 )

# tar xvf /dev/rmt/0 ( -> tape에있는 내용을 Hard disk로 내림 )

# tar cvf /dev/rmt/0 /etc/hosts (-> Hard disk에있는 file 이나 directory를 tape로 받음 )

# tar cvfb – backup_dir | rsh host dd of=/dev/rmt/0 (-> remote host에있는 drive로 backup 받기)

# rsh -n host_name dd if=/dev/rmt/0 |tar xvBfb – restore_dir ( -> remote host에있는 drive로 backup 내리기 )

4) cpio 명령어

* 현재 디렉토리의 내용을 tape로 backup

# find . -print | cpio -ovcB > /dev/rmt/0

* tape에서 file을 extract

# cpio -ivcB /var/tmp/space < /dev/rmt/0

* 최근 일주일 내에 수정된 file을 tape로 받는다

# find . -mtime -7 -print | cpio -ovcB > /dev/rmt/0n

# find . -name ‘file*’ -print | cpio -ovcB > file.list

# cpio -ivt < file.list

5) ufsdump, ufsrestore 명령어

* /export/home이 /dev/rdsk/c0t0d0s3이라 가정

– dump할 파일 또는 파일시스템 용량확인

# df -k /export/home

# ufsdump 0S /export/home [ Mega ==> # / (1024 x 1024) ]

– Full Dump

# umount /export/home

# fsck /export/home

# ufsdump 0uf /dev/rmt/0 /export/home

– Incremental Dump

# umount /export/home

# fsck /export/home

# ufsdump 3uf /dev/rmt/0 /export/home

# cat /etc/dumpdates

– ufsrestore

# mount /export/home

# cd /export/home

# ufsrestore tvf /dev/rmt/0 (내용을 확인)

# ufsrestore rvf /dev/rmt/0 (내용을 모두 복구)

# ls /export/home ( Check filesystem restore)

# cd /var/tmp

# ufsrestore ivf /dev/rmt/0 (interactive로 일부만 복구)

– remove restoresymtable file

# rm /export/home/restoresymtable

14. 로그 관찰 및 성능 측정

1) 로그 분석

– /etc/syslog.conf (syslog 데몬 설정파일)

– /var/adm/sulog ( => su 관련 로그)

– /var/adm/messages ( => system 중요 로그 파일)

– /var/adm/loginlog (=> 로긴 관련 로그)

– /var/sadm/* (=> 패키지 관련 로그)

로그는 다음 문서를 참조한다.

http://www.certcc.or.kr/paper/tr2001/tr2001-05/unix_log_analysis.pdf(유닉스 로그 분석 1)

http://www.certcc.or.kr/paper/tr2001/tr2001-07/Unix_log_analysis_II.pdf(유닉스 로그 분석 2)

2) 시스템 퍼포먼스 관리

– System Administration Guide, Volume 2 >> 33. Managing System Performance Topics

http://docs.sun.com/db/doc/805-7229/6j6q8svgf?a=view

– SUN PERFORMANCE

http://www.sun.com/sun-on-net/performance.html

– Solaris Tunable Parameters Reference Manual

http://docs.sun.com/db/doc/816-0607

– 썬 시스템 메모리 정보 (Sun UNIX memconf utility)

http://www.4schmidts.com/memconf.html

– Unix and Windows NT System Tools

http://webperso.easyconnect.fr/sgarnaud/unixtools/index.html

5부. 네트웍 어드민

1. Network Setup

1) /etc/hostname.<Interface> 에 호스트 이름을 기록

ex) host1

2) /etc/hosts 파일에 ip설정

ex) 192.168.1.20 host1 loghost

3) /etc/defaultrouter 에 gw ip 설정

ex) 203.234.247.254

4) Netmask 설정

ex) 203.234.247.0 255.255.255.0

5) /etc/resolv.conf 에 DNS서버 등록

ex) domain ns.hananet.net

nameserver xxx.xxx.xxx.xxx

nameserver xxx.xxx.xxx.xxx

6) /etc/resolv.conf 에 dns 문자를 추가

….

hosts files dns ( ==> dns 추가)

7) 재부팅

# reboot

cf. 재부팅 없이 IP 변경

# ifconfig -a

# ifconfig hme0 down

# ifconfig hme0 203.234.247.30 net mask 255.255.255.0 broadcast + up (=> 설정)

# ifconfig hme0 (=> 확인)

# route add default 203.234.247.254 1 (=> 기본 게이트웨이 설정)

cf. 호스트 이름 변경

다음 6개 파일을 수정한다.

/etc/hosts

/etc/hostname.<interface>

/etc/nodename

/etc/net/*/hosts (3개)

cf. Network Interface Name

Lance Ethernet(10M Ethernet) : le

Fast Ethernet 1.0 : be

Fast Ethernet 2.0 이상 : hme

Quad Ethernet : qe

Quad FastEthernet 1.0 : hme

Quad FastEthernet 2.0 이상 : qfe

Gigabit Ethernet : vge

ATM 1.0 : sa

ATM 2.0 이상 : ba

FDDI : nf

Token Ring : tr

2. TCP/IP Network Layer

이론에 관한 문서는 다음을 참조한다.

– Introduction to TCP/IP

http://www.yale.edu/pclt/COMM/TCPIP.HTM

– SolarisTM 2.x – Tuning Your TCP/IP Stack and More

http://www.sean.de/Solaris/soltune.html

– TCP/IP 프로토콜

http://jkkang.net/unix/netprg/chap1/net1_2.html

– RFC 문서

ftp://ftp.isi.edu/in-notes/rfc793.txt

1) ifconfig

# ifconfig -a (모든 Network Interface 설정 정보 출력)

# ifconfig hme0 down (=> Interface disable)

# ifconfig hme0 up (=> Interface enable)

# ifconfig hme0 unplumb (=> Interface close)

# ifconfig hme0 plumb (=> Interface open)

# ifconfig hme0 203.234.247.30 netmask 255.255.255.0 broadcast + up (=> 설정)

2) rlogin, rsh, rcp

명령어: rlogin, rsh, rcp

설정파일(user): /etc/hosts.equiv, $HOME/.rhosts

설정파일(root): /.rhosts

서버호스트: sun01

클라이언트: sun02

– 서버 쪽 관리자가 설정

sun01# vi /etc/hosts ( 허락할 클라이언트 호스트 등록)

sun01# echo “sun02 user01” > /etc/hosts.equiv ( 허락할 호스트 및 유저등록)

sun01# chmod 600 /etc/hosts.equiv

– 클라이언트 관리자가 설정

sun02# vi /etc/hosts ( 접근할 서버 호스트 등록)

– test (클라이언트에서)

sun02# su – user01

sun02$ rlogin sun01

sun01$ hostname

sun01$ exit

– 서버 쪽 일반유저가 허락할 때

sun01# rm /etc/hosts.equiv

sun01# su – user01

sun01$ echo “sun02 user01” > $HOME/.rhosts

sun01$ chmod 600 $HOME/.rhosts

– Test (클라이언트에서)

sun02# su – user01

sun02$ rlogin sun01

sun01$ hostname

sun01$ exit

– 기타 r계열 명령어

sun02# su – user01

sun02$ hostname

sun02$ rsh sun01 hostname

sun02$ rcp /etc/profile sun01:a.txt

sun02$ rsh sun01 ls (a.txt가 복사되었는지 확인)

3) 기타 네트웍 명령어

# ping google.co.kr

# ping -s google.co.kr

# rusers (Local Network 사용자 정보, cf who)

# rusers -l hostA ( hostA에 대해 로긴한 사용자 정보)

4) 기타 Freeware

nmap(Port Scanning), traceroute(trace rote inform), nslookup(DNS info), dig(DNS info) …

3. FTP Server

– 일반적으로 inetd에 의한 중재 방식과 standalone방식이 있다.

– anonymous ftp서비스를 위해서는 맨 페이지나 다음 사이트를 참고한다.

How to Set up a Secure Anonymous FTP Site

http://secinf.net/unix_security/How_to_Set_up_a_Secure_Anonymous_FTP_Site.html

– 보다 많은 설정과 기능을 제공하는 wu-fptd나 proftpd로 대체할 수 있다. (패키지는www.sunfreeware.com)

WU-FTPD Development Group (http://www.wu-ftpd.org/)

The ProFTPD Project (http://www.proftpd.net/)

vsftpd (http://vsftpd.beasts.org/)

/usr/sbin/inetd (/etc/inetd.conf) —> /usr/sbin/in.ftpd

4. Telnet Server

– 요즘은 보안 때문에 telnet 보다는 Secure Shell(ssh)을 사용하는 것이 일반적이다.

5. NFS (Network File System)

NFS는 썬에서 개발한 분산 환경 파일시스템으로서 원격지에서 공유한 일부를 로컬에서 쉽게 연결해서 쓸 수 있는 공유파일시스템이다.

자세한 문서는 다음을 참고한다.

– NFS FAQ

http://www.ebsinc.com/solaris/network/nfs.html

– Chapter 29 Solaris NFS Environment

http://docs.sun.com/db/doc/806-0916/6ja8539fd?a=view

1) NFS의 장점

– 여러 대의 컴퓨터가 모두 같은 자료에 접근하여 같은 파일을 사용할 수 있다.

– 데이터의 중복을 줄이고 관리를 최소화할 수 있다.

– 서로 다른 환경을 지원한다.

– 시스템 관리 오버헤드를 줄인다.

2) NFS Server

– 관련 파일

/etc/dfs/dfstab

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

5 Responses

  1. 이옥현 말해보세요:

    선블레이드2000에 다른 os가 설치 가능 한가요

  2. 서진우 말해보세요:

    Sun 전용 Processor를 장착하고 있으니, 스팍 계열의 솔라리스 운영체제만 설치 될 듯 하네요.

  3. warm jazz music 말해보세요:

    warm jazz music

  1. 2022년 6월 21일

    3opposed

  2. 2023년 1월 27일

    2blockade

서진우 에 응답 남기기 응답 취소