•  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
r16 vs r17
1 1
[[분류:Linux]]
2 2
[include(틀:상위 문서, top1=CentOS)]
3 3
4 4
[목차]
5 5
6 6
== 개요 ==
7 7
8 8
*이 문서는 CentOS (버전7.9기준) 설치 방법을 기술한 문서 입니다.
9 9
*CentOS 7 은 작성일 기준 EOS(서비스 지원 중단) 되었지만, 라이브 환경에 가장 많이 설치되어있는 버전입니다.
10 10
11 11
*''본 문서는 기본적인 구성에 대한 이해를 돕기 위한 문서이며 실제 라이브 환경의 파티션 구성 및 상세 설정은 다를 수 있습니다.''
12 12
13 13
14 14
== 설치 USB 만들기 ==
15 15
=== ISO 다운로드 ===
16 16
[[https://vault.centos.org/7.9.2009/isos/x86_64/|CentOS 7.9 ISO 다운로드]]
17 17
[[파일:CentOS_7_설치가이드_1-1.png|width=65%]]
18 18
*CentOS-7-x86_64-Minimal-2009.iso : 최소 설치 버전의 ISO
19 19
*CentOS-7-x86_64-DVD-2009.iso : 기본 설치 버전의 ISO
20 20
*CentOS-7-x86_64-Everything-2009.iso : 전체 설치 버전의 ISO
21 21
22 22
''해당 설치 가이드는 '''Minimal'''버전을 기준으로 설치 진행함.''
23 23
24 24
=== Rufus 다운로드 ===
25 25
'''부팅용 USB 만드는 Tool'''
26 26
[[https://rufus.ie/ko/|Rufus 다운로드]]
27 27
[[파일:CentOS_7_설치가이드_1-2.png|width=65%]]
28 28
29 29
=== 이미지 제작 ===
30 30
준비된 USB 에 다운로드 받은 ISO 를 선택하고 시작 버튼 클릭
31 31
[[파일:CentOS_7_설치가이드_1-3.png|width=45%]]
32 32
33 33
== OS 설치 ==
34 34
[[파일:CentOS_7_설치가이드_2-1.png|width=65%]]
35 35
Install CentOS 7 선택
36 36
37 37
[[파일:CentOS_7_설치가이드_2-2.png|width=65%]]
38 38
Continue 선택
39 39
40 40
[[파일:CentOS_7_설치가이드_2-3.png|width=65%]]
41 41
DATE & TIME 선택
42 42
43 43
[[파일:CentOS_7_설치가이드_2-4.png|width=65%]]
44 44
Asia / Seoul 선택 후 Done 선택
45 45
''간혹 시간이 안맞을 수도 있으니 체크''
46 46
47 47
[[파일:CentOS_7_설치가이드_2-5.png|width=65%]]
48 48
INSTALLATION DESTINATION
49 49
50 50
[[파일:CentOS_7_설치가이드_2-6.png|width=65%]]
51 51
OS 설치할 파티션 선택 후 I will configure partitioning. 선택 후 Done 클릭
52 52
53 53
[[파일:CentOS_7_설치가이드_2-7.png|width=65%]]
54 54
Standard Partition 으로 선택 후 Click here to ... 해당 부분 클릭
55 55
56 56
[[파일:CentOS_7_설치가이드_2-8.png|width=65%]]
57 57
설치 환경에 맞추어 파티셔닝 후 Done 클릭
58 58
59 59
[[파일:CentOS_7_설치가이드_2-9.png|width=65%]]
60 60
최종 파티셔닝 결과 확인 후 Accept Changes 선택
61 61
62 62
[[파일:CentOS_7_설치가이드_2-10.png|width=65%]]
63 63
kdump 선택
64 64
65 65
[[파일:CentOS_7_설치가이드_2-11.png|width=65%]]
66 66
Enable kdump 선택 해제 후 Done 선택
67 67
68 68
[[파일:CentOS_7_설치가이드_2-12.png|width=65%]]
69 69
Begin Installation 선택하여 설치 진행
70 70
71 71
[[파일:CentOS_7_설치가이드_2-13.png|width=65%]]
72 72
ROOT PASSWORD 클릭
73 73
74 74
[[파일:CentOS_7_설치가이드_2-14.png|width=65%]]
75 75
상황에 맞게 설정 후 Done 클릭
76 76
77 77
== 환경 구성 ==
78 78
=== resolv.conf 수정 ===
79 79
{{{[root@localhost ~]# vi /etc/resolv.conf
80 80
...
81 81
nameserver 8.8.8.8
82 82
...
83 83
}}} resolv.conf 설정 이후 원격 재 접속 시 dns 질의가 발생하여 접속이 느려질 수도 있음
84 84
해당 경우 resolv.conf에서 nameserver 삭제 후 재 접속 하면 해결 가능
85 85
86 86
=== repo 변경 ===
87 87
CentOS 7의 공식 repository는 EOS/EOL 되어 서비스가 불가능한 상황임으로,
88 88
따라서 사내 등 공인망 환경에서는 repo를 사용 가능한 다른 곳으로 설정
89 89
90 90
* YUM 리포지토리 설정 파일 열기
91 91
{{{[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo
92 92
}}}
93 93
*리포지토리 설정 값 수정하기(아래 내용을 복사)
94 94
{{{[base]
95 95
name=CentOS-$releasever - Base
96 96
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
97 97
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
98 98
gpgcheck=1
99 99
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
100 100
101 101
[updates]
102 102
name=CentOS-$releasever - Updates
103 103
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
104 104
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
105 105
gpgcheck=1
106 106
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
107 107
108 108
[extras]
109 109
name=CentOS-$releasever - Extras
110 110
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
111 111
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
112 112
gpgcheck=1
113 113
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
114 114
115 115
[centosplus]
116 116
name=CentOS-$releasever - Plus
117 117
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
118 118
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
119 119
gpgcheck=1
120 120
enabled=0
121 121
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
122 122
}}}
123 123
*변경사항 적용
124 124
{{{[root@localhost ~]# yum install epel-release
125 125
}}}
126 126
=== hostname 설정 ===
127 127
{{{[root@localhost ~]# hostnamectl set-hostname testServer --static
128 128
}}} --static 옵션을 사용하면 대소문자를 구분하여 적용
129 129
=== 부팅 시 런레벨 설정 ===
130 130
{{{[root@localhost ~]# systemctl set-default multi-user.target
131 131
[root@localhost ~]# systemctl get-default
132 132
multi-user.target
133 133
}}}
134 134
=== selinux 해제 ===
135 135
{{{[root@localhost ~]# vi /etc/sysconfig/selinux
136 136
...
137 137
SELINUX=disabled
138 138
...
139 139
}}}
140 140
=== 방화벽 해제 ===
141 141
{{{[root@localhost ~]# systemctl disabled --now firewalld
142 142
}}}
143 143
144 144
=== 불필요한 데몬 종료 ===
145 145
{{{[root@localhost ~]# systemctl disable --now NetworkManager
146 146
[root@localhost ~]# systemctl disable --now abrt-ccpp
147 147
[root@localhost ~]# systemctl disable --now abrtd
148 148
[root@localhost ~]# systemctl disable --now atd
149 149
[root@localhost ~]# systemctl disable --now auditd
150 150
[root@localhost ~]# systemctl disable --now kdump
151 151
[root@localhost ~]# systemctl disable --now netconsole
152 152
[root@localhost ~]# systemctl disable --now messagebus
153 153
}}} 데몬 종료 후 su 실행이 느려지면 {{{ systemctl restart systemd-logind }}}실행
154 154
=== swap 파티션 해제 ===
155 155
{{{[root@localhost ~]# swapoff -a
156 156
[root@localhost ~]# sed -i.bak -r 's/(.+ swap .+)/#\1/' /etc/fstab
157 157
}}}
158 158
=== 시간 동기화 설정 ===
159 159
{{{[root@localhost ~]# yum install -y chrony
160 160
[root@localhost ~]# systemctl enable --now chronyd
161 161
[root@localhost ~]# systemctl status chronyd
162 162
[root@localhost ~]# chronyc sources
163 163
}}}[[파일:CentOS_7_설치가이드_3-1.png|width=65%]]
164 164
=== ssh 보안 설정 ===
165 165
{{{[root@localhost ~]# vi /etc/ssh/sshd_config
166 166
}}}{{{...
167 167
Port 2233
168 168
...
169 169
PermitRootLogin no
170 170
...
171 171
MaxAuthTries 3
172 172
...
173 173
X11Forwarding yes
174 174
...
175 175
}}}
176 176
177 177
=== 일반 사용자 생성 ===
178 178
{{{[root@localhost ~]# useradd -d /home/sysadmin -s /bin/bash sysadmin
179 179
[root@localhost ~]# passwd sysadmin
180 180
181 181
New password: 패스워드 입력
182 182
Retype new password: 패스워드 입력
183 183
passwd: all authentication tokens updated successfully
184 184
}}}
185 185
=== 일반 사용자의 root 접근 권한 설정 (sudo) ===
186 186
*su 명령어와 관련된 PAM 설정 파일
187 187
{{{[root@localhost ~]# vi /etc/pam.d/su
188 188
}}}
189 189
*아래 줄 주석 해제
190 190
{{{...
191 191
auth required pam_wheel.so use_uid
192 192
...
193 193
}}}
194 194
*일반 사용자의 변경된 권한 적용
195 195
{{{[root@localhost ~]# gpasswd -a sysadmin wheel
196 196
[root@localhost ~]# chgrp wheel /usr/bin/su
197 197
[root@localhost ~]# chmod 4750 /usr/bin/su
198 198
}}}
199 199
=== 필수 패키지 설치 ===
200 200
{{{[root@localhost ~]# yum install yum-utils net-tools wget
201 201
}}}
202 202
=== 파티션 설정 ===
203 203
{{{[root@localhost ~]# fdisk -l
204 204
}}}[[파일:CentOS_7_설치가이드_3-2.png|width=65%]]
205 205
{{{[root@localhost ~]# parted /dev/vdb
206 206
}}}[[파일:CentOS_7_설치가이드_3-3.png|width=65%]]
207 207
{{{(parted) mklabel gpt
208 208
}}}[[파일:CentOS_7_설치가이드_3-4.png|width=55%]]
209 209
{{{(parted) mkpart
210 210
}}}[[파일:CentOS_7_설치가이드_3-5.png|width=65%]]
211 211
{{{(parted) quit
212 212
[root@localhost ~]# mkfs.xfs -f /dev/vdb1
213 213
}}}[[파일:CentOS_7_설치가이드_3-6.png|width=65%]]
214 214
{{{[root@localhost ~]# mkdir /data
215 215
[root@localhost ~]# mount /dev/vdb1 /data
216 216
[root@localhost ~]# df -h
217 217
}}}[[파일:CentOS_7_설치가이드_3-7.png|width=65%]]
218 218
{{{[root@localhost ~]# echo '/dev/vdb1 /data xfs default 0 0' |sudo tee -a /etc/fstab
219 219
}}}[[파일:CentOS_7_설치가이드_3-8.png|width=65%]]
220 220
221 221
상기 모든 내용 정상 반영 확인 되면 reboot 명령어 실행
222 222
223 223
=== 본딩 설정 ===
224 224
>''예시이므로 상황에 맞춰서 인터페이스 명 변경 필요''
225 225
> '''ens3 과 ens8을 bond0의 192.168.100.10으로 묶는 경우'''
226 226
[[파일:CentOS_7_설치가이드_3-9.png|width=65%]]
227 227
228 228
{{{[root@localhost ~]# vi /etc/sysconfig/network-scrpits/ifcfg-bond0
229 229
}}}{{{DEVICE=bond0
230 230
TYPE=bond
231 231
BONDING_OPTS="mode=1 miimon=100 fail_over_mac=1"
232 232
ONBOOT=yes
233 233
BOOTPROTO=static
234 234
IPADDR=172.16.67.151
235 235
NETMASK=255.255.255.0
236 236
GATEWAY=172.16.1.1
237 237
}}} fail_over_mac 설정
238 238
0으로 설정 시 인터페이스 절체 상황에서 active 인터페이스의 mac으로 유지함
239 239
1로 설정 시 인터페이스 절체 상황에서 절체된 인터페이스의 mac으로 변경함
240 240
가상 환경에서는 1로 설정하여야 본딩 환경 구성 및 절체 테스트가 정상적으로 가능함
241 241
{{{[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens3
242 242
}}}[[파일:CentOS_7_설치가이드_3-10.png|width=65%]]
243 243
{{{[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens8
244 244
}}}[[파일:CentOS_7_설치가이드_3-11.png|width=45%]]
245 245
{{{[root@localhost ~]# systemctl restart network
246 246
}}}'''해당 커맨드 실행 시 전체 네트워크가 재 설정 되므로 라이브 혹은 작업시에 주의해서 사용할 것'''
247 247
{{{[root@localhost ~]# cat /proc/net/bonding/bond0
248 248
}}}[[파일:CentOS_7_설치가이드_3-12.png|width=65%]]
... ...