•  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
r10
r1

(새 문서)
1[[분류:Linux]]
r2
2[include(틀:상위 문서, top1=CentOS)]
r1

(새 문서)
3
4[목차]
5
6== 개요 ==
r3
7
r1

(새 문서)
8 *이 문서는 CentOS (버전7.9기준) 설치 방법을 기술한 문서 입니다.
r3
9 *CentOS 7 은 작성일 기준 EOS(서비스 지원 중단) 되었지만, 라이브 환경에 가장 많이 설치되어있는 버전입니다.
10
11 *''본 문서는 기본적인 구성에 대한 이해를 돕기 위한 문서이며 실제 라이브 환경의 파티션 구성 및 상세 설정은 다를 수 있습니다.''
r10
12
13
r1

(새 문서)
14== 설치 USB 만들기 ==
r4
15=== ISO 다운로드 ===
16 [[https://vault.centos.org/7.9.2009/isos/x86_64/|CentOS 7.9 ISO 다운로드]]
r10
17 [[파일:CentOS_7_설치가이드_1-1.png|width=65%]]
r4
18 *CentOS-7-x86_64-Minimal-2009.iso : 최소 설치 버전의 ISO
19 *CentOS-7-x86_64-DVD-2009.iso : 기본 설치 버전의 ISO
20 *CentOS-7-x86_64-Everything-2009.iso : 전체 설치 버전의 ISO
21
22 ''해당 설치 가이드는 '''Minimal'''버전을 기준으로 설치 진행함.''
23
24=== Rufus 다운로드 ===
25'''부팅용 USB 만드는 Tool'''
26[[https://rufus.ie/ko/|Rufus 다운로드]]
27
28
29=== 이미지 제작 ===
30준비된 USB 에 다운로드 받은 ISO 를 선택하고 시작 버튼 클릭
31
32
33== OS 설치 ==
34
35== 환경 구성 ==
36=== resolv.conf 수정 ===
r8
37{{{[root@localhost ~]# vi /etc/resolv.conf
r10
38...
r8
39nameserver 8.8.8.8
r10
40...
r5
41}}}
42resolv.conf 설정 이후 원격 재 접속 시 dns 질의가 발생하여 접속이 느려질 수 있습니다.
43해당 경우 resolv.conf에서 nameserver 삭제 후 재 접속 하면 해결 가능합니다.
44
45=== repo 변경 ===
r7
46CentOS 7의 공식 repository는 EOS/EOL 되어 서비스가 불가능한 상황임으로,
47따라서 사내 등 공인망 환경에서는 repo를 사용 가능한 다른 곳으로 설정해야합니다.
r4
48
r7
49 * YUM 리포지토리 설정 파일 열기
r9
50 {{{[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo
r7
51}}}
52 *리포지토리 설정 값 수정하기(아래 내용을 복사){{{
53 [base]
54 name=CentOS-$releasever - Base
55 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
56 baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
57 gpgcheck=1
58 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
59
60 [updates]
61 name=CentOS-$releasever - Updates
62 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
63 baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
64 gpgcheck=1
65 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
66
67 [extras]
68 name=CentOS-$releasever - Extras
69 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
70 baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
71 gpgcheck=1
72 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
73
74 [centosplus]
75 name=CentOS-$releasever - Plus
76 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
77 baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
78 gpgcheck=1
79 enabled=0
80 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
81 }}}
r9
82 *변경사항 적용{{{ [root@localhost ~]# yum install epel-release
r7
83}}}
r4
84=== hostname 설정 ===
r10
85{{{ [root@localhost ~]# hostnamectl set-hostname testServer --static
86}}}
87 --static 옵션을 사용하면 대소문자를 구분하여 적용됩니다.
r4
88=== 부팅 시 런레벨 설정 ===
r10
89{{{ [root@localhost ~]# systemctl set-default multi-user.target
90 [root@localhost ~]# systemctl get-default
91 multi-user.target
92}}}
r4
93=== selinux 해제 ===
r10
94{{{[root@localhost ~]# vi /etc/sysconfig/selinux
95...
96SELINUX=disabled
97...
98}}}
r4
99=== 방화벽 해제 ===
r10
100{{{[root@localhost ~]# systemctl disabled --now firewalld
101}}}
r4
102
103=== 불필요한 데몬 종료 ===
r10
104{{{[root@localhost ~]# systemctl disable --now NetworkManager
105[root@localhost ~]# systemctl disable --now abrt-ccpp
106[root@localhost ~]# systemctl disable --now abrtd
107[root@localhost ~]# systemctl disable --now atd
108[root@localhost ~]# systemctl disable --now auditd
109[root@localhost ~]# systemctl disable --now kdump
110[root@localhost ~]# systemctl disable --now netconsole
111[root@localhost ~]# systemctl disable --now messagebus
112}}}
113데몬 종료 후 su 실행이 느려지면 {{{ systemctl restart systemd-logind }}}실행하면 됩니다.
r4
114=== swap 파티션 해제 ===
r10
115{{{[root@localhost ~]# swapoff -a
116[root@localhost ~]# sed -i.bak -r 's/(.+ swap .+)/#\1/' /etc/fstab
117}}}
r4
118=== 시간 동기화 설정 ===
r10
119{{{[root@localhost ~]# yum install -y chrony
120[root@localhost ~]# systemctl enable --now chronyd
121[root@localhost ~]# systemctl status chronyd
122[root@localhost ~]# chronyc sources
r4
123
r10
124}}}
r4
125=== ssh 보안 설정 ===
r10
126{{{[root@localhost ~]# vi /etc/ssh/sshd_config
127...
128Port 2233
129...
130PermitRootLogin no
131...
132MaxAuthTries 3
133...
134X11Forwarding yes
135...
136}}}
r4
137
138=== 일반 사용자 생성 ===
r10
139{{{[root@localhost ~]# useradd -d /home/sysadmin -s /bin/bash sysadmin
140[root@localhost ~]# passwd sysadmin
r4
141
r10
142New password: 패스워드 입력
143Retype new password: 패스워드 입력
144passwd: all authentication tokens updated successfully
145}}}
146=== 일반 사용자의 root 접근 권한 설정 (sudo) ===
147 *su 명령어와 관련된 PAM 설정 파일
148 {{{[root@localhost ~]# vi /etc/pam.d/su
149}}}
150 *아래 줄 주석 해제
151 {{{...
152auth required pam_wheel.so use_uid
153...
154}}}
155 *일반 사용자의 변경된 권한 적용
156 {{{[root@localhost ~]# gpasswd -a sysadmin wheel
157[root@localhost ~]# chgrp wheel /usr/bin/su
158[root@localhost ~]# chmod 4750 /usr/bin/su
159}}}
r4
160=== 필수 패키지 설치 ===
r10
161{{{[root@localhost ~]# yum install yum-utils net-tools wget
162}}}
r4
163=== 파티션 설정 ===
164
165=== 본딩 설정 ===