centos7 最小安装初始化

配置阿里yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup \
&&curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
安装经常使用命令
yum install -y vim lrzsz unzip wget telnet net-tools bash-completion
关闭防火墙

关闭防火墙linux

systemctl stop firewalld && systemctl disable firewalld

关闭selinux,SELINUX修改成disabledios

vim /etc/selinux/config

配置网络

修改网卡名称格式为ethXvim

mv ifcfg-ensxxx ifcfg-eth0

编辑网卡配置文件,保留以下配置便可bash

vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
PERSISTENT_DHCLIENT=1
MTU=1492
DNS1=114.114.114.114
DNS2=8.8.8.8

修改内核参数,经过编辑/etc/default/grub并加入“net.ifnames=0 biosdevname=0 ”到GRUBCMDLINELinux变量来实现网络

vim /etc/default/grub
net.ifnames=0 biosdevname=0

运行命令来从新生成GRUB配置并更新内核参数ssh

grub2-mkconfig -o /boot/grub2/grub.cfg

重启系统curl

关闭DNS查找
vim /etc/ssh/sshd_config

GSSAPIAuthentication no  #GSSAPIAuthentication yes行,去掉#,修改yes为nopost

UseDNS no  #UseDNS yes行,去掉#,修改yes为no优化

安装密码重置脚本
cd \
&&unzip Agent.zip \
&&cd /root/CloudResetPwdUpdateAgent.Linux/ \
&&/bin/bash setup.sh \
&&cd&&rm –rf Agent.zip CloudResetPwd*
优化服务

关闭网卡图形化配置服务url

systemctl stop NetworkManager && systemctl disable NetworkManager

关闭默认邮件服务

systemctl stop postfix && systemctl disable postfix
清除hostname 清除hostname,以便根据Cloudstack配置的名称命名,编辑network文件
vim /etc/sysconfig/network

仅保留NETWORKING=yes

清除历史使用记录
rm -rf /var/log/btmp \
&&rm -rf /var/log/wtmp \
&&rm -rf /var/log/messages \
&&rm -rf /root/.bash_history \
&&history -c
相关文章
相关标签/搜索