중요:limit 명령은 일시적인
것이고 영구적으로 설정하려면/etc/security/limits.conf 에 설정해야 한다.
ulimit 는 하나의 유저(쉘,프로세스)에 대허서 할당할 자원량의 한계를 정하는 것으로서 다중 프로그램/사용자를
기본으로하는 리눅스 시스템에서 과부하를 막아주는 (한프로세스가 미쳐도 다른것에 영향이 덜가도록) 방패가 되어 주는 유용한 설정이다.
01. ulimit
- 명령어 (확인-소프트)
[root@localhost ~]#ulimit -a (또는 ulimit -Sa) // soft 한도
core file
size(blocks, -c) 0
data seg
size(kbytes, -d) unlimited
scheduling
priority(-e) 20
file size(blocks, -f) unlimited
pending
signals(-i) 16382
max locked
memory(kbytes, -l) 64
max memory
size(kbytes,
-m) unlimited
open
files(-n) 1024
pipe size(512 bytes, -p) 8
POSIX message
queues(bytes, -q) 819200
real-time
priority(-r) 0
stack
size(kbytes, -s) 8192
cpu time(seconds, -t) unlimited
max user
processes(-u) unlimited
virtual
memory(kbytes, -v) unlimited
file
locks(-x) unlimited
- 명령어 (확인-하드)
[root@localhost
~]#ulimit -Ha // hard 한도
core file size
(blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 20
file size (blocks, -f) unlimited
pending signals (-i) 16382
max locked memory (kbytes,
-l) 64
max memory size (kbytes,
-m) unlimited
open files
(-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks
(-x) unlimited
- 명령어 (확인-소프트/하드)
[root@localhost ~]#ulimit -Ha / ulimit –Sa(하드 설정 전체 보기 / 소프트
설정 전체 보기)
è하드는 해당쉘의 최대값을
뜻한다 하면 되고,소프트는
현재 설정을 말한다 생각하면 된다.
è soft설정은 hard설정값을 넘을수 없으므로. 그냥 soft/hard같이 설정해주는 버릇을 들이자.
- 명령어 (설정-예제)
[root@localhost
~]# ulimit -n 8192//오픈
파일의 최대 수
- 옵션
ulimit
옵션
-a 모든 제한 사항을 보여준다.
-c 최대 코어 파일 사이즈
-d 프로세스 데이터 세그먼트의 최대 크기
-f shell에 의해 만들어질 수 있는 파일의 최대 크기
-s 최대 스택 크기
-p 파이프 크기
-n 오픈 파일의 최대 수
-u 프로세스 최대 수
-v 최대 가상 메모리의 량
02. /etc/security/limits.conf
에 설정 파일
: 수정한 내용의 적용은 해당 유저가 새로운 접속을 시도하면 적용됩니다.(짧게 말해 재접^^;)
- 형식은 (limit.conf-)
#
/etc/security/limits.conf
…
[유저이름] [hard/soft] [설정할 항목] [설정값]
…
- ex
mklife hard nofile 320000=>
mklife 유저는 한번 접속에 하드세팅으로 32만개 파일까지 열수 있다.
mklife hard nproc 10000=>
mklife 유저는 한번 접속에 하드 세팅으로 1만개 프로시져를 생성가능
(주의) soft설정은 hard설정값을 넘을수
없으므로. 그냥 soft/hard같이 설정해주는 버릇을
들이자.
- 옵션
#
/etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type>
<item> <value>
#
#Where:
#<domain> can be:
# – an user name
# – a group name, with
@group syntax
# – the wildcard *, for
default entry
# – the wildcard %, can
be also used with %group syntax,
# for maxlogin
limit
# – NOTE: group and
wildcard limits are not applied to root.
# To apply a limit to the root user,
<domain> must be
# the literal username root.
#
#<type> can have the two values:
# – “soft” for enforcing the soft limits
# – “hard” for enforcing hard limits
#
#<item> can be one of the following:
# – core – limits the core file size (KB)
# – data – max data size (KB)
# – fsize – maximum filesize (KB)
# – memlock – max locked-in-memory address space (KB)
# – nofile – max number of open files
# – rss – max resident set size (KB)
# – stack – max stack size (KB)
# – cpu – max CPU time (MIN)
# – nproc – max number of processes
# – as – address space limit (KB)
# – maxlogins – max number of logins for this user
# – maxsyslogins – max number of logins on the system
# – priority – the priority to run user process with
# – locks – max number of file locks the user can hold
# – sigpending – max number of pending signals
# – msgqueue – max memory used by POSIX message queues (bytes)
# – nice – max nice priority allowed to raise to values: [-20, 19]
# – rtprio – max realtime priority
# – chroot – change root to directory (Debian-specific)
#
#<domain> <type> <item>
<value>
#
#*
soft core
0
#root hard core
100000
#* hard rss
10000
#@student hard nproc
20
#@faculty soft nproc
20
#@faculty hard nproc
50
#ftp hard nproc
0
#ftp – chroot
/ftp
#@student –
maxlogins 4
초창기
리눅스는 설치가 어려웠다 .소스코드를 갖고와서 적재적소에 컴파일을 해야했다. 그래서 일반사용자가 사용하기엔 거의 불가능했다. 이러한 이유로
외면을 받았었다. 결국 Redhat에서 RPM(Redhat Package Manager)을 내놓았다. 윈도우의 setup.exe 라고 생각하면 된다.
-
파일 : gedit-3.8.3-6.el7.x86_64.rpm
패키지이름 : gedit -> 패키지(프로그램)의 이름
버전 : 3.8.3 -> 대게 3자리수로 구성. 주버전, 부버전, 패치버전
릴리즈번호 : 6 -> 문제점을
개선할 때마다 붙여지는 번호 //noarch:모든CPU
CentOS버전 : el7 -> CentOS에서
배포할 경우에 붙여짐
아키텍처 : x86_64 -> 64비트 CPU를 의미
-
자주쓰는 RPM 명령어 옵션
$ rpm -Uvh 패키지파일이름.rpm
// U -> (대문자)패키지가 설치/업그레이드
// v -> 설치진행과정의 확인
// h -> 설치진행과정을 "#"마크로
화면에 출력
$ rpm -e 패키지이름//패키지 삭제
$ rpm -qa 패키지이름//패키지가 설치되었는지 확인
$ rpm -qf 파일의 절대경로 // 파일이 어느 패키지에 포함된 것인지 확인
$ rpm -qlp 패키지파일이름.rpm //패키지 파일에 어떤 파일들이 포함되었는지 확인
$ rpm -qip 패키지파일이름.rpm //패키지 파일의 상세정보
-
EX>
$ rpm -qa mc//mc 패키지가 설치되었나 확인
$ rpm -Uvh mc-4.8.7-8.el7.x86_64.rpm //설치
$ rpm -qa mc//mc 패키지가 설치되었나 확인
$ rpm -qi mc//mc 패키지 정보 출력
$ rpm -e mc-4.8.7-8.el7.x86_64.rpm//삭제
오류:
mc-4.8.7-8.el7.x86_64.rpm 패키지가 설치되어 있지 않습니다
//설치파일을 삭제하는것이다.!!!!
$ rpm -e mc//패키지 이름만으로 삭제
YUM의 등장
Yellowdog
Updater Modified
rpm의 경우 의존성 문제가 존재함. 이를 해결하기 위해 나온것이 YUM
의존성
문제란? A를 설치하기 위해 B가 먼저 설치되어있어야
하는 것.
rpm은 B가 설치되어있지 않을 경우 A패키지 설치를 시도할 경우 B를 설치해야 한다고 알려주기는 하나 대략적으로 알려주고, B또한
다른 패키지에 의존성이 있을수도 있어 불편함을 유발한다.
yum은 인터넷이 정상적으로 동작해야
작동함. yum은 의존성이 있는것을 모두 알아서 설치해준다!!! 즉 yum 명령어는 내부적으로 rpm명령을 실행하는것!!