@linux虚拟机系统优化

一. 安装全新Centos7系统,配置网卡为eth0及eth1命名模式 100

   1.第一块网卡为NAT模式[公网环境],配置的网段为192.168.0.100网段
   2.第二块网卡为LAN模式[私网环境],配置的网段为192.168.10.100网段
   3.优化安装好的Centos7虚拟机,安装常用软件、关闭防火墙等等

二. 优化方法及步骤

  #1.配置yum仓库

rm -f /etc/yum.repos.d/*
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo


#2.安装常用的软件包
   yum install net-tools vim tree htop iftop gcc gcc-c++ glibc\
iotop lrzsz sl wget unzip telnet nmap nc psmisc \
dos2unix bash-completion bash-completion-extra sysstat \
rsync nfs-utils httpd-tools -y

#3. 对防火墙进行优化关闭firewalld
   systemctl stop firewalld
   systemctl disable  firewalld
   

#4.关闭selinux
    sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config



#5.调整单个进程最大能打开文件的数量
     echo '* - nofile 65535' >> /etc/security/limits.conf 

三.对优化完成的虚拟机进行克隆

  1.连接克隆(需要依赖于母体,和母体虚拟机文件相互关联)
  2.完整克隆(完全的自己复制一份,是需要占用磁盘空间的)

四.克隆完成的新虚拟机进行基础修改

  1.修改主机名 
      hostnamectl set-hostname backup
  2.修改IP地址  
      sed -i 's/100/31/g' /etc/sysconfig/network-scripts/ifcfg-eth[01]
  3.重启服务器(网卡)
      systemctl restart network

五. 启用xshell进行远程连接,测试服务是否启用成功

#格式:ssh  user@ip地址
  ssh root@192.168.0.100
posted @ 2021-03-29 00:53  ଲ一笑奈&何  阅读(34)  评论(0编辑  收藏  举报