Linux operation and maintenance eighth day summary

Important system directory
/ etc / --- Storage Profiles
/ bin / --- store command files (binaries) Ordinary users can use the
/ sbin / --- store command files (binaries) root user can use
/ home / - - the user's home directory slum ordinary user's home directory
/ root / --- user's home directory Palace root user's home directory
/ opt / --- saving software program data
/ var / --- logging information

Important system information file
/ etc /
/ usr / - - how to install the software (not the system comes)
/ var / - - Secure messages
/ proc / - - data directory is stored in memory


Information system important files : /
etc /
1) NIC configuration file

Profile storage locations path: / etc / sysconfig / network- scripts / ifcfg - eth0
profile NOTE:
the TYPE = Ethernet - - - defined using the type of network
BOOTPROTO = none - - - Can automatically obtain an IP address
none / static: not make IP address changes
dhcpd: dynamic IP address
nAME - - - name card information to set
the DEVICE = eth0
ONBOOT = yes - - - card system will be activated to start
IPADDR = 10.0.0.200 - - - configure IP address information
PREFIX = 24 - - - information 255.255.255.0 subnet mask
determine how many hosts on a LAN can configure the IP address
gATEWAY = 10.0.0.254 - - - gateway configuration information, allowing hosts to access external networks
DNS1 = 223.5.5.5 - - - access domain - -> ip address information,
visit the Web site domain name, but also to show whether
you can communicate
1) configuration file changes to restart the service:
restart card service mode 1: centos7
systemctl restart Network all NIC restart
to restart the network card service mode 2: centos7 centos6
/ etc /init.d/network restart all network card restart
to restart the network card service mode 3:
ifdown (interface down) eth0 - - - stop eth0 network card
ifup (interface up) eth0 - - - start eth0 card
infdown eth0 && ifup eth0
(used together )
2) address resolution service profile
configuration file path: / etc / resolv. conf
profile information Description:
nameserver 223.5.5.5
added: common DNS server
223.5.5.5/223.6.6.6 offer: Ali cloud DNS
114.114.114.114 offer: telecom operators DNS
8.8.8.8 provide: Google's DNS
network service restart
card DNS information overwrites / sync files to resolv.comf
PS: file profile information after configuration changes will take effect immediately

  • 3) Host name of the configuration file *
    server system host name nomenclature:
    Area Name - room name - the room cabinet
    configuration file path:
    centos7: / etc / hostname (change the name, you must reboot the system to take effect)
    centos6: / etc / sysconfig / Network
    temporary adjustment: allows configuration to take effect immediately (reconnection) hostname + name

         centos7 可以即临时修改有永久变化

    hostnamectl set-hostname + Name

    • 4) The local resolver configuration file (to establish relationships between the host names and IP addresses) *
      saved configuration file path: / etc / hosts
  • 5) automatically mounted storage device file *
    configuration file path: / etc / hosts
    profile information described
    ①UUID == = = hardware identification information stored in the file information
  • 6) implementation system to automatically run commands issued *
    Configuration file path: /etc/rc.local (permission to execute)
    profile information Description:
    Profile How to take effect:
    chmod + the X-/etc/rc.d/rc.local - - add execute permissions to the profile
    extended: the script system (special) make complex / duplication - -> simple and efficient
    ① how to script: command
    ② run the script file: sh / path / script files to modify the script file permissions to perform permissions - - / path / script files

7) system environment variables or variable profile
configuration file path: / etc / profile --- configuration variables / environment variable / alias configuration information ???
profile information Description:
Method 1:
vi / etc / Profile
last line: export PATH = $ PATH: / tmp
Second way:
echo Export PATH = $ PATH: / tmp >> / etc / profile
PS: in an enterprise environment, add information to a configuration file, use echo to add additional information must use information >>

   使配置文件生效:
   方式一: 重现连接服务器
   方式二: 利用命令立即加载环境变量配置文件
           source /etc/profile
    什么是变量:脚本文件中使用变量,灵活的使用
    设置变量:   格式: 变量名=变量值   x+y=10 x=5 y=?
                     name=oldboy
   调用变量:   echo  $name

   脚本配置:
   [root@oldboy66 ~]# cat test.sh 
   name=olddog
   echo $name 01 
   echo $name 02
   echo $name 03

   什么是环境变量:
   1) 系统模式设置好的变量
   2) 系统变量名称都是大写字母

   如何修改环境变量: PATH
   临时修改:
   export PATH=$PATH:/tmp
   永久修改:
   修改配置文件: /etc/profile

   执行命令原理过程:
   1) 执行命令 
   2) 加载系统环境变量  $PATH --> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
   3) 进入环境变量指定目录中
      /usr/local/sbin  
      /usr/local/bin
      /usr/sbin
      /usr/bin
      /root/bin
      /tmp
   4) 指定环境目录中有相应命令文件   --> 执行命令操作
   4) 指定环境目录中没有响应命令文件 --> command not found / No such file or directory

Work: how to automatically mount the drive (two ways)
review the operation of how hard and soft connection

Guess you like

Origin blog.51cto.com/14524672/2436413