RHEL6.5环境的基础配置
来源:互联网 发布:广联达梦龙网络计划 编辑:程序博客网 时间:2024/06/05 05:39
RHEL6.5环境的基础配置
- 配置网络
- 关闭防火墙
- 关闭selinux
- 配置本地yum源
配置网络yum源
1. 配置网络
配置网络可以有好几种配置,以下讲解用配置文件配置静态IP地址。
1.1编辑/etc/sysconfig/network-script/ifcfg-eth0文件,内容如下:
# 此配置文件应用到的设备DEVICE=eth0# 对应的设备的MAC地址HWADDR=00:0C:29:68:FE:A3# 接口类型;常见有的Ethernet, BridgeTYPE=Ethernet# 设备的惟一标识UUID=6a6234fe-231a-4068-805e-583561fb9ae8# 启动网卡ONBOOT=yes# NM是NetworkManager的简写,此网卡是否接受NM控制;建议RHLE6为“no”NM_CONTROLLED=no# 有三种类型:none,static,dhcpBOOTPROTO=static# IP地址IPADDR=192.168.0.75# 子网掩码NETMASK=255.255.255.0# 默认网关GATEWAY=192.168.0.1# DNS服务器IPDNS1=114.114.114.114IPV6INIT=noUSERCTL=no
1.2 重启网络服务
[root@localhost ~]# service network restartShutting down interface eth0: [ OK ]Shutting down loopback interface: [ OK ]Bringing up loopback interface: [ OK ]Bringing up interface eth0: Determining if ip address 192.168.0.75 is already in use for device eth0... [ OK ]
1.3 查看配置是否生效
[root@localhost ~]# ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:0C:29:68:FE:A3 inet addr:192.168.0.75 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe68:fea3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2053 errors:0 dropped:0 overruns:0 frame:0 TX packets:1648 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:639687 (624.6 KiB) TX bytes:188127 (183.7 KiB)
1.4 测试网络是否畅通
[root@localhost ~]# ping -c 3 www.baidu.comPING www.a.shifen.com (115.239.210.27) 56(84) bytes of data.64 bytes from 115.239.210.27: icmp_seq=1 ttl=55 time=55.3 ms64 bytes from 115.239.210.27: icmp_seq=2 ttl=55 time=58.2 ms64 bytes from 115.239.210.27: icmp_seq=3 ttl=55 time=78.4 ms--- www.a.shifen.com ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2080msrtt min/avg/max/mdev = 55.396/64.040/78.462/10.268 ms
2. 关闭防火墙
2.1 配置开机自动关闭
[root@localhost ~]# chkconfig iptables off
2.2 临时关闭防火墙
[root@localhost ~]# service iptables stop
2.3 查看启动级别开机启动防火墙状态
[root@localhost ~]# chkconfig --list iptablesiptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
上面显示6个启动级别都是出于关闭状态,防火墙关闭成功。
3.关闭selinux
3.1 临时关闭selinux
[root@localhost ~]# setenforce 0setenforce: SELinux is disabled
3.2 开机自动关闭selinux
[root@localhost ~]# sed -i '/SELINUX=/cSELINUX=disabled' /etc/selinux/config [root@localhost ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system.SELINUX=disabled# 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 these two values:# targeted - Targeted processes are protected,# mls - Multi Level Security protection.SELINUXTYPE=targeted
3.3重启系统
[root@localhost ~]# reboot
3.4检查是否成功关闭selinux
[root@localhost ~]# getenforce Disabled
以上显示为Disabled,所以关闭防火墙成功。
4. 配置本地yum源
4.1 检查光驱是否正常
[root@localhost ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 20G 0 disk ├─sda1 8:1 0 200M 0 part /boot├─sda2 8:2 0 1G 0 part [SWAP]└─sda3 8:3 0 4.9G 0 part /sr0 11:0 1 3.6G 0 rom # 光驱正确启动
4.2 配置开机自动挂载光驱
[root@localhost ~]# echo '/dev/sr0 /mnt iso9660 defaults 0 0' >> /etc/fstab
4.3 挂载配置/etc/fstab中的设备
[root@localhost ~]# mount -a mount: block device /dev/sr0 is write-protected, mounting read-only
4.4 配置本地yum 源
4.4.1 删除默认的yum源配置文件
[root@localhost ~]# rm -rf /etc/yum.repos.d/*
4.4.2 新增本地yum源配置文件
[root@localhost ~]# vim /etc/yum.repos.d/rhel6.local.repo name=rhel6-source # yum源名称baseurl=file:///mnt # yum描述信息enabled=1 # yum源状态【0:关闭,1:开启】gpgcheck=0 # 不验证
4.4.3配置网络yum源【使用的是阿里云的yum源】
CentOS 5
wget-O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget-O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget-O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo
如果用的是RHEL6 ,需要修改下repo文件:
sed -i's/$releasever/6/g' CentOS-Base.repo
之后运行yummakecache生成缓存
4.4.4 安装epel源
yum install epel-release –y
4.4.5 清空本地主机yum缓存
[root@localhost ~]# yum clean allLoaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Cleaning repos: base epel extras rhel6-local-source updatesCleaning up Everything
4.4.6 更新yum源缓存使其配置生效
[root@localhost ~]# yum list
4.4.7 查看已经启动的yum源
[root@localhost ~]# yum repolistLoaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.repo id repo name statusbase CentOS-6 - Base - mirrors.aliyun.com 6,706*epel Extra Packages for Enterprise Linux 6 - x86_64 12,365extras CentOS-6 - Extras - mirrors.aliyun.com 45rhel6-local-source rhel6-source 3,690updates CentOS-6 - Updates - mirrors.aliyun.com 426repolist: 23,232
以上显示yum已经生效了,配置yum成功。当然啦,你可以不用配置网络yum源,只需配置本地yum即可,也可以完成后期相关服务搭建。
阅读全文
0 0
- RHEL6.5环境的基础配置
- linux基础(3)--可用实验环境配置--RHEL6.5
- Linux基础(1)--学习环境搭建--RHEL6.5
- [基础]RHEL6 VNC Server配置
- [基础]RHEL6远程桌面Xmanager配置
- rhel6.5 环境nginx安装
- linux基础(5)--恢复误删除的文件--RHEL6.5
- linux基础(8)--用户和组的管理--RHEL6.5
- linux基础(15)--locate、find命令的使用--RHEL6.5
- VMWare下Linux(RHEL6.5)环境搭建:安装、网络配置、yum配置
- linux学习之rhel6.5 varnish服务简介及基础配置 应用
- nagios环境部署(rhel6.5)
- ROS基础环境的配置
- RHEL6-易用的防火墙配置工具
- Rhel6下JDK1.6.0的配置
- 配置RHEL6.2的YUM源
- rhel6.4 配置本地yum的源
- 配置RHEL6使用CentOS的yum源
- Spring Boot 之jpa(二)数据库
- sort2——随机数生成测试样例
- JavaSE_笔试题_多选选择题1
- iOS Hacker obfuscator-llvm Xcode集成配置
- spring
- RHEL6.5环境的基础配置
- python编程之执行带有局部副作用的代码
- 最强表格渲染框架
- Android Services设置ProgressBar(进度条的值)
- hdu3118(二分图位判断)
- 好文链接
- CentOS 7.0关闭默认防火墙启用iptables防火墙
- 读书笔记-天机妙算刘伯温-3
- Ice_cream’s world II