centos7个人常用操作

命令自动补齐

yum install bash-completion -y

关闭防火墙 

#禁用firewalld 
systemctl stop firewalld && systemctl disable firewalld && setenforce 0
 
 
#禁用selinux 把 enforcing 改成disabled
 
vim /etc/selinux/config
 
SELINUX=disabled
 
#修改防火墙规则,最后添加(可不做)
vim /etc/sysctl.conf
 
net.ipv4.ip_forward=1

查看所有端口

netstat -ntlp

ssh远程登陆慢

#在sshd_config文件中修改以下两个设置为no(如果被注释了记得取消注释)
 
GSSAPIAuthentication no
 
UseDNS no
 
#重启服务
systemctl restart sshd

 

使用阿里云镜像

#备份最初的镜像
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

#下载阿里云镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


#清理缓存
yum clean all


重新生成缓存

yum makecache

centos7 优先是使用ipv4 

#文件默认不存在,需要自己创建
vim /etc/gai.conf

precedence ::ffff:0:0/96  100


重启 restart

查看命令用哪个包可以安装(以ifconfig为例子)

yum provides ifconfig

虚拟机时间校准

#设置一个定时任务
vim ntpdate.cron

#内容是:(一分钟刷新一下时间)
*/1 * * * * ntpdate time.windows.com

#执行定时任务
crontab ntpdate.cron

#查看定时任务
crontab -l

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值