Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of the eighth day of Linux operation and maintenance

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

System important catalogue

/ etc/-Storage profile

/ bin/-storing command files (binaries) can be used by ordinary users

/ sbin/-storing command files (binaries) can be used by root users

/ home/-user home directory slum ordinary user home directory

/ root/-user home directory Imperial root user home directory

/ opt/-save software program data

/ var/-record log information

Important file information of the system

/ etc/

/ usr/-how to install the software (not included with the system)

/ var/-- messages secure

/ proc/-all the data in the directory is stored in memory

System important file information:

/ etc/

1) Network card configuration file

The path where the configuration file is saved is: / etc/sysconfig/network-scripts/ifcfg-eth0

Profile information description:

TYPE=Ethernet-defines the type of network used

BOOTPROTO=none-whether the IP address can be obtained automatically

None/static: will not let the IP address change

Dhcpd: dynamic acquisition of IP addresses

NAME-sets the Nic name information

DEVICE=eth0

ONBOOT=yes-activate the system network card

IPADDR=10.0.0.200-configure IP address information

PREFIX=24-Subnet mask information 255.255.255.0

Determine how many hosts in a LAN can be configured with IP addresses

GATEWAY=10.0.0.254-configure gateway information to allow hosts to access the public network

DNS1=223.5.5.5-access domain name-> ip address information

Visit the domain name of the website, and you can also display whether or not

Can communicate

1) change the configuration file to restart the service:

Restart the network card service mode 1:centos7

Systemctl restart network restarts all network cards

Restart the network card service mode 2:centos7 centos6

/ etc/init.d/network restart restarts all network cards

Restart the Nic service mode 3:

Ifdown (interface down) eth0-stop the eth0 network card

Ifup (interface up) eth0-starts the eth0 network card

Infdown eth0 & & ifup eth0

(used together)

2) address Resolution Service profile

Configuration file save path: / etc/resolv.conf

Profile information description:

Nameserver 223.5.5.5

Supplement: common DNS servers

223.5.5.5Compact 223.6.6.6 offer: Aliyun DNS

114.114.114.114 offer: telecom operator DNS

8.8.8.8 available: Google DNS

Restart network services

The Nic DNS information will be overwritten / synchronized to the resolv.comf file

PS: the configuration file information in the file, which will take effect immediately after the configuration is modified

3) Host name profile *

Server system hostname naming guidelines:

Area name-computer room name-room cabinet

Configuration file save path:

Centos7:/etc/hostname (change the name, you must restart the system to take effect)

Centos6:/etc/sysconfig/network

Temporary adjustment: let the configuration take effect immediately (reconnect) hostname + name

Centos7 can be temporarily modified with permanent changes.

Hostnamectl set-hostname + name

4) resolve the profile locally (establish a relationship between the host name and the IP address) *

Path to save the configuration file: / etc/hosts5) to automatically mount the storage device file *

Configuration file save path: / etc/hosts

Profile information description

① UUID== hardware identification information = = storage file information 6) to enable the system to issue automatic operation commands *

Configuration file save path: / etc/rc.local (permission execution permission)

Profile information description:

How does the profile take effect:

Chmod + x / etc/rc.d/rc.local-add execution permissions to the configuration file

Extension: system scripts (special) make complex / repetitive work-> efficient and simple

How to script ①: for commands

② run script file: sh / path / script file modify script file permissions to execute permissions-/ path / script file

7) system variable or environment variable profile

Configuration file save path: / etc/profile-configuration variable / environment variable / configuration alias information?

Profile information description:

Method 1:

Vi / etc/profile

Last line: export PATH=$PATH:/tmp

Method 2:

Echo export PATH=$PATH:/tmp > > / etc/profile

PS: in an enterprise environment, adding information to a configuration file, adding information using echo must use > > append information

Make the configuration file effective: method one: reproduce the connection server mode two: use the command to load the environment variable configuration file source / etc/profile immediately what is the variable: the script file uses the variable, the flexible use sets the variable: format: variable name = variable value x+y=10 xvariant 5 yearly? Name=oldboy call variable: echo $name script configuration: [root@oldboy66 ~] # cat test.sh name=olddog echo $name 01 echo $name 02 echo $name 03 what are environment variables: 1) variables set in system mode 2) system variables are capitalized how to modify environment variables: PATH temporary modification: export PATH=$PATH:/tmp permanent modification: modify configuration file : / etc/profile command execution principle process: 1) execute the command 2) load the system environment variable $PATH-- > / usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin 3) enter the environment variable specified directory / usr/local/sbin / usr/local/bin / usr/sbin / usr/bin / root/bin / tmp 4) there is a corresponding command file in the specified environment directory-- > execute command operation 4) there is no response command file in the specified environment directory-- > command not found / No such file or directory

Job: how to automatically mount the CD-ROM drive (two ways)

Review how to operate soft and hard connections

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report