CENTOS系统安装及初始化配置相关

Posted on   风行天下-2080  阅读(254)  评论(0编辑  收藏  举报

一,配置网卡:

1,设置网卡ip地址:vi   /etc/sysconfig/network-scripts/ifcfg-eth0 

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.90
NETMASK=255.255.255.0

2,设置网关:

[root@localhost 桌面]# cat /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=svr5.tarena.com //主机名只有重启后才能生效

GATEWAY=192.168.8.1 //重启network服务即生效

[root@localhost 桌面]# /etc/init.d/network restart

3,设置DNS地址:

[root@localhost ~]# cat /etc/resolv.conf
nameserver 114.114.114.114

最后ping www.baidu.com

二,关闭防火墙,selinux,NetworkManager

1,getenforce

setenforce 0

2,iptables -F 情况iptables规则

3,

关闭NetworkManager服务,禁止开机自启

分析: NetworkManager服务,是一个独立服务。为Linux图形下管理网络连接的服务, 在RHEL6.5中与network服务有冲突需要关闭。

命令操作如下所示:

[root@localhost 桌面]# /etc/init.d/NetworkManager stop

停止 NetworkManager 守护进程: [确定]

[root@localhost 桌面]# chkconfig NetworkManager off

[root@localhost 桌面]# chkconfig --list NetworkManager

NetworkManager     0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭

关闭selinux和iptables:
setenforce 0

iptables -F
iptables -t nat -F
systemctl stop firewalld
systemctl disable firewalld

systemctl stop NetworkManager
systemctl disable NetworkManager

1 永久方法 – 需要重启服务器

修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。

2 临时方法 – 设置系统参数

使用命令setenforce 0

附:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式

三,更换yum源

1、备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

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

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

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

3、之后运行yum makecache生成缓存

四,U盘安装CENTOS系统

http://www.osyunwei.com/archives/2307.html

    u盘安装操作系统                    http://blog.51cto.com/9100413/2050146                 (我已经试过,可以使用。)

编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?

随笔 - 618, 文章 - 0, 评论 - 6, 阅读 - 37万

Copyright © 2025 风行天下-2080
Powered by .NET 9.0 on Kubernetes

点击右上角即可分享
微信分享提示