zoukankan      html  css  js  c++  java
  • 虚拟机centos7 基础模板制作

     用于新模板制作,主要针对一些基本组件的安装

    分区、安装不在此赘述

    最小化安装centos7-minimal-1810

    1.安装wget

    yum install wget -y

    2.更换aliyun源

    cd /etc/yum.repos.d
    rm * -f
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    yum clean all
    yum makecache

    3.安装基本组件

    yum install vim epel-release bash-completion ntp net-tools dstat traceroute chrony iptables iptables-services -y
    # chrony 时间同步
    # bash-completion 参数补全
    yum install gcc gcc-c++ make cmake curl rsync gd zip perl unzip autoconf automake libtool openssl-devel pcre zlib pcre-devel tcl automake ntpdate sysstat man mtr lsof iotop iostat openssl openssl-devel lrzsz nscd tmux tcpdump iftop tree openssh-clients -y

    4.时区,时间同步

    timedatectl set-timezone Asia/Shanghai
    date -R
    ntpdate cn.ntp.org.cn
    systemctl is-enabled chronyd #确认服务是否自启
    systemctl is-active chronyd #确认服务是否存在
    vim /etc/chrony.conf
    server1 cn.ntp.org.cn iburst # 配置ntp服务器
    local stratum 10 # 自动同步间隔
    systemctl restart chronyd
    chronyc sources -v #验证时间,不报error,然后下面有时间就可以

    5.安装vmtools

    #虚拟机肯定要装vmtools,在vmware workstation或esxi或vcenter界面,右击该主机,安装vmtools,注:一定要有光驱
    mount /dev/cdrom /mnt #不能挂载的话重启
    tar -zxvf /mnt/VMwareTools-10.2.5-8068393.tar.gz -C /tmp # vmtools的安装包版本不同的话,名字自己修改
    cd /tmp/vmware-tools-distrib
    chmod +x vmware-install.pl
    ./vmware-install.pl force-install default # 强制默认安装

    6.iptables、selinux关闭

    # iptables
    iptables -F
    service iptables save
    systemctl disable firewalld
    systemctl disable iptables
    
    # selinux
    setenforce 0
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
    
    # ssh dns问题
    sed -i 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config
    sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
    systemctl restart sshd

    7.修改网卡名称为eth0

    vim /etc/default/grub 
    在GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"后面添加net.ifnames=0 biosdevname=0 #加到引号里
    使用grub2-mkconfig -o /boot/grub2/grub.cfg重新生成grub配置
    修改网卡配置,以ifcfg-ens32为例
    vim /etc/sysconfig/network-scripts/ifcfg-ens32
     --> DEVICE=eth0
     --> NAME=eth0
    reboot重启生效

    8.yum update

    9.待补充(CPU、内存热添加开启,新增硬盘自动识别)

    有不全,有误的,望指正,谢谢。

    PS:想到再改

  • 相关阅读:
    Kattis
    HackerRank
    HackerRank
    牛客小白月赛1 C 分元宵【快速幂】
    牛客小白月赛1 J おみやげをまらいました 【MAP】
    logback与Spring、SpringMVC结合使用教程
    解决maven项目pom报错
    sz与rz命令
    cassandra 测试数据库
    ubuntu 无法解析主机的解决方法
  • 原文地址:https://www.cnblogs.com/xddsq/p/10574609.html
Copyright © 2011-2022 走看看