centos安装初始化
#修改初始化信息
echo 'douya@123' | passwd --stdin root
#关闭防火墙和安全子系统selinux
systemctl stop firewalld && systemctl disable firewalld
sed -i "/^SELINUX=/c SELINUX=disabled" /etc/selinux/config
setenforce 0
getenforce
#网络类
dhclient -r 释放IP
dhclient
//网卡初始化--删除物理、删除UUID、修改IP
https://www.cnblogs.com/wutao666/p/9480107.html
yum install NetworkManager-tui -y
nmtui
//修改网卡名字eh0
//在安装的时候按TAB
两个空格
net.ifname==0 biosdevname=0
//已安装
cp /etc/sysconfig/network-scripts/ifcfg-{enp0s3,eth0}
vi /etc/default/grub
GRUB_CMDLINE_LINUX 新增net.ifnames=0 biosdevname=0"
grub2-mkconfig -o /boot/grub2/grub.cfg //重新生成GRUB配置并更新内核参数
//修改网卡IP
grep 'IPADDR' /etc/sysconfig/network-scripts/ifcfg-eth[01]
sed -i 's#原IP#新IP#g' /etc/sysconfig/network-scripts/ifcfg-eth[01]
hostname set-hostname xxx
systemctl restart network
#centos 7 添加阿里云镜像
mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
mv /etc/yum.repos.d/epel.repo{,.bak}
#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/epel-7.repo
//清华园
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo
yum clean all
yum makecache
#yum -y update
yum repolist //#检查可用yum源信息
#安装必要软件
yum -y install epel-release \
lrzsz tree psmisc dump tree nmap dos2unix nc lsof wget\
tcpdump htop iftop iotop sysstat nethogs xinetd telnet-server telnet ntpd\
bc dig nslookup host htpasswd psmisc net-tools bash-completion vim vim-enhanced bash-completion-extras\
tcp expect expect-devel nmap lsof unzip bind-utils
yum -y groups install "Development Tools"
#基本环境初始化
systemctl start ntpd && systemctl enable ntpd
\cp -rf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
yes
ntpdate -s ntp1.aliyun.com
#安全初始化
//如果在系统安装过程中时落下某些需要的软件包组
yum groups mark convert
yum grouplist
//#如果发现系统安装过程中落下了某些组包,可以用下面的方法安装
yum groupinstall "development tools" -y //装过的不能重复装
#ssh优化
vim /etc/ssh/sshd_config
79 GSSAPIAuthentication no
115 UseDNS no
vim /etc/hosts
192.168.31.150 douya #IP+HOSTNAME
systemctl retstart sshd