The second week of operation and maintenance of Linux summary

Mount operation :Mountdevice mount point information of the file directory;Mount / dev / CDROM / mnt; Umount / mnt  

View the log file : log file path : / var / log / log file important information : / var / log / messages --- system operation or service running status information log file; / var / log / Secure --- system user login log file

Optimization software library: command: yum -y install wget;confirm whether optimization download directory: /etc/yum.repos.d/; gnaw at the command: curl-o / etc / yum.repos.dhttp://mirrors.aliyun.com/repo/Centos-7.rep

Important documents etc directory:

firewalld firewall service: closed:

       ➊ temporary closure :

  Command: systemctl STOP firewalld

  View:  systemctl Status firewalld

  Simple view: systemctl IS-the Active firewalld

       ➋ permanently closed :

      命令:systemctl disable firewalld    

   View: systemctl Status firewalld.service

      Simple view: systemctl IS-Enabled firewalld.service

selinux security services: closed

➊ temporary closure :

   setenforce

       usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]

       setenforce Enforcing / 1 --- selinux feature is turned on

   setenforce Permissive / 0 --- selinux function temporarily closed

➋ permanently closed :

   vi /etc/selinux/config

   # enforcing  - SELinux security policy is enforced.

  selinux security policy is enforced          - the security policy is enabled

       # permissive - SELinux prints warnings instead of enforcing.

  selinux output a warning message instead of enforcement    - temporarily closed

       # disabled   - No SELinux policy is loaded.

    No selinux policy is loaded              - permanent closure policy function

SELINUX = disabled --- permanently closed selinux   

   Permanent closure of entry into force : reboot the system

   Permanent start the program : modified configuration files - reboot the system to wait a long time to reload selinux program

Time System optimization:

automatic synchronization :

A manner : to achieve automatic time synchronization using timedatectl

⑴: Modify zone

   timedatectl set-timezone Asia/Shanghai

⑵: On Time synchronization

   timedatectl set-ntp 1

⑶: time synchronization software

    yum install -y chrony

   systemctl start chrony

   systemctl enable chrony

Second way : to achieve automatic time synchronization using ntpdate

   ntpdate find time server

   ntpdate ntp1.aliyun.com

   ➋ manually modify the time :

Method 1 : use command timedatectl

   timedatectl set-time "2019-12-5 12:08"

 Second way : using the command date ???

 

 The operating system character Optimization: Modify System Character Encoding:

  ➊ view the default encoding information :
  echo $ LANG
  en_US.UTF-8
  ➋ temporarily modify :
  LANG = zh_CN.utf8
  ➌ support Chinese encoding , as well as information as possible so that the English translation for the Chinese display
          zh_CN.gb18030
      zh_CN.GB2312
      zh_CN.gbk
      zh_CN.utf8
  ➍ permanent modification :
  CAT /etc/locale.conf 
      LANG = "zh_CN.utf8"
  ➎ temporary permanent modifications are made :
  localectl the SET-locale LANG = "zh_CN.gbk"

 

System remote connection optimization:

 

vi / etc / ssh / sshd_config --- Remote service profile

 

    UseDNS no --- whether to open the DNS reverse resolution process

 

      GSSAPIAuthentication no --- whether GSSAPI authentication

 

Restart: systemctl restart sshd

Optimization system prompt:

Special environment variables : PS1

 

  [  \u@  \h   \W]\$

 

  [root@backup  ~]#

 

  \ u --- represents a log of user information

 

  \ h --- indicates the host name information

 

  \ W --- shows the current path information

 

Modify the command prompt information :

 

  ➊ temporary modifications :

 

  PS1 = '[\ u @ \ h \ w] \ $'

 

  PS1 = '[\ u @ \ h \ W \ t \ $'

 

  ➋ permanent modification :

 

  vi / etc / profile

 

  PS1 = '[\ u @ \ h \ W \ t \ $'

 

Modify command prompt Color :

 

  PS1 = '\ [\ e [32; 1m \] [\ u @ \ h \ W \ t] \ $ \ [\ e [0m \]

 

  \ [\ e [32; 1m \] --- string Add color indicates the digital information of different colors bold font information

 

  \ [\ e [0m \] --- stop string following color modification

System Information To view:

 

Using the System Version Information : centos 7.6  

 

   # cat /etc/redhat-release

 

       CentOS Linux release 7.6.1810 (Core)

 

Using the system kernel information : 3.xx 4.xx

 

   uname -a

 

       Linux backup 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Hardware View:

CPU

 

view the file information : / proc / cpuinfo

RAM

 

view the file information : / proc / meminfo

Disk

 

Check the mount information : / proc / mounts

 

Guess you like

Origin www.cnblogs.com/yjxgj/p/12003113.html