Day01 作业 初始化环境实现-安装包和依赖 登录后复制 系统:rocky8 机器数量:5 ip地址:192.168.0.11 192.168.0.12 192.168.0.13 192.168.0.14 192.168.0.15 jichao11 jichao12 jichao13 jichao14 jichao15 内存:7G 6核 1.2.3.4.5. 登录后复制 安装对应的包和依赖 yum install -y conntrack ipvsadm ipset jq iptables curl sysstat libseccomp wget vim net-tools git yum -y install wget jq psmisc vim net-tools nfs-utils socat telnet device-mapper-persistent-data lvm2 git network-scripts tar curl -y yum -y install lrzsz git subversion gpm unzip zip curl wget net-tools vim gcc yum -y install wget jq psmisc vim net-tools nfs-utils telnet yum-tuils device-mapper-persistent-data lvm2 git tar curl -y yum -y install conntrack socat ipset ipvsadm ebtables 1.2.3.4.5.6.7.8. 登录后复制 # 关闭selinux vim /etc/selinux/config 1.2. 登录后复制 # 关闭防火墙 service firewalld stop systemctl disable firewalld.service 1.2.3. 时间同步操作、更改系统句柄 登录后复制 # 时间同步 yum -y install chrony vim /etc/chrony.conf 1.2.3. 登录后复制 # 查看时间是否同步 1. 登录后复制 # 更改系统句柄数 ulimit -SHn 65535 cat>>/etc/security/limits.conf<<EOF * soft nofile 655360 * hard nofile 131072 * soft nproc 655350 * hard nproc 655350 * seft memlock unlimited * hard memlock unlimitedd EOF 1.2.3.4.5.6.7.8.9.10. 登录后复制 vim /etc/hosts 1. 登录后复制 vim /etc/sysconfig/network-scripts/ifcfg-ens160 1. 阿里云镜像站点-rockylinux和epel 登录后复制 sed -e 's|^mirrorlist=|#mirrorlist=|g' \ -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \ -i.bak \ /etc/yum.repos.d/Rocky-*.repo yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel* sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel* 1.2.3.4.5.6.7.8.9. 登录后复制 vim /etc/default/grub # 实现最大使用 --numa=off 1.2. 系统内核升级-6.9 更改剩余四台主机ip和hostname 登录后复制 更改ip地址和主机名 用15举例 1. ssh免密登录 登录后复制 # ssh五台机器免密登录 - 脚本 fgssh # 注意给执行权限 x 1.2. ansible同步执行命令 登录后复制 # ansible实现同步执行任务 vim /etc/ansible/hosts [allserver] jichao11 jichao12 jichao13 jichao14 jichao15 ansible allserver -m command -a "chmod 600 /root/.ssh/config" 1.2.3.4.5.6.7.8.9. 原创作者: u_16873273 转载于: https://blog.51cto.com/u_16873273/11277043