@@ -213,3 +213,137 @@ done
213
213
214
214
```
215
215
216
+
217
+ ## yum源的问题
218
+
219
+ 采用阿里的CentOS-Base.repo,这里需要编辑其gpgkey的地址,它原来是file协议,反向代理不了。修改成http即可
220
+ ### 创建/aliyunRepo/CentOS-Base.repo文件
221
+
222
+ ```
223
+ # CentOS-Base.repo
224
+ #
225
+ # The mirror system uses the connecting IP address of the client and the
226
+ # update status of each mirror to pick mirrors that are updated to and
227
+ # geographically close to the client. You should use this for CentOS updates
228
+ # unless you are manually picking other mirrors.
229
+ #
230
+ # If the mirrorlist= does not work for you, as a fall back you can try the
231
+ # remarked out baseurl= line instead.
232
+ #
233
+ #
234
+
235
+ [base]
236
+ name=CentOS-$releasever - Base - mirrors.aliyun.com
237
+ failovermethod=priority
238
+ baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
239
+ http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
240
+ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
241
+ gpgcheck=1
242
+ #gpgkey=file:///mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
243
+ gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
244
+
245
+ #released updates
246
+ [updates]
247
+ name=CentOS-$releasever - Updates - mirrors.aliyun.com
248
+ failovermethod=priority
249
+ baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
250
+ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
251
+ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
252
+ gpgcheck=1
253
+ #gpgkey=file:///mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
254
+ gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
255
+
256
+ #additional packages that may be useful
257
+ [extras]
258
+ name=CentOS-$releasever - Extras - mirrors.aliyun.com
259
+ failovermethod=priority
260
+ baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
261
+ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
262
+ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
263
+ gpgcheck=1
264
+ #
265
+ #gpgkey=file:///mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
266
+ gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
267
+
268
+ #additional packages that extend functionality of existing packages
269
+ [centosplus]
270
+ name=CentOS-$releasever - Plus - mirrors.aliyun.com
271
+ failovermethod=priority
272
+ baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
273
+ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
274
+ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
275
+ gpgcheck=1
276
+ enabled=0
277
+ #gpgkey=file:///mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
278
+ gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
279
+
280
+ #contrib - packages by Centos Users
281
+ [contrib]
282
+ name=CentOS-$releasever - Contrib - mirrors.aliyun.com
283
+ failovermethod=priority
284
+ baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
285
+ http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
286
+ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
287
+ gpgcheck=1
288
+ enabled=0
289
+ gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
290
+
291
+
292
+
293
+ ```
294
+
295
+ ### 创建/aliyunRepo/epel.repo文件
296
+
297
+ ```
298
+ [epel]
299
+ name=Extra Packages for Enterprise Linux 7 - $basearch
300
+ baseurl=http://mirrors.aliyun.com/epel/7/$basearch
301
+ http://mirrors.aliyuncs.com/epel/7/$basearch
302
+ #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
303
+ failovermethod=priority
304
+ enabled=1
305
+ gpgcheck=0
306
+ #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
307
+ gpgkey=http://etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
308
+
309
+ [epel-debuginfo]
310
+ name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
311
+ baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug
312
+ http://mirrors.aliyuncs.com/epel/7/$basearch/debug
313
+ #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
314
+ failovermethod=priority
315
+ enabled=0
316
+ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
317
+ gpgcheck=0
318
+
319
+ [epel-source]
320
+ name=Extra Packages for Enterprise Linux 7 - $basearch - Source
321
+ baseurl=http://mirrors.aliyun.com/epel/7/SRPMS
322
+ http://mirrors.aliyuncs.com/epel/7/SRPMS
323
+ #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
324
+ failovermethod=priority
325
+ enabled=0
326
+ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
327
+ gpgcheck=0
328
+
329
+
330
+ ```
331
+
332
+ ### 分发到每台机器上
333
+ NODE_IPS="192.168.0.2 192.168.0.5 192.168.0.6 192.168.0.7 192.168.0.8 192.168.0.9 192.168.0.10 192.168.0.11 192.168.0.12 192.168.0.13 192.168.0.14 192.168.0.15 192.168.0.16 192.168.0.17 192.168.0.18 192.168.0.19"
334
+ NODE_NAME="ms02 ms05 ms06 ms07 ms08 ms09 ms10 ms11 ms12 ms13 ms14 ms15 ms16 ms17 ms18 ms19"
335
+
336
+ for ip in $NODE_IPS ;do
337
+ echo "初始化$ip aliyu 的..."
338
+ ssh root@$ip "cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak1"
339
+ ssh root@$ip "cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak1"
340
+
341
+ scp /aliyunRepo/CentOS-Base.repo root@$ip:/etc/yum.repos.d/CentOS-Base.repo
342
+ scp /aliyunRepo/epel.repo root@$ip:/etc/yum.repos.d/epel.repo
343
+
344
+ ssh root@$ip " ls /etc/yum.repos.d/"
345
+
346
+ sleep 10
347
+ done
348
+
349
+ ```
0 commit comments