Ninth day 2019-12-4 name, user level

01. Knowledge Course Overview section

3) Check the hardware operating system

4) operating system infrastructure optimization

02. Course Knowledge Review
03. The system important file information

1) level file system operation

File path information: / etc / inittab

File Function Description: Define what software program the system to automatically turn on after starting

 

System run level: runlevel command to view the current level

centos6 (level) default level 3

0 -------------- level system shutdown level

1 ------------ system-level single-user system used to crack passwords root, (no network service mode) rescue response system data

2 ----------------- multi-user mode, no network service model

3 -------- multi-user mode with network service mode (system power-on default level)

4 ------------------ unused

5 ------------ graphical system level

6 ------------- restart level

Setting method:

Temporary settings: init level digital (switching level)

Permanent setting: vim / etc / inittab the above mentioned id: 3 : initdefault: --- default run level 3 messages appear ------ centos6

 

centos7 (target operating mode) default level 3

systemctl get-default view the current level

ll / usr / lib / systemd / system / runlevel * target level directory View

/usr/lib/systemd/system/runlevel0.target -> poweroff.target /usr/lib/systemd/system/runlevel1.target -> rescue.target /usr/lib/systemd/system/runlevel2.target -> multi-user.target /usr/lib/systemd/system/runlevel3.target -> multi-user.target /usr/lib/systemd/system/runlevel4.target -> multi-user.target /usr/lib/systemd/system/runlevel5.target -> graphical.target /usr/lib/systemd/system/runlevel6.target -> reboot.target

Setting method:

Temporary settings: init level digital

Permanently set:

vim /etc/inittab

Modify the default operating system level systemctl set-default multi-user.target

 

2) system login prompt:

File path information: / etc / motd

File Purpose: The system displays the login prompt

vi / etc / motd

xxxxxxxxxxxxxxxxxxxxxxx

 

File path information: / etc / issue / etc / issue / issue.net

File Purpose: display a message before you log on

 

vi /etc/issue /etc/ issue/issue.net

xxxxxxxxxxxxxxxxxx

 

2) the system host name of the configuration file (temporarily modify with immediate effect)

File path information: / etc / hostname

File Function Description: modify the host name

PS: business needs, statistical information == Asset Management host Host name of the host network address of the host computer brands and models host CPU host host memory to store information

Host Name Name (Planning): Regional (BJ) --- room name (mobile idc) ---- enclosure number (010203) --- Machine number (01)

Changing the system name:

Temporary: hostname oldboy disconnect reconnect after the change to take effect restart shutdown fail

Permanent: Method One: vim / etc / hostname reboot to take effect

Method Two: hostnamectl set-hostname oldboy both temporary and permanent changes take effect reconnection

 

04. System software installation method (/ usr directory of important files / usr / local | / opt --- third-party software installation directory)

Method 1: Use the rpm command to install the software (process: official website to download the software installation program --- rpm to install software)

Features (disadvantages) Description: the need to install software to address software dependencies

Command to use:

Prerequisite: must have software package

rpm -ivh package name

i --- install software

v --- shows the installation process

h ------ humanized visible

(For example

The download process wget https://mirrors.aliyun.com/centos/7.7.1908/os/x86_64/Packages/vim-enhanced-7.4.629-6.el7.x86_64.rpm installation rpm -ivh vim-enhanced-7.4 .629-6.el7.x86_64.rpm)

rpm: RPM package management command packages have become rpm package

 

Method 2: Using yum command to install the software 360 ​​software housekeeping (yum warehouse)

Features: Download and install the software automatically resolve dependencies

Disadvantages: over-reliance on the network, you can not customize the functionality

Guide me: yum install -y software to confirm the name ------------- -y

yum reinstall -y Software Name (re-install or repair software)

The name must be some yum Curry

 

Method three: Install the software using the method to compile (source installation software)

Features: Flexible to install or configure software features

Disadvantages: can not resolve software dependencies installed high complexity operation and demonstration:

Trilogy (Configuration configure ---- compiler make ---- install make install)

Software program source code package -----> configure (specify the software installation directory specified software features) ---------> make compilation -------> make install installation

 

Method four: using the binary method to install the software package Features: Green software (used directly after decompression software) Database Service

Disadvantages: can not resolve software dependencies single function

Installation process:

Binary archive ------> decompression ---------> Save data better -----> simple configuration --------> Launcher

 

05. Check the system log file

Log File: Record system information or services running normal / abnormal information *

/ var directory of important documents:

1 / var / log / messages --- recording system or software operation (normal / abnormal) 2 / var / log / log Secure --- the information recording user

))> / Var / log / secure emptying file information

 

Dec 4 18:49:42 oldboy-test1 sshd[7961]: Accepted password for root from 10.0.0.1 port 49380 ssh2 01 02 03 04

     01. login connection time information 
02. Displays the host name information
03. What is login sshd (remote connection) login (local connection)
04. For more information logon process concerns the failure information
     How to view the log information: cat 
only view the latest information: Method a
head to view the file information --- 10 lines of information before the file
tail file information --- see the end of the file information 10 lines
before the head -n file view file information --- few lines
tail -n file information --- see the end of a few lines of a file
tail -f file information --- the latest changes in real-time view the log file data content
PS:
tail -f parameter and the -F parameter difference
  tail -f when deleting files when, view real-time process will end
tail -F when a file is deleted, view real-time process will end, but if the file was created out of the same command again, will continue to track
two: focus on the specified error message Fail
grep "attention information" file
-C - B -A -i
06. The system of foundation:

1) optimization system users: How to Create a User password how to create a user how to delete a user

How to Create a User: (operating under the root user)

useradd user-oldgirl

Check to confirm whether the user has been created: id user-oldgirl

b How to set a password:

Method a: Interactive Set Password passwd user-oldgirl ----> password information entered twice

Method Two: Free interactive password echo 654321 | passwd --stdin user-oldgirl

How to use the new user:

Method One: Re-establish a new remote connection

Method two: su ----- switch user su - username

PS: Emperor root - without a password information - civilian oldboy civilian oldboy- require password information - Emperor root

image-20191204122731540

c how to delete a user: (operating under the root user)

userdel user-girl

Download Optimization 2) system: yum install download

3) optimization of system security: security-related services shut down

PS: System security is inversely proportional system performance

Time 4) optimization of the system: the system synchronization area

5) character coding optimization: to solve the Chinese garbled message system becomes Chinese

6) Remote connection optimization: improve the speed remote connection

 

 

 

Guess you like

Origin www.cnblogs.com/sunhaoxu/p/11985418.html