关闭防火墙
centos6
永久性生效:chkconfig iptables off
即时生效:service iptables stop
查看防火墙状态:service iptables status 或者 iptables -L
检查防火墙是否开机自启:chkconfig iptables --list
centos7
临时关闭:systemctl stop firewalld
防火墙开机关闭:systemctl disable firewalld
开机启动:systemctl enable firewalld
查看状态:systemctl status firewalld
获取 firewalld 状态:firewall-cmd --state
关闭SELinux
centos6跟centos7通用
永久有效:修改/etc/sysconfig/selinux
vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
##将文本中的SELINUX=enforcing,改为SELINUX=disabled。然后重启
即时有效:setenforce 0
查看状态:getenforce
链接网卡文件
centos6
ln -s /etc/sysconfig/network-scripts/ifcfg-eth0 /root/
centos7
ln -s /etc/sysconfig/network-scripts/ifcfg-ens33 /root/
安装常用服务
yum -y install epel-release vim wget unzip gzip lrzsz git net-tools && yum -y install htop
修改yum源
cd /etc/yum.repos.d/
##进入系统中存储yum源的目录
mv CentOS-Base.repo CentOS-Base.repo.J
##备份系统自带的yum源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
##下载网易yum源
mv CentOS7-Base-163.repo CentOS-Base.repo
##将下载的yum源文件改成系统自带yum源文件的名字
yum makecache
##创建元数据缓存
yum -y update
##更新系统yum源安装包
详细:http://www.linux91.cn/c/Linux__centos7__yum%E7%BD%91%E7%BB%9C%E6%BA%90
转载请注明原文链接:linux测试机,个人预装优化
共有 0 条评论