1    CentOS8部署
 1.1    系统安装
 图略...... 
 安装耗时约2小时。
 1.2    系统配置
 1.2.1    关闭SELINUX
 vi /etc/sysconfig/selinux
 SELINUX=disabled
 1.2.2    基本网络配置
 1、通过网卡配置文件配置
 vi /etc/sysconfig/network-scripts/ifcfg-ens33
 TYPE=Ethernet
 PROXY_METHOD=none
 BROWSER_ONLY=no
 BOOTPROTO=dhcp
 DEFROUTE=yes
 IPV4_FAILURE_FATAL=no
 IPV6INIT=yes
 IPV6_AUTOCONF=yes
 IPV6_DEFROUTE=yes
 IPV6_FAILURE_FATAL=no
 IPV6_ADDR_GEN_MODE=stable-privacy
 NAME=ens33
 UUID=cc8d4dff-ccc5-45d9-ad44-f610800ebd53
 DEVICE=ens33
 ONBOOT=no
 BOOTPROTO="static"
 BROADCAST="192.168.100.255"
 IPADDR="192.168.100.201"
 NETMASK="255.255.255.0"
 ONBOOT="yes"
 2、修改计算机名
 vi /etc/sysconfig/network
 NETWORKING=yes
 NETWORKING_IPV6=no
 HOSTNAME=boco201
 GATEWAY=192.168.100.2
 3、配置DNS
 vi /etc/resolv.conf
 nameserver 223.5.5.5
 nameserver 223.6.6.6
 4、查看主机名
 hostnamectl ,查看一下当前主机名的情况,查看全部三种主机名
 hostnamectl status,或者,查看全部三种主机名
 hostnamectl --static,只查看静态
 hostnamectl --transient,只查看瞬态
 hostnamectl-pretty,只查看灵活主机名
 hostname,查看到的是瞬态的(Tansient hostname)
 cat /etc/hostname,查看到的是静态的(Static hostname)
 5、配置完成后重新启动网络服务
 service network restart
 或systemctl restart network
 或systemctl restart NetworkManager(centos8)
 如有报错先关闭:service NetworkManager stop
 service NetworkManager start //启动
 service NetworkManager stop //关闭
 service NetworkManager status //查看状态
 chkconfig NetworkManager off //禁止开机启动
 chkconfig NetworkManager on //开机启动
 1.2.3    常用配置文件
 /etc/host.conf,配置域名服务客户端的控制文件
 /etc/hosts,完成主机名映射为IP地址的功能
 /etc/resolv.conf,域名服务客户端的配置文件,域名服务器的位置
 /etc/sysconfig/network,包含了主机最基本的网络信息,用于系统启动
 /etc/sysconfig/network-script/,系统启动时初始化网络的一些信息
 /etc/xinetd.conf,定义了由超级进程xinetd启动的网络服务
 /etc/networks,完成域名与网络地址的映射
 /etc/protocols,设定了主机使用的协议以及各个协议的协议号
 /etc/services,设定主机的不同端口的网络服务
 1.2.4    yum源配置
 yum install ……
 1、备份CentOS-Base.repo
 2、修改CentOS-Base.repo
 [base]
 name=CentOS-$releasever - Base
 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 #released updates
 [updates]
 name=CentOS-$releasever - Updates
 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 #additional packages that may be useful
 [extras]
 name=CentOS-$releasever - Extras
 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 #additional packages that extend functionality of existing packages
 [centosplus]
 name=CentOS-$releasever - Plus
 baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
 gpgcheck=1
 enabled=0
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 3、yum clean all     # 清除系统所有的yum缓存
 4、yum makecache     # 生成yum缓存
 5、步骤2,也可直接下载一个CentOS-Base.repo来替换本地文件
 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
 1.2.5    ssh免密码登录
 1、boco201
 vi /etc/ssh/sshd_config
 PermitRootLogin yes
 RSAAuthentication yes
 PubkeyAuthentication yes
 重启服务systemctl restart sshd.service
 客户机生成公钥和私钥ssh-keygen -t rsa
 Generating public/private rsa key pair.
 Enter file in which to save the key (/root/.ssh/id_rsa): 
 Enter passphrase (empty for no passphrase): 
 Enter same passphrase again: 
 Your identification has been saved in /root/.ssh/id_rsa.
 Your public key has been saved in /root/.ssh/id_rsa.pub.
 The key fingerprint is:
 SHA256:eg06wqkxUjmAhcQAU5B8N9Ukk1UFv/5r0ryTnzzjBxQ root@boco201
 The key's randomart image is:
 +---[RSA 3072]----+
 |@*o   .+=o.oo.   |
 |+= . o .o.  . E  |
 |o . . .      . . |
 | . .          o  |
 |  +     S    o   |
 | . o . o o  . .  |
 |. o + + . .  .o..|
 | . + . o     .oOo|
 |  .           +BX|
 +----[SHA256]-----+
 ssh-copy-id -i /root/.ssh/id_rsa.pub root@boco202
 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
 /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
 /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
 root@boco202's password: 
 Number of key(s) added: 1
 Now try logging into the machine, with:   "ssh 'root@boco202'"
 and check to make sure that only the key(s) you wanted were added.
 ssh-copy-id -i /root/.ssh/id_rsa.pub root@boco203
 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
 /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
 /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
 root@boco203's password: 
 Number of key(s) added: 1
 Now try logging into the machine, with:   "ssh 'root@boco203'"
 and check to make sure that only the key(s) you wanted were added.
 2、boco202
 如步骤1同样操作
 3、boco203
 如步骤1同样操作
 1.2.6    root自动登录
 vi /etc/gdm/custom.conf,末尾增加:
  [daemon]
 AutomaticLoginEnable=true
 AutomaticLogin=root
 1.3    卸载自带JDK
 yum list | grep java
 yum remove java-1.8.0-openjdk.x86_64
 1.4    JDK安装
 1、下载
 wget https://download.oracle.com/otn/java/jdk/8u271-b09/61ae65e088624f5aaa0b1d2d801acb16/jdk-8u271-linux-x64.tar.gz?AuthParam=1607400230_1abc999c23658e05ad9dc572788394bc
 2、解压缩包
 tar -zxvf jdk-8u271-linux-x64.tar.gz -C /usr/java
 3、设置环境
 vi /etc/profile
 export JAVA_HOME=/usr/java/jdk1.8.0_271
 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
 export PATH=$PATH:$JAVA_HOME/bin
 1.5    OpenJDK安装
 不建议安装这个包
 yum search java | grep jdk
 java-11-openjdk.x86_64 : OpenJDK Runtime Environment 11
 java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment 8
 java-11-openjdk-src.x86_64 : OpenJDK Source Bundle 11
 java-11-openjdk-demo.x86_64 : OpenJDK Demos 11
 java-11-openjdk-devel.x86_64 : OpenJDK Development Environment 11
 java-11-openjdk-jmods.x86_64 : JMods for OpenJDK 11
 java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle 8
 java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos 8
 java-11-openjdk-javadoc.x86_64 : OpenJDK 11 API documentation
 java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment 8
 java-11-openjdk-headless.x86_64 : OpenJDK Headless Runtime Environment 11
 java-1.8.0-openjdk-javadoc.noarch : OpenJDK 8 API documentation
 java-1.8.0-openjdk-headless.x86_64 : OpenJDK Headless Runtime Environment 8
 java-11-openjdk-javadoc-zip.x86_64 : OpenJDK 11 API documentation compressed in single archive
 java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK 8 API documentation compressed in single archive
 java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK 8 accessibility connector
 yum install java-1.8.0-openjdk.x86_64
 Repository AppStream is listed more than once in the configuration
 Repository extras is listed more than once in the configuration
 Repository PowerTools is listed more than once in the configuration
 Repository centosplus is listed more than once in the configuration
 上次元数据过期检查:0:58:44 前,执行于 2020年12月04日 星期五 01时15分03秒。
 依赖关系解决。
 ====================================================================================================================================
  软件包                                 架构              版本                                           仓库                  大小
 ====================================================================================================================================
 安装:
  java-1.8.0-openjdk                     x86_64            1:1.8.0.272.b10-1.el8_2                        AppStream            326 k
 安装依赖关系:
 copy-jdk-configs                       noarch            3.7-1.el8                                      AppStream             27 k
 java-1.8.0-openjdk-headless            x86_64            1:1.8.0.272.b10-1.el8_2                        AppStream             34 M
 javapackages-filesystem                noarch            5.3.0-1.module_el8.0.0+11+5b8c10bd             AppStream             30 k
 lksctp-tools                           x86_64            1.0.18-3.el8                                   base                 100 k
 ttmkfdir                               x86_64            3.0.9-54.el8                                   AppStream             62 k
 tzdata-java                            noarch            2020d-1.el8                                    AppStream            190 k
 xorg-x11-fonts-Type1                   noarch            7.5-19.el8                                     AppStream            522 k
 启用模块流:
 javapackages-runtime                                     201801                                                                   
 事务概要
 ====================================================================================================================================
 安装  8 软件包
 总下载:35 M
 安装大小:119 M
 确定吗?[y/N]: y
 下载软件包:
 (1/8): copy-jdk-configs-3.7-1.el8.noarch.rpm                                                        101 kB/s |  27 kB     00:00    
 (2/8): javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch.rpm                        236 kB/s |  30 kB     00:00    
 (3/8): ttmkfdir-3.0.9-54.el8.x86_64.rpm                                                             546 kB/s |  62 kB     00:00    
 (4/8): java-1.8.0-openjdk-1.8.0.272.b10-1.el8_2.x86_64.rpm                                          514 kB/s | 326 kB     00:00    
 (5/8): tzdata-java-2020d-1.el8.noarch.rpm                                                           661 kB/s | 190 kB     00:00    
 (6/8): lksctp-tools-1.0.18-3.el8.x86_64.rpm                                                         251 kB/s | 100 kB     00:00    
 (7/8): xorg-x11-fonts-Type1-7.5-19.el8.noarch.rpm                                                   789 kB/s | 522 kB     00:00    
 (8/8): java-1.8.0-openjdk-headless-1.8.0.272.b10-1.el8_2.x86_64.rpm                                 2.4 MB/s |  34 MB     00:13    
 ------------------------------------------------------------------------------------------------------------------------------------
 总计                                                                                                2.1 MB/s |  35 MB     00:16     
 警告:/var/cache/dnf/AppStream-a520ed22b0a8a736/packages/copy-jdk-configs-3.7-1.el8.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
 CentOS-8 - AppStream                                                                                309 kB/s | 1.6 kB     00:00    
 导入 GPG 公钥 0x8483C65D:
 Userid: "CentOS (CentOS Official Signing Key) <security@centos.org>"
 指纹: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
 来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
 确定吗?[y/N]: y
 导入公钥成功
 运行事务检查
 事务检查成功。
 运行事务测试
 事务测试成功。
 运行事务
 运行脚本: copy-jdk-configs-3.7-1.el8.noarch 1/1 
 运行脚本: java-1.8.0-openjdk-headless-1:1.8.0.272.b10-1.el8_2.x86_64 1/1 
 准备中  : 1/1 
 安装    : lksctp-tools-1.0.18-3.el8.x86_64 1/8 
 运行脚本: lksctp-tools-1.0.18-3.el8.x86_64 1/8 
 安装    : tzdata-java-2020d-1.el8.noarch 2/8 
 安装    : ttmkfdir-3.0.9-54.el8.x86_64 3/8 
 安装    : xorg-x11-fonts-Type1-7.5-19.el8.noarch 4/8 
 运行脚本: xorg-x11-fonts-Type1-7.5-19.el8.noarch 4/8 
 安装    : javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch 5/8 
 安装    : copy-jdk-configs-3.7-1.el8.noarch 6/8 
 安装    : java-1.8.0-openjdk-headless-1:1.8.0.272.b10-1.el8_2.x86_64 7/8 
 运行脚本: java-1.8.0-openjdk-headless-1:1.8.0.272.b10-1.el8_2.x86_64 7/8 
 安装    : java-1.8.0-openjdk-1:1.8.0.272.b10-1.el8_2.x86_64 8/8 
 运行脚本: java-1.8.0-openjdk-1:1.8.0.272.b10-1.el8_2.x86_64 8/8 
 运行脚本: copy-jdk-configs-3.7-1.el8.noarch 8/8 
 运行脚本: java-1.8.0-openjdk-1:1.8.0.272.b10-1.el8_2.x86_64 8/8 
 验证:copy-jdk-configs-3.7-1.el8.noarch 1/8 
 验证:java-1.8.0-openjdk-1:1.8.0.272.b10-1.el8_2.x86_64 2/8 
 验证:java-1.8.0-openjdk-headless-1:1.8.0.272.b10-1.el8_2.x86_64 3/8 
 验证:javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch 4/8 
 验证:ttmkfdir-3.0.9-54.el8.x86_64 5/8 
 验证:tzdata-java-2020d-1.el8.noarch 6/8 
 验证: xorg-x11-fonts-Type1-7.5-19.el8.noarch 7/8 
 验证: lksctp-tools-1.0.18-3.el8.x86_64 8/8 
 Installed products updated.
 已安装:
 copy-jdk-configs-3.7-1.el8.noarch                             java-1.8.0-openjdk-1:1.8.0.272.b10-1.el8_2.x86_64                   
 java-1.8.0-openjdk-headless-1:1.8.0.272.b10-1.el8_2.x86_64    javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch   
 lksctp-tools-1.0.18-3.el8.x86_64                              ttmkfdir-3.0.9-54.el8.x86_64                                        
 tzdata-java-2020d-1.el8.noarch                                xorg-x11-fonts-Type1-7.5-19.el8.noarch                              
 完毕!