首页 > 代码库 > RED hat 还是老的Linux

RED hat 还是老的Linux

1.固定的可以联网ip地址
2.关闭防火墙
3.关闭selinux
4.光盘自动挂载
5.配置好本地yum源

RHEL6配置方法:
1.ifconfig 2.配置文件(永久) 3.setup/nmtui

1.  ifconfig查看IP地址  crtl+l 清屏
    RHEL中弱化了setup的功能,对于网络管理来说,network服务的 

    功能弱化,主要通过NetworkManager对网络进行管理
    
	RHEL7通过nmtui修改网络配置(RHEL7默认安装,前提是需  

      要开启NetworkManager.service才可以使用)
首先,确定NetworkManager服务正常运行

systemctl status NetworkManager查看网络服务运行是否正常
systemctl start NetworkManager  启动networkmanager服务

   第二种 vim /etc/sysconfig/network-scripts/ifcfg-

eno16777736
TYPE="Ethernet"
BOOTPROTO="none" ip地址类型:none static dhcp
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
UUID="0ac62b8e-60b6-47ad-8967-c70369eeeaab"
DEVICE="eno16777736"
ONBOOT="yes"   是否启动
DNS1="8.8.8.8"    DNS
IPADDR="192.168.1.63"    IP地址
PREFIX= "24"   掩码长度
GATEWAY=192.168.1.1    默认网关
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no

	关闭防火墙,开机自动关闭
		rehl7  firewalld
查看命令及状态		systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded 

(/usr/lib/systemd/system/firewalld.service; enabled; vendor 

preset: enabled)
   Active: active (running) since 六 2017-05-06 23:31:20 

CST; 21min ago
 Main PID: 863 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─863 /usr/bin/python -Es /usr/sbin/firewalld --

nofork --nopid

5月 07 07:24:08 zq systemd[1]: Starting firewalld - dynamic 

firewall daemon...
5月 06 23:31:20 zq systemd[1]: Started firewalld - dynamic 

firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.

防火墙的关闭与开机自动关闭
             systemctl stop firewalld  关闭命令
[root@zq ~]# systemctl disable firewalld 禁用命令
Removed symlink /etc/systemd/system/dbus-

org.fedoraproject.FirewallD1.service.
Removed symlink 

/etc/systemd/system/basic.target.wants/firewalld.service.


关闭selinux并设置开机自动关闭
[root@zq ~]# setenforce 0 暂时关闭
usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@zq ~]# vim /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 two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only 

selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
重启生效  reboot

设置光盘开机自动挂载
 一切皆文件
[root@zq ~]# mount -a  验证
[root@zq ~]# ls /mnt   
addons  GPL       LiveOS      release-notes            RPM-

GPG-KEY-redhat-release
EFI     images    media.repo  repodata                 

TRANS.TBL
EULA    isolinux  Packages    RPM-GPG-KEY-redhat-beta
[root@zq ~]# df  查看
文件系统          1K-块    已用     可用 已用% 挂载点
/dev/sda3      20961280 3249680 17711600   16% /
devtmpfs         486124       0   486124    0% /dev
tmpfs            500664     156   500508    1% /dev/shm
tmpfs            500664    7204   493460    2% /run
tmpfs            500664       0   500664    0% 

/sys/fs/cgroup
/dev/sda1        508588  141104   367484   28% /boot
tmpfs            100136      16   100120    1% 

/run/user/1000
配置挂载文件
vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun May  7 05:20:03 2017
#
# Accessible filesystems, by reference, are maintained under 

‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8) and/or blkid

(8) for more info
#
UUID=7b8743cb-c53a-4848-83b7-d8c90a5413a0 /                  

     xfs     defaults        0 0
UUID=a0ac773e-aa81-49cb-887c-e0752f0d2456 /boot              

     xfs     defaults        0 0
UUID=4685bbff-8ccc-4937-9d33-5c34f9608a9f swap               

     swap    defaults        0 0
/dev/cdrom    /mnt                   iso9660   defaults      

0 0
这行是配置内容
tmpfs            100136       0   100136    0% /run/user/0
/dev/sr0        3947824 3947824        0  100% /mnt

配置yum源
二.yum的配置文件
yum的一切配置信息都储存在一个叫yum.repos.d的配置文件中,通常

位于/etc目录下这是整个yum系统的重中之重

vim /etc/yum.repos.d/rehl7.repo创建新的配置文件

[Server]
name=Red Hat Enterprise Linux Server
baseurl=file:///mnt    访问路径
enable=1       可以允许吗 可以    启用
gpgcheck=0      需要检查吗 不需要   取消验证

没有配置的先删除原有的文件
rm -fr /etc/yum.repos.d/*
创建文件  文件的形式 必须是.repo

[root@zq ~]# yum clean all
已加载插件:langpacks, product-id, search-disabled-repos, 

subscription-manager
This system is not registered to Red Hat Subscription 

Management. You can use subscription-manager to register.
正在清理软件源: Server
Cleaning up everything
[root@zq ~]# yum list
已加载插件:langpacks, product-id, search-disabled-repos, 

subscription-manager
This system is not registered to Red Hat Subscription 

Management. You can use subscription-manager to register.
Server                                                       

 | 4.1 kB  00:00:00     
(1/2): Server/group_gz                                       

 | 136 kB  00:00:00     
(2/2): Server/primary_db                                     

 | 3.6 MB  00:00:00     
已安装的软件包

  

  

RED hat 还是老的Linux