linux环境初始化设置

Centos6:
service iptables stop 立刻关闭防火墙
chkconfig iptables off 下次启动不再开启防火墙
Centos7:
systemctl stop firewalld 立刻关闭防火墙
systemctl disable firewalld 下次启动不再开启防火墙
systemctl status firewalld 查看防火墙状态

关闭selinux
setenforce 0 临时关闭
vim /etc/selinux/config
SELINUX=disabled
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

一般新系统都做下yum源更新,后面有需要安装依赖包。
1首先备份/etc/yum.repos.d/CentOS-Base.repo #centos6 路径略有区别
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2下载
cd /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
chmod +x /etc/yum.repos.d/

3生成缓存
yum clean all
yum makecache

清理缓存

sync; echo 1 > /proc/sys/vm/drop_caches
sync; echo 2 > /proc/sys/vm/drop_caches
sync; echo 3 > /proc/sys/vm/drop_caches1.

时间同步

安装
yum install chrony -y
启用
systemctl start chronyd
systemctl enable chronyd
设置亚洲时区
timedatectl set-timezone Asia/Shanghai
启用NTP同步
timedatectl set-ntp yes

posted @ 2024-05-20 13:24  少时诵诗书L  阅读(3)  评论(0编辑  收藏  举报