美文网首页
Linux59期day06

Linux59期day06

作者: A宽宽 | 来源:发表于2019-04-02 15:00 被阅读0次

    根下/etc目录作用:

    /etc:

    1. 网卡配置文件 /etc/sysconfig/network-scripts/ifcfg-eth0或ens33
      /etc /sys config /network-scripts /if cfg-eth0或ens33
      /系统配置文件/system configure/network-脚本(命令)/interface(网络接口-网卡) configure-ethernet0
    [root@oldboyedu59 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
    TYPE=Ethernet
    BOOTPROTO=none
    NAME=eth0
    UUID=fa77146b-1e0c-4544-8ecb-5a98a6ebfc41
    DEVICE=eth0
    ONBOOT=yes
    IPADDR=10.0.0.201
    PREFIX=24
    GATEWAY=10.0.0.254
    DNS1=10.0.0.254
    

    https://www.processon.com/view/link/5ca1b266e4b035b243bd844b

    DNS : 域名 ---解析--->ip地址

        Domain Name Server/System 域名解析服务/系统 
    

    公共的DNS服务器:
    DNS1或DNS2后面

    DNS1=10.0.0.254(网关ip地址)

    阿里云:
    DNS1=223.5.5.5
    DNS2=223.6.6.6

    114:
    DNS1=114.114.114.114
    DNS2=114.114.115.115

    [root@oldboyedu59 ~]# cat  /etc/sysconfig/network-scripts/ifcfg-eth0
    TYPE=Ethernet
    BOOTPROTO=none
    NAME=eth0
    UUID=fa77146b-1e0c-4544-8ecb-5a98a6ebfc41 #修改网卡配置文件的时候 不要把这一行复制过去。
    DEVICE=eth0
    ONBOOT=yes
    IPADDR=10.0.0.201
    PREFIX=24
    GATEWAY=10.0.0.254
    DNS1=10.0.0.254
    DNS2=223.5.5.5
    

    systemctl restart network

    系统控制命令 重启 所有网卡

    需要自动补全命令参数

    tab键默认只能补全 命令名字或目录
    bash-completion tab键自动补全增强版

    安装命令

    yum install -y tree vim bash-completion
    安装完成之后需要重新登录下系统(断开xshell 重新连接)生效

    检查软件是否安装

    rpm -qa 显示系统中安装的所有软件
    rpm -qa tree bash-completion 查询某个软件是否安装
    -q query 查询
    -a all

    [root@oldboyedu59 ~]# rpm -qa tree bash-completion 
    bash-completion-2.1-6.el7.noarch
    tree-1.6.0-10.el7.x86_64
    [root@oldboyedu59 ~]# 
    

    /etc/resolv.conf 解析 DNS

    网卡里面配置DNS VS /etc/resolv.conf配置DNS
    共同:配置DNS
    不同:
    在网卡中进行DNS配置√
    网卡配置DNS使用的是: nameserver 223.5.5.5
    DNS1=223.xxxx和DNS2=xxxxx nameserver 223.6.6.6

    网卡里面永久生效 临时生效(重启网卡后会被网卡里面的DNS覆盖)
    重启网卡后生效 立即生效

    /etc/hostname 主机名

    Linux如何修改主机名:

    通用:

    1. hostname命令修改主机名(临时 重启服务器之后失效)
    [root@oldboyedu59 ~]# hostname
    oldboyedu59
    [root@oldboyedu59 ~]# hostname oldboyedu59-lnb 
    

    2.修改文件内容(写合同 永久 重启服务器之后生效)
    vim /etc/hostname
    3.检查

    [root@oldboyedu59 ~]# hostname
    oldboyedu59-lnb
    [root@oldboyedu59 ~]# cat /etc/hostname 
    oldboyedu59-lnb
    

    CentOS 7特有:

    一条命令,同时修改临时+永久

    [root@oldboyedu59-lnb ~]# hostnamectl set-hostname oldboyedu59
    同时修改临时+永久
    [root@oldboyedu59-lnb ~]# hostname
    oldboyedu59
    [root@oldboyedu59-lnb ~]# cat /etc/hostname 
    oldboyedu59
    

    网站更新过程(程序代码更新)

    1.在开发人员自己电脑进行测试
    2.公司内部机房进行测试
    3.在IDC机房(数据中心) 测试
    4.程序代码放在用户使用的环境(生产环境/线上环境)

    开发或运维在本地(自己电脑进行测试)

    [root@oldboyedu59-lnb ~]# cat  /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    10.0.0.201  guoav.com  jd.com
    

    /etc/fstab 配置开机设备自动挂在的文件

    [root@oldboyedu59-lnb ~]# cat /etc/fstab 
    UUID=1e827748-cc43-4b1d-8bbc-9a85c239782d /                       xfs     defaults        0 0
    UUID=29a4ef75-7502-48df-b31c-c7c10264a7c8 /boot                   xfs     defaults        0 0
    UUID=60c45f5e-c78d-41fe-aa92-93d10de6def3 swap                    swap    defaults        0 0
    [root@oldboyedu59-lnb ~]# #第1列 设备名称
    [root@oldboyedu59-lnb ~]# #第2列 挂载点(入口)
    

    /etc/rc.local:存放开机自启动程序命令的文件

    [root@oldboy59 ~]# cat /etc/rc.local 
    #!/bin/bash
    # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
    #
    # It is highly advisable to create own systemd services or udev rules
    # to run scripts during boot instead of using this file.
    #
    # In contrast to previous versions due to parallel execution during boot
    # this script will NOT be run after all other services.
    #
    # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
    # that this script will be executed during boot.
    
    touch /var/lock/subsys/local
    

    相关文章

      网友评论

          本文标题:Linux59期day06

          本文链接:https://www.haomeiwen.com/subject/jkdbbqtx.html