centos7 安装后相关配置

转载自: centos7 配置安装笔记

1. 最小化安装

2. 配置hostname
hostnamectl status
hostnamectl set-hostname HOSTNAME


网卡配置
vi /etc/sysconfig/network-scripts/ifcfg-eth0
在ifcfg-xxx[最小数字序列]中修改如下项目,如果项目不存在,则手动添加
BOOTPROTO=static //启动类型 dhcp|static
IPADDR=192.168.1.204 //IP地址,要设置的静态ip
NETMASK=255.255.255.0 //子网掩码
NETWORK=192.168.1.0 //网络地址编号
GATEWAY=192.168.1.1 //网关地址,为了访问外网
ONBOOT=yes //开机启动
DNS1=114.114.114.114 //DNS服务器地址,可以不用配置
DNS2=192.168.8.95 //DNS服务器地址,可以不用配置
重新网络
systemctl restart network



3.关闭SELinux
SELinux的工作模式一共有三种 enforcing、permissive和disabled 
①enforcing  强制模式:只要是违反策略的行动都会被禁止,并作为内核信息记录
②permissive  允许模式:违反策略的行动不会被禁止,但是会提示警告信息
③disabled  禁用模式:禁用SELinux,与不带SELinux系统是一样的,通常情况下我们在不怎么了解SELinux时,将模式设置成disabled,这样在访问一些网络应用时就不会出问题了。
getenforce 查看当前模式
vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled 
设置后需要重启才能生效


4. 修改sshd的端口
vi /etc/ssh/sshd_config
Port 222
防火墙开放222
firewall-cmd --zone=public --add-port=222/tcp --permanent
firewall-cmd --reload
systemctl restart sshd


防火墙禁用 systemctl stop firewalld systemctl disable firewalld


1、firewalld的基本使用
启动: systemctl start firewalld
查看状态: systemctl status firewalld 
停止: systemctl disable firewalld
禁用: systemctl stop firewalld
 
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值