CentOS系列教程(七)

本文是 kubernets集群实验部署前的准备操作。

以下是操作过程:

#########################################################

更换yum源

[ ~]$ su root
Password:
[ master]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original0
[ master]# ls -F /etc/yum.repos.d/
CentOS-Base.repo.original0 CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[ master]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2020-04-14 19:42:42-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251
Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1572 (1.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[=========================================================================================================>] 1,572 --.-K/s in 0s

2020-04-14 19:42:42 (469 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [1572/1572]

[ master]# ls -F /etc/yum.repos.d/
CentOS-Base.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
CentOS-Base.repo.original0 CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[ master]# cat -n /etc/yum.repos.d/CentOS-Base.repo
1 # CentOS-Base.repo
2 #
3 # The mirror system uses the connecting IP address of the client and the
4 # update status of each mirror to pick mirrors that are updated to and
5 # geographically close to the client. You should use this for CentOS updates
6 # unless you are manually picking other mirrors.
7 #
8 # If the mirrorlist= does not work for you, as a fall back you can try the
9 # remarked out baseurl= line instead.
10 #
11 #
12 [base]
13 name=CentOS-$releasever - Base - 163.com
14 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
15 baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
16 gpgcheck=1
17 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
18
19 #released updates
20 [updates]
21 name=CentOS-$releasever - Updates - 163.com
22 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
23 baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
24 gpgcheck=1
25 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
26
27 #additional packages that may be useful
28 [extras]
29 name=CentOS-$releasever - Extras - 163.com
30 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
31 baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
32 gpgcheck=1
33 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
34
35 #additional packages that extend functionality of existing packages
36 [centosplus]
37 name=CentOS-$releasever - Plus - 163.com
38 baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
39 gpgcheck=1
40 enabled=0
41 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[ master]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[ master]# yum makecache
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): base/7/x86_64/group_gz | 165 kB 00:00:00
(2/10): base/7/x86_64/primary_db | 6.0 MB 00:00:04
(3/10): base/7/x86_64/filelists_db | 7.3 MB 00:00:04
(4/10): extras/7/x86_64/primary_db | 165 kB 00:00:00
(5/10): extras/7/x86_64/filelists_db | 217 kB 00:00:00
(6/10): extras/7/x86_64/other_db | 106 kB 00:00:00
(7/10): base/7/x86_64/other_db | 2.6 MB 00:00:02
(8/10): updates/7/x86_64/filelists_db | 4.5 MB 00:00:03
(9/10): updates/7/x86_64/other_db | 573 kB 00:00:00
(10/10): updates/7/x86_64/primary_db | 7.6 MB 00:00:05
Metadata Cache Created
[ master]#


[ ~]$ su root
Password:
[ work0]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original0
[ work0]# ls -F /etc/yum.repos.d/
CentOS-Base.repo.original0 CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[ work0]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2020-04-14 19:45:45-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251
Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1572 (1.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[=========================================================================================================>] 1,572 --.-K/s in 0s

2020-04-14 19:45:45 (127 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [1572/1572]

[ work0]# ls -F /etc/yum.repos.d/
CentOS-Base.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
CentOS-Base.repo.original0 CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[ work0]# cat -n /etc/yum.repos.d/CentOS-Base.repo
1 # CentOS-Base.repo
2 #
3 # The mirror system uses the connecting IP address of the client and the
4 # update status of each mirror to pick mirrors that are updated to and
5 # geographically close to the client. You should use this for CentOS updates
6 # unless you are manually picking other mirrors.
7 #
8 # If the mirrorlist= does not work for you, as a fall back you can try the
9 # remarked out baseurl= line instead.
10 #
11 #
12 [base]
13 name=CentOS-$releasever - Base - 163.com
14 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
15 baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
16 gpgcheck=1
17 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
18
19 #released updates
20 [updates]
21 name=CentOS-$releasever - Updates - 163.com
22 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
23 baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
24 gpgcheck=1
25 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
26
27 #additional packages that may be useful
28 [extras]
29 name=CentOS-$releasever - Extras - 163.com
30 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
31 baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
32 gpgcheck=1
33 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
34
35 #additional packages that extend functionality of existing packages
36 [centosplus]
37 name=CentOS-$releasever - Plus - 163.com
38 baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
39 gpgcheck=1
40 enabled=0
41 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[ work0]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[ work0]# yum makecache
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): base/7/x86_64/group_gz | 165 kB 00:00:00
(2/10): base/7/x86_64/filelists_db | 7.3 MB 00:00:05
(3/10): extras/7/x86_64/filelists_db | 217 kB 00:00:00
(4/10): extras/7/x86_64/other_db | 106 kB 00:00:00
(5/10): base/7/x86_64/primary_db | 6.0 MB 00:00:06
(6/10): extras/7/x86_64/primary_db | 165 kB 00:00:01
(7/10): base/7/x86_64/other_db | 2.6 MB 00:00:02
(8/10): updates/7/x86_64/filelists_db | 4.5 MB 00:00:04
(9/10): updates/7/x86_64/other_db | 573 kB 00:00:00
(10/10): updates/7/x86_64/primary_db | 7.6 MB 00:00:05
Metadata Cache Created
[ work0]#


[ ~]$ su root
Password:
[ work1]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original0
[ work1]# ls -F /etc/yum.repos.d/
CentOS-Base.repo.original0 CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[ work1]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2020-04-14 19:47:51-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
Resolving mirrors.163.com (mirrors.163.com)... 59.111.0.251
Connecting to mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1572 (1.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

100%[=========================================================================================================>] 1,572 --.-K/s in 0s

2020-04-14 19:47:51 (441 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [1572/1572]

[ work1]# ls -F /etc/yum.repos.d/
CentOS-Base.repo CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
CentOS-Base.repo.original0 CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[ work1]# cat -n /etc/yum.repos.d/CentOS-Base.repo
1 # CentOS-Base.repo
2 #
3 # The mirror system uses the connecting IP address of the client and the
4 # update status of each mirror to pick mirrors that are updated to and
5 # geographically close to the client. You should use this for CentOS updates
6 # unless you are manually picking other mirrors.
7 #
8 # If the mirrorlist= does not work for you, as a fall back you can try the
9 # remarked out baseurl= line instead.
10 #
11 #
12 [base]
13 name=CentOS-$releasever - Base - 163.com
14 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
15 baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
16 gpgcheck=1
17 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
18
19 #released updates
20 [updates]
21 name=CentOS-$releasever - Updates - 163.com
22 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
23 baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
24 gpgcheck=1
25 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
26
27 #additional packages that may be useful
28 [extras]
29 name=CentOS-$releasever - Extras - 163.com
30 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
31 baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
32 gpgcheck=1
33 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
34
35 #additional packages that extend functionality of existing packages
36 [centosplus]
37 name=CentOS-$releasever - Plus - 163.com
38 baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
39 gpgcheck=1
40 enabled=0
41 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
[ work1]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[ work1]# yum makecache
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): base/7/x86_64/group_gz | 165 kB 00:00:00
(2/10): base/7/x86_64/primary_db | 6.0 MB 00:00:04
(3/10): base/7/x86_64/filelists_db | 7.3 MB 00:00:05
(4/10): extras/7/x86_64/primary_db | 165 kB 00:00:00
(5/10): extras/7/x86_64/filelists_db | 217 kB 00:00:00
(6/10): extras/7/x86_64/other_db | 106 kB 00:00:00
(7/10): base/7/x86_64/other_db | 2.6 MB 00:00:02
(8/10): updates/7/x86_64/filelists_db | 4.5 MB 00:00:04
(9/10): updates/7/x86_64/other_db | 573 kB 00:00:00
(10/10): updates/7/x86_64/primary_db | 7.6 MB 00:00:05
Metadata Cache Created
[ work1]#

同步时间服务器

[ master]# yum -y update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
..................................................................................
Complete!
[ master]#
[ master]# yum install -y ntpdate
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Package ntpdate-4.2.6p5-29.el7.centos.x86_64 already installed and latest version
Nothing to do
[ master]# ntpdate time.windows.com
14 Apr 20:30:00 ntpdate[32745]: adjust time server 20.189.79.72 offset -0.008414 sec
[ master]# ntpq -p
ntpq: read: Connection refused
[ master]# ntpstat
synchronised to NTP server (203.107.6.88) at stratum 3
time correct to within 26 ms
polling server every 64 s
[ master]# timedatectl status
Local time: Tue 2020-04-14 20:33:07 EDT
Universal time: Wed 2020-04-15 00:33:07 UTC
RTC time: Wed 2020-04-15 00:33:07
Time zone: America/New_York (EDT, -0400)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2020-03-08 01:59:59 EST
Sun 2020-03-08 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2020-11-01 01:59:59 EDT
Sun 2020-11-01 01:00:00 EST
[ master]#


[ work0]# yum -y update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
...................................................................................
Complete!
[ work0]#
[ work0]# ntp -p
bash: ntp: command not found...
[ work0]# ntpstat
synchronised to NTP server (162.159.200.123) at stratum 4
time correct to within 74 ms
polling server every 64 s
[ work0]# timedatectl status
Local time: Tue 2020-04-14 20:34:04 EDT
Universal time: Wed 2020-04-15 00:34:04 UTC
RTC time: Wed 2020-04-15 00:34:04
Time zone: America/New_York (EDT, -0400)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2020-03-08 01:59:59 EST
Sun 2020-03-08 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2020-11-01 01:59:59 EDT
Sun 2020-11-01 01:00:00 EST
[ work0]#


[ work1]# yum -y update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
.............................................................
Complete!
[ work1]#
[ work1]# ntp -p
bash: ntp: command not found...
[ work1]# ntpstat
synchronised to NTP server (185.209.85.222) at stratum 3
time correct to within 142 ms
polling server every 64 s
[ work1]# timedatectl status
Local time: Tue 2020-04-14 20:35:10 EDT
Universal time: Wed 2020-04-15 00:35:10 UTC
RTC time: Wed 2020-04-15 00:35:10
Time zone: America/New_York (EDT, -0400)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2020-03-08 01:59:59 EST
Sun 2020-03-08 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2020-11-01 01:59:59 EDT
Sun 2020-11-01 01:00:00 EST
[ work1]#
########################################################

关闭防火墙及SELinux

[ master]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[ master]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)

Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:19:13 localhost.localdomain firewalld[105054]: WARNING: COMMAND_FAILED: ‘/...
Apr 14 20:40:52 localhost.localdomain systemd[1]: Stopping firewalld - dynamic fire....
Apr 14 20:40:53 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firew....
Hint: Some lines were ellipsized, use -l to show in full.
[ master]# sed -i ‘s/^SELINUX=.*/SELINUX=disabled/‘ /etc/selinux/config && setenforce 0
[ master]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
[ master]#


[ work0]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[ work0]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)

Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:23:12 localhost.localdomain firewalld[99036]: WARNING: COMMAND_FAILED: ‘/....
Apr 14 20:42:28 localhost.localdomain systemd[1]: Stopping firewalld - dynamic fire....
Apr 14 20:42:29 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firew....
Hint: Some lines were ellipsized, use -l to show in full.
[ work0]# sed -i ‘s/^SELINUX=.*/SELINUX=disabled/‘ /etc/selinux/config && setenforce 0
[ work0]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
[ work0]#


[ work1]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[ work1]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)

Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete FORW...ain?).
Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete FORW... name.
Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete FORW... name.
Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete INPU...ain?).
Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete INPU...ain?).
Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete OUTP...ain?).
Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete INPU...ain?).
Apr 14 20:20:04 localhost.localdomain firewalld[108328]: WARNING: COMMAND_FAILED: ‘/usr/sbin/iptables -w10 -w --table filter --delete INPU...ain?).
Apr 14 20:43:20 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Apr 14 20:43:22 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[ work1]# sed -i ‘s/^SELINUX=.*/SELINUX=disabled/‘ /etc/selinux/config && setenforce 0
[ work1]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
[ work1]#
###########################################################

关闭 swap 分区

[ master]# swapoff -a
[ master]# sed -i ‘/ swap / s/^(.*)$/#\1/g‘ /etc/fstab
[ master]# cat -n /etc/fstab
1
2 #
3 # /etc/fstab
4 # Created by anaconda on Tue Apr 14 08:46:18 2020
5 #
6 # Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
7 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
8 #
9 UUID=ad08156d-ad9b-4525-8861-5ab554149601 / ext4 defaults 1 1
10 UUID=a872a80c-aaf7-4b70-af32-1f39bcd637cc /boot ext4 defaults 1 2
[ master]#
【我的master机器采用的是自定义分区,只分了/boot和/,因此在文件/etc/fstab中没有swap的相关信息。而我的work0和work1采用了默认分区,在文件/etc/fstab中可以看到swap的相关信息。】


[ work0]# swapoff -a
[ work0]# sed -i ‘/ swap / s/^(.*)$/#\1/g‘ /etc/fstab
[ work0]# cat -n /etc/fstab
1
2 #
3 # /etc/fstab
4 # Created by anaconda on Tue Apr 14 09:36:38 2020
5 #
6 # Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
7 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
8 #
9 /dev/mapper/centos-root / xfs defaults 0 0
10 UUID=a61e2021-e23e-4a8d-91bb-c0a3f59311eb /boot xfs defaults 0 0
11 #/dev/mapper/centos-swap swap swap defaults 0 0
[ work0]#


[ work1]# swapoff -a
[ work1]# sed -i ‘/ swap / s/^(.*)$/#\1/g‘ /etc/fstab
[ work1]# cat -n /etc/fstab
1
2 #
3 # /etc/fstab
4 # Created by anaconda on Tue Apr 14 10:12:56 2020
5 #
6 # Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
7 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
8 #
9 /dev/mapper/centos-root / xfs defaults 0 0
10 UUID=b38b9242-a8c9-4494-a833-c59ce0a9a13d /boot xfs defaults 0 0
11 #/dev/mapper/centos-swap swap swap defaults 0 0
[ work1]#

孟伯,20200411

交流联系:微信 1807479153 ,QQ 1807479153

相关推荐