微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

新装centos设置

1)清空iptables

Centos6系列关闭防火墙方法

关闭防火墙#/etc/init.d/iptables stop

开机自动关闭防火墙:# chkconfigiptables off


Centos7系列关闭防火墙方法

关闭防火墙:# systemctl stop firewalld.service

开机自动关闭防火墙:# systemctl disable firewalld.service


2关闭selinux

查看selinux状态# getenforce

Selinux文件位置 /etc/selinux/config

enforcing改成desabled保存即可

wKioL1jU0QigKbb8AABHlTidu9A514.png



3)配置好静态IP

# vim /etc/sysconfig/network-scripts/ifcfg-eth0

wKioL1jU06vRchwqAAAggoKdtio650.png


4)配置主机和ip映射关系

# vim /etc/hosts

新增一行:公网ip 主机名域名 主机名

wKiom1jU23_xjZnTAAAZy-sH0J0314.png


5)修改主机名

Centos6系列:# vim /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=主机名

NTPSERVERARGS=iburst


Centos7系列:#vim /etc/hostname

新增一行,主机名


重启系统即可生效


6)配置好yum源

yum存放位置:/etc/yum.repos.d/

备份本地yum源

# cp CentOS-Base.repo ./CentOS-Base.repo.bak


配置阿里yum源替换本地yum

Centos6系列

# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

Centos7系列

# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo


安装扩展源epel:

# yum -y install epel-release


yum缓存清理:# yum clean all

生成yum缓存:# yum makecache

原文地址:https://www.jb51.cc/centos/378226.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。