Centos7-基本设置
设置hostname
hostnamectl set-hostname ABC
查看网络连接
netstat/ss -lntcp
查找软件
rpm -ql python
find /tmp/ -name
安装vim
yum install vim
关闭selinux
vim /etc/sysconfig/selinux 状态改为disabled
配置chrony(兼容NTP,可作为NTP服务器)
vim /etc/chrony.conf
server端:
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
allow *
chronyc tracking
client端:
server server-ip iburst
ntpdate -u IP #-u参数可以越过防火墙与主机同步)
检查chrony情况:chronyc -- sources sourcestas client
YUM相关
cd /etc/yum.repo
yum search / list / update / remove / makecache /repolist
关闭网卡
ifup eth0 / ifdown eth0
配置阿里云镜像
yum install wget
cp /etc/yum.repos.d/CentOS-Base.repo /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
cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum makecache
配置DNS
vim /etc/resolv.conf nameserver ip
关闭ipv6
vim /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 =1
net.ipv6.conf.default.disable_ipv6 =1
sysctl -p
若系统正在运行
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
或者
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
重启生效
reboot
netstat -lnpt
提示netstat command can not fing
yum install net-tools
新添加硬盘手动扫描
cd /sys/class/scsi_host
echo "---" > /sys/class/scsi_host/host0/scan
查看各文件大小
du -smh *
centos7-vmtool
yum install -y open-vm-tools
systemctl enable vmtoolsd
systemctl start vmtoolsd