Step 1 : check out 物理存储,至少8G以上
[root@node1 ~]# grep MemTotal /proc/meminfo
MemTotal: 8154896 kB
[root@node1 ~]#
Step 2.check out Swap空间
[root@node1 ~]# grep SwapTotal /proc/meminfo
SwapTotal: 8257532 kB
[root@node1 ~]#
Step 3:check out 文件系统
[root@node1 ~]#
[root@node1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 8.0G 0 8.0G 0% /dev/shm
tmpfs 3.9G 13M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root 48G 14G 35G 29% /
/dev/sda1 1014M 198M 817M 20% /boot
/dev/mapper/centos-home 24G 46M 24G 1% /home
tmpfs 797M 48K 797M 1% /run/user/54331
tmpfs 797M 0 797M 0% /run/user/0
[root@node1 ~]#
Step 4: check out core
[root@node1 ~]#
[root@node1 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@node1 ~]# uname -a
Linux node1 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@node1 ~]#
Step 5:network check out and setting
ifconfig -a
ip addr
[root@node1 ~]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.8.111 netmask 255.255.255.0 broadcast 192.168.8.255
inet6 fe80::e1f2:64b0:514a:353e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:38:85:6b txqueuelen 1000 (Ethernet)
RX packets 2119214 bytes 3016503510 (2.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 184342 bytes 27860604 (26.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens34: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.100.111 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::d4c3:9dc3:cf4b:effb prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:38:85:75 txqueuelen 1000 (Ethernet)
RX packets 29 bytes 4433 (4.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34 bytes 4555 (4.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 34 bytes 2690 (2.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 34 bytes 2690 (2.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:52:aa:7a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:52:aa:7a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[root@node1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:38:85:6b brd ff:ff:ff:ff:ff:ff
inet 192.168.8.111/24 brd 192.168.8.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::e1f2:64b0:514a:353e/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:38:85:75 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.111/24 brd 192.168.100.255 scope global noprefixroute ens34
valid_lft forever preferred_lft forever
inet6 fe80::d4c3:9dc3:cf4b:effb/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:52:aa:7a brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:52:aa:7a brd ff:ff:ff:ff:ff:ff
[root@node1 ~]#
Step 6: Check out NetworkManager服务
# setting automatically:
systemctl disable NetworkManager
systemctl enable network
# start/stop service:
service NetworkManager stop
# or
systemctl start NetworkManager
service network start
# or
systemctl start network
Step 7: under the folder /etc/sysconfig/network-scripts, add the below parameter in ifcfg-ens33 and ifcfg-ens34
HOTPLUG="no"
两台机配好IP并重启网络服务后,将自动绑定划分的两块网卡。
[root@node1 network-scripts]#
[root@node1 network-scripts]# systemctl restart network
[root@node1 network-scripts]#
[root@node2 network-scripts]#
[root@node2 network-scripts]# systemctl restart network
[root@node2 network-scripts]#
Step 8: close the firewalld.
use the root execute below command on node1 and node2
systemctl status firewalld ##first check out if firewalld be closed
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
[root@node1 network-scripts]#
[root@node1 network-scripts]# 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)
[root@node1 network-scripts]#
[root@node2 network-scripts]#
[root@node2 network-scripts]# systemctl restart network
[root@node2 network-scripts]# 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)
[root@node2 network-scripts]#
Step 9 Close the SELinux
use the root to execute below command.
getenforce ##check out if display “Disabled”,if not ,please execute below command
sed -i 's/=enforcing/=disabled/' /etc/selinux/config
[root@node1 ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@node1 ~]# sed -i 's/=enforcing/=disabled/' /etc/selinux/config
[root@node1 ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@node1 ~]#
[root@node2 ~]#
[root@node2 ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@node2 ~]# sed -i 's/=enforcing/=disabled/' /etc/selinux/config
[root@node2 ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@node2 ~]#
Step 10 : forbidden Transparent HugePages(THP)
use the root to modify file /etc/default/grub
[root@node1 ~]#
[root@node1 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@node1 ~]#
# this display be forbidden
[root@node2 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@node2 ~]#
[root@node1 ~]#
[root@node1 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@node1 ~]# vim /etc/default/grub[root@node1 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
[root@node1 ~]#
[root@node1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.76.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.76.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-ef1ade0242c746108e6148d618c791b5
Found initrd image: /boot/initramfs-0-rescue-ef1ade0242c746108e6148d618c791b5.img
done
[root@node1 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never][root@node1 ~]#
[root@node2 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@node2 ~]#
[root@node2 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@node2 ~]# vim /etc/default/grub
[root@node2 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
[root@node2 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.76.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.76.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-cecdacd679114fb488322bed2dc06a53
Found initrd image: /boot/initramfs-0-rescue-cecdacd679114fb488322bed2dc06a53.img
done
[root@node2 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@node2 ~]#
Step 11 setting NOZEROCONF
[root@node1 ~]# cat /etc/sysconfig/network
# Created by anaconda
NOZEROCONF=yes
[root@node1 ~]#
[root@node2 ~]#
[root@node2 ~]# cat /etc/sysconfig/network
# Created by anaconda
NOZEROCONF=yes
[root@node2 ~]#
Step 12 : setting hosts
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# Public
192.168.8.111 node1 node1.racdb.local
192.168.8.112 node2 node2.racdb.local
# Private
192.168.100.111 node1-priv node1-priv.racdb.local
192.168.100.112 node2-priv node2-priv.racdb.local
# Virtual
192.168.8.113 node1-vip node1-vip.racdb.local
192.168.8.114 node2-vip node2-vip.racdb.local
# SCAN
192.168.8.115 node-cluster-scan node-cluster-scan.racdb.local
192.168.8.116 node-cluster-scan node-cluster-scan.racdb.local
192.168.8.117 node-cluster-scan node-cluster-scan.racdb.local
[root@node1 ~]#
Step 13 : Create user and user group
user the root to execute as below command:
groupadd -g 1000 oinstall
groupadd -g 1100 dba
groupadd -g 1200 oper
groupadd -g 1300 asmadmin
groupadd -g 1400 asmdba
groupadd -g 1500 asmoper
useradd -u 1001 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -m grid
useradd -u 1000 -g oinstall -G dba,asmdba,oper -d /home/oracle -m oracle
passwd oracle
passwd grid
setting passord unlimitted
chage -M -1 oracle
chage -M -1 grid
chage -l oracle
chage -l grid
[root@node1 ~]# chage -M -1 oracle
[root@node1 ~]# chage -M -1 grid
[root@node1 ~]# chage -l oracle
Last password change : Nov 08, 2022
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : -1
Number of days of warning before password expires : 7
[root@node1 ~]# chage -l grid
Last password change : Nov 08, 2022
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : -1
Number of days of warning before password expires : 7
[root@node1 ~]#
[root@node1 ~]#[root@node2 ~]# chage -M -1 oracle
[root@node2 ~]# chage -M -1 grid
[root@node2 ~]# chage -l oracle
Last password change : Nov 08, 2022
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : -1
Number of days of warning before password expires : 7
[root@node2 ~]# chage -l grid
Last password change : Nov 08, 2022
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : -1
Number of days of warning before password expires : 7
[root@node2 ~]#
Step 14: check user and user group
[root@node1 ~]#
[root@node1 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54327(asmdba),54330(racdba)
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# id grid
uid=54331(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54327(asmdba),54328(asmoper),54329(asmadmin),54330(racdba)
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]#
[root@node2 ~]#
[root@node2 ~]#
[root@node2 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54327(asmdba),54330(racdba)
[root@node2 ~]#
[root@node2 ~]#
[root@node2 ~]#
[root@node2 ~]# id grid
uid=54331(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54327(asmdba),54328(asmoper),54329(asmadmin),54330(racdba)
[root@node2 ~]#
[root@node2 ~]#
Step 15: make the installation directory
use the root execute below command on node1 and node2.
mkdir -p /oracle/app/oracle
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/19.3.0/grid
mkdir -p /oracle/app/oracle/product/ 19.3.0/dbhome_1
chown -R grid:oinstall /oracle/app/grid
chown -R grid:oinstall /oracle/app/ 19.3.0
chown -R oracle:oinstall /oracle/app/oracle
chmod -R 775 /oracle
mkdir -p /oracle/app/oraInventory
chown -R grid:oinstall /oracle/app/oraInventory
chmod -R 775 /oracle/app/oraInventory
Step16: Setting the user oracle and grid's parameter
grid user :
export ORACLE_BASE=/oracle/app/grid
export ORACLE_HOME=/oracle/app/19.3.0/grid
export ORACLE_SID=+ASM1
export PATH=/oracle/app/19.3.0/grid/bin:/oracle/app/19.3.0/grid/OPatch:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:.
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
export LD_LIBRARY_PATH=/oracle/app/19.3.0/grid/lib:/usr/lib
export LANG=en_US
umask 022
oracle user:
export ORACLE_SID=racdb1 ##node 2 should modify to racdb2
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$ORACLE_HOME/bin:ORACLE_HOME/OPatch:$PATH
export NLS_LANG="AMERICAN_CHINA.ZHS16GBK"
umask 022
export ORACLE_HOME=/oracle/app/19.3.0/grid
export PATH=$PATH:$ORACLE_HOME/bin
Step 17 install rpm package
yum install -y compat*
yum install -y compat-libcap*
yum install -y gcc*
yum install -y gcc-c++*
yum install -y glibc-devel*
yum install -y ksh*
yum install -y libstdc++-devel*
yum install -y libaio-devel*
Step 18: Core parameter setting
# 配置以下内核参数
cat >/etc/sysctl.d/97-oracledatabase-sysctl.conf<<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF
# 使配置生效
sysctl --system
Step 19 : close other services:
systemctl stop avahi-dnsconfd
systemctl stop avahi-daemon
systemctl stop cups
systemctl stop postfix
systemctl stop smartd
systemctl disable avahi-dnsconfd
systemctl disable avahi-daemon
systemctl disable cups
systemctl disable postfix
systemctl disable smartd
[root@node1 ~]# systemctl stop avahi-dnsconfd
systemctl stop avahi-daemon
Failed to stop avahi-dnsconfd.service: Unit avahi-dnsconfd.service not loaded.
[root@node1 ~]#
[root@node1 ~]# systemctl stop avahi-daemonsystemctl stop cups
systemctl stop postfix
Warning: Stopping avahi-daemon.service, but it can still be activated by:
avahi-daemon.socket
[root@node1 ~]#
[root@node1 ~]# systemctl stop cups
systemctl stop smartdsystemctl disable avahi-dnsconfd
Warning: Stopping cups.service, but it can still be activated by:
cups.socket
cups.path
[root@node1 ~]#
[root@node1 ~]# systemctl stop postfix
systemctl disable avahi-daemonsystemctl disable cups
systemctl disable postfix
[root@node1 ~]#
[root@node1 ~]# systemctl stop smartd
systemctl disable smartd[root@node1 ~]#
[root@node1 ~]# systemctl disable avahi-dnsconfd
Failed to execute operation: No such file or directory
[root@node1 ~]#
[root@node1 ~]# systemctl disable avahi-daemon
Removed symlink /etc/systemd/system/multi-user.target.wants/avahi-daemon.service.
Removed symlink /etc/systemd/system/sockets.target.wants/avahi-daemon.socket.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.Avahi.service.
[root@node1 ~]#
[root@node1 ~]# systemctl disable cups
Removed symlink /etc/systemd/system/multi-user.target.wants/cups.path.
Removed symlink /etc/systemd/system/multi-user.target.wants/cups.service.
Removed symlink /etc/systemd/system/sockets.target.wants/cups.socket.
Removed symlink /etc/systemd/system/printer.target.wants/cups.service.
[root@node1 ~]#
[root@node1 ~]# systemctl disable postfix
Removed symlink /etc/systemd/system/multi-user.target.wants/postfix.service.
[root@node1 ~]#
[root@node1 ~]# systemctl disable smartd
Removed symlink /etc/systemd/system/multi-user.target.wants/smartd.service.
[root@node1 ~]#
[root@node1 ~]#
Step 20: setting NTP service
在Linux7上,先用root禁用默认的chronyd服务,再下载安装NTP服务
# systemctl stop chronyd
# systemctl disable chronyd
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# systemctl stop chronyd
[root@node1 ~]# systemctl disable chronyd
Removed symlink /etc/systemd/system/multi-user.target.wants/chronyd.service.
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# yum install ntp
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-29.el7.centos.2 will be installed
--> Processing Dependency: ntpdate = 4.2.6p5-29.el7.centos.2 for package: ntp-4.2.6p5-29.el7.centos.2.x86_64
--> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-29.el7.centos.2.x86_64
--> Running transaction check
---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed
---> Package ntpdate.x86_64 0:4.2.6p5-28.el7.centos will be updated
---> Package ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================================================================================
Installing:
ntp x86_64 4.2.6p5-29.el7.centos.2 base 549 k
Installing for dependencies:
autogen-libopts x86_64 5.18-5.el7 base 66 k
Updating for dependencies:
ntpdate x86_64 4.2.6p5-29.el7.centos.2 base 87 k
Transaction Summary
=========================================================================================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Upgrade ( 1 Dependent package)
Total size: 701 k
Total download size: 615 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm | 549 kB 00:00:00
(2/2): autogen-libopts-5.18-5.el7.x86_64.rpm | 66 kB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 615 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 1/4
Installing : autogen-libopts-5.18-5.el7.x86_64 2/4
Installing : ntp-4.2.6p5-29.el7.centos.2.x86_64 3/4
Cleanup : ntpdate-4.2.6p5-28.el7.centos.x86_64 4/4
Verifying : autogen-libopts-5.18-5.el7.x86_64 1/4
Verifying : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 2/4
Verifying : ntp-4.2.6p5-29.el7.centos.2.x86_64 3/4
Verifying : ntpdate-4.2.6p5-28.el7.centos.x86_64 4/4
Installed:
ntp.x86_64 0:4.2.6p5-29.el7.centos.2
Dependency Installed:
autogen-libopts.x86_64 0:5.18-5.el7
Dependency Updated:
ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2
Complete!
[root@node1 ~]#
[root@node1 ~]# systemctl enable ntpd
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
[root@node1 ~]# systemctl start ntpd
[root@node1 ~]#
[root@node1 ~]# vi /etc/sysconfig/ntpd
[root@node1 ~]# systemctl restart ntpd.service
[root@node1 ~]# vi /etc/ntp.conf
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# vi /etc/ntp.conf
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# systemctl stop ntpd
[root@node1 ~]#
[root@node1 ~]# systemctl start ntpd.service
[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# hwclock --systohc
[root@node1 ~]#
[root@node1 ~]# hwclock;date
Tue 08 Nov 2022 06:35:13 PM CST -0.990247 seconds
Tue Nov 8 18:35:12 CST 2022
[root@node1 ~]#
[root@node1 ~]#
选择chronyd同步时间:因此需要使之生效:
[root@node1 ~]#
[root@node1 ~]# systemctl enable --now chronyd
Created symlink from /etc/systemd/system/multi-user.target.wants/chronyd.service to /usr/lib/systemd/system/chronyd.service.
[root@node1 ~]# systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-11-08 18:39:08 CST; 37s ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Process: 13726 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
Process: 13722 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 13724 (chronyd)
Tasks: 1
CGroup: /system.slice/chronyd.service
└─13724 /usr/sbin/chronyd
Nov 08 18:39:07 node1 systemd[1]: Starting NTP client/server...
Nov 08 18:39:08 node1 chronyd[13724]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
Nov 08 18:39:08 node1 chronyd[13724]: Frequency 0.389 +/- 1.517 ppm read from /var/lib/chrony/drift
Nov 08 18:39:08 node1 systemd[1]: Started NTP client/server.
Nov 08 18:39:14 node1 chronyd[13724]: Selected source 119.28.206.193
Nov 08 18:39:16 node1 chronyd[13724]: Source 108.59.2.24 replaced with 111.230.189.174
[root@node1 ~]#