The most straightforward directory structure

1. The common catalog and explain the linux instructions
1 bin command to save the file where
2 sbin command only root users can use the
3 boot (to understand) when the program starts the Linux directory information stored in
the directory exists 4 dev device file
5 etc files and configuration information for existing service configuration information directory
catalog (normal user's home directory) where the user 6 home
directory (where the super administrator's home directory) where the user root 7
8 selinux: save selinux configuration file and information systems safety-related program
9 lib (to understand) library file
10 mnt temporary mount directory
information 11 opt to store third-party software to generate
12 / usr / local storage software installation information
data 13 proc directory is stored in memory , process information and kernel file information
where 14 tmp temporary files are stored, is equivalent to the Recycle Bin
15 var save the file (log file) data often change
1.1. Linux common directory structure diagram
The most straightforward directory structure
2./etc directory explain
2.1 Detailed network card configuration file

vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet                       网络连接类型
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none                 是否网络连接方式为dhcp(none:不设置任何连接;static:静态的连接)
DEFROUTE=yes                     默认路由是否开启
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0                
                                设备名称
DEVICE=eth0               
UUID=0ea55b05-db81-4dd0-a145-fa476c8b6045          服务器硬件标识符
ONBOOT=yes                                       网卡是否激活
IPADDR=10.0.0.200                                网络的IP地址
PREFIX=24                                         子网掩码,设定一个局域网可以拥有多少台主机
GATEWAY=10.0.0.254                               是否可以上外网
DNS1=223.5.5.5                                      进行域名的解析
IPV6_PRIVACY=no

2.1.1 LAN Configuration Notes
card configuration Once modified, the card must restart
CentOS 7: systemctl restart Network
CentOS: 6: /etc/init.d/network restart
Restart a single card: ifdown eth0 && ifup eth0
ifdown eth0; ifup eth0
2.1 .2 Why IP, architecture diagram to explain
The most straightforward directory structure
2.1.3 Why DNS, architecture diagram to explain
The most straightforward directory structure
2.1.4 Why do we need a gateway, architecture diagram to explain
The most straightforward directory structure
2.2 DNS DNS configuration

[root@oldboy666 ~]# vi /etc/resolv.conf
# Generated by NetworkManager    
nameserver 223.5.5.5                       服务名字 DNS地址

2.2.1 DNS DNS domain name in the order solution and NIC configurations of execution
not before restarting card: DNS DNS configuration, loaded first is the DNS name resolution configuration file inside
after the restart card: DNS DNS configuration, the card is loaded first the configuration file which
The most straightforward directory structure
2.3 to configure the host name
permanently configured 2.3.1 9.3.3.1 centos6 path and the centos7

centos6.9的永久配置路径
[root@oldboy666 ~]# cat /etc/sysconfig/network

# Created by anaconda
centos7.6的永久配置路径
[root@oldboy666 ~]# cat /etc/hostname 
oldboy666
[root@oldboy666 ~]# 
[root@oldboy666 ~]# 
[root@oldboy666 ~]#

2.3.2 centos7 hostname configured advantage

[root@oldboy666 ~]# hostnamectl set-hostname oldboy6666
[root@oldboy666 ~]#
[root@oldboy6666 ~]#

2.4 configuration files permanently mount

[root@oldboy6666 ~]# vim /etc/fstab 
# /etc/fstab
# Created by anaconda on Fri Aug 30 12:11:39 2019
#
# 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=27114df9-3f54-4b94-acb7-0890b452e99f /                       xfs     defaults        0 0
UUID=4260ed75-aad2-4389-b24a-2be6362c2597 /boot                   xfs     defaults        0 0
UUID=8e7004ef-83c2-4b8d-b9db-b85768271eb2 swap                    swap    defaults        0 0
#UUID=2018-11-25-23-54-16-00   /mnt          iso9660      defaults         0 0

2.4.1 Detailed profiles
first row: hardware identifier information indicates the mounted hardware device that can also be written as / dev / ???
the second column: the need to mount the disk directory
in the third column: partition file type
fourth column: loading parameters
fifth column: backup settings (1 backup, 0 to not backup)
sixth column: disk check, 0 is never checked; / directory partition 1, partition other directory 2
2.5 local parsing the configuration file
2.5.1 how to resolve

[root@oldboy6666 ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

Format
IP address of the host name
2.6 boot from the startup configuration file Detailed

[root@oldboy6666 ~]# vim /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
mount /dev/cdrom /mnt‘

2.6.1 centos7 file on the reasons boot from the start of the item is not in force

Because there is no power on executing authority can not take effect caused

[root@oldboy6666 ~]# ls -l /etc/rc.local 
lrwxrwxrwx. 1 root root 13 Aug 30 12:12 /etc/rc.local -> rc.d/rc.local   这个是链接文件,需要查看真正的文件
[root@oldboy6666 ~]#
[root@oldboy6666 ~]# ls -l /etc/rc.d/rc.local 
-r--------. 1 root root 495 Sep  6 19:13 /etc/rc.d/rc.local          这个真实的文件只有读权限
[root@oldboy6666 ~]#
[root@oldboy6666 ~]# chmod 777 /etc/rc.d/rc.local            修改文件权限
[root@oldboy6666 ~]# ls -l /etc/rc.d/rc.local 
-rwxrwxrwx. 1 root root 495 Sep  6 19:13 /etc/rc.d/rc.local             目前拥有了执行权限,可以正常的开机
[root@oldboy6666 ~]#

2.7 System environment variables Configuration files
2.7.1 What is the environment variable
is a variable system mode setting of
the system variable names are in uppercase, for example: the PATH
2.7.2 How to modify environment variables
(1) altered.

export PATH=$PATH
[root@oldboy6666 ~]# echo $PATH                      查看当前的系统环境变量可以匹配的路径有哪些
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@oldboy6666 ~]# mv /bin/cp /tmp                将/bin/cp的命令移动到tmp里面
[root@oldboy6666 ~]# ls
1.txt  anaconda-ks.cfg  passwd
[root@oldboy6666 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@oldboy6666 ~]# touch aa.txt                        创建一个文件
[root@oldboy6666 ~]# cp -rf aa.txt /opt/                   开始复制文件
-bash: cp: command not found                             发现cp命令找不到
[root@oldboy6666 ~]# export PATH=$PATH:/tmp                临时将tmp目录加入环境变量里面
[root@oldboy6666 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/tmp       添加成功 
[root@oldboy6666 ~]# cp -rf aa.txt /opt/                        再次复制发现已经成功
[root@oldboy6666 ~]#

(2) permanently modifying
[root@oldboy6666 ~]# echo PATH=$PATH:/tmp >> /etc/profile >>这个是追加,千万别写成>这样会清空文件
execution command principle 2.7.3
(1) command is executed.
(2) the execution environment variable PATH = (/ usr / local / sbin:. / Usr / local / bin: / usr / sbin: / usr / bin: / root / bin)
(3) view the execution variables in which these environment variables do.
(4) If one of the paths inside, you can use this command; to find otherwise, will report command not seen (above. temporary modify environment variables inside because the cp command to move to the tmp directory, find the cause cp gone, behind the / tmp path pATH environment variable added to it which you can use)

Guess you like

Origin blog.51cto.com/14152159/2436522