Love it! The PDF version of Linux notes summarized by Huawei engineers is available for download for a limited time

Foreword:

Recently, many friends asked me for some basic Linux information, so I went through the box and found out this Linux summary note summarized by Huawei Daniel and shared it with everyone for free!

It is said that some friends successfully entered BAT with this note, so be sure to study this information!

Let's first look at some practical cases of Linux operation:

cat /etc/resolv.conf 2. Deploy DNS domain name resolution service to realize the query service for the following domain name records.

1) The IP address record of the domain name dns.tedu.cn and zbx.tedu.cn is 192.168.10.7

2) The IP address record of the domain name www.tedu.cn is 114.115.116.117 Experiment 2:

Step 1: Build a yum warehouse

Virtual machine-settings-hardware-device status (connected, connected at startup, use iso image to select a good image)

Provide software warehouse for this machine

1. Create directory /repo/cos7dvd

[root@svr7 ~]# mkdir -p /repo/cos7dvd/ //Build warehouse directory 2. Mount CentOS7 CD

[root@svr7 ~]# mount /dev/cdrom /mnt/ //mount the CD

mount: /dev/sr0 is write-protected, it will be mounted as read-only 3. Copy all the documents in the CD to the /repo/cos7dvd/ directory

[root@svr7 ~]# cp -rf /mnt/* /repo/cos7dvd/ //Copy all CD files 4. Confirm the warehouse directory

[root@svr7 ~]# ls /repo/cos7dvd/ //Confirm the result

addons isolinux repodata Packages RPM-GPG-KEY-redhat-release

… …

Use local catalog as software source

1. Clean up old and unavailable configurations

[root@svr7 ~]# mkdir /etc/yum.repos.d/oldrepo

[root@svr7 ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/oldrepo/ //Disable unavailable repositories to avoid interference 2. Add new software sources and point to the repositories Directory file:///repo/cos7dvd [root@svr7 ~]# yum-config-manager --add-repo file:///repo/cos7dvd…… //Create configuration file

[root@svr7 ~]# vim /etc/yum.conf

…… Gpgcheck = 0 //Cancel software signature check and clean up yum cache data

[root@svr7 ~]# yum clean all … …

Cleaning up everything

Cleaning up list of fastest mirrors List software warehouse list, confirm the result

[root@svr7 ~]# yum repolist … …

Source identification source name status

repo_cos7dvd added from: file:///repo/cos7dvd 3,831

repolist: 3,831 Step 2: Turn off selinux and firewall

setenforce 0

vim /etc/selinux/config #SELINUX=disabled

systemctl stop firewalld.service systemctl disable firewalld.service Step 3: Set up DNS server

Case 1: Prepare BIND configuration

1. Install bind and bind-chroot packages

[root@svr7 ~]# yum -y install bind-chroot bind

… …

2) Check the installation results of these two packages

[root@svr7 ~]# yum list bind bind-chroot 2. Establish the main configuration and manage the tedu.cn area

1) Establish the main configuration file

[root@svr7 ~]# vim /etc/named.conf //Empty the content of the file and edit it again

options {directory “/var/named”; //The default storage location of the address library

};

zone “tedu.cn” {//Define the forward zone type master; //The zone type is master DNS file “tedu.cn.zone”; //Address library file name

}; 2) Perform a grammar check and correct any errors in time

[root@svr7 ~]# named-checkconf /etc/named.conf

[root@svr7 ~]# //No error, no output 3. Establish an address library and provide the following analysis records

1) Establish an address database (!!! 192.168.10.7 is the IP address of this server)

[root@svr7 ~]# cd /var/named/

[root@svr7 ~]# cp -p named.localhost tedu.cn.zone

[root@svr7 ~]#vim tedu.cn.zone

$TTL 1D

@ IN SOA @ rname.invalid. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum

@ NS dns.tedu.cn.

dns.tedu.cn. A 192.168.10.7

zbx.tedu.cn. A 192.168.10.7

www.tedu.cn. A 114.115.116.117 2) Perform a grammar check and correct any errors in time

[root@svr7 ~]# named-checkconf /etc/named.conf

[root@svr7 ~]# cd /var/named/

[root@svr7 named]# named-checkzone tedu.cn tedu.cn.zone

zone tedu.cn/IN: loaded serial 2013090901

OK //Check that no problems are found [root@svr7 ~]#systemctl restart named

[root@svr7 ~]#systemctl enable named

[root@svr7 ~]#host dns.tedu.cn 2. Configure the client and use this DNS as the default DNS server

1) Query www.tedu.cn, the result is 114.115.116.117

[root@svr7 ~]# [root@pc207 ~]# vim /etc/resolv.conf

nameserver 192.168.10.7 [root@pc207 ~]# host www.tedu.cn

www.tedu.cn has address 114.115.116.117 3. When visiting http://zbx.tedu.cn/ from the real machine, you can see the zabbix monitoring platform of the machine (30 points).

1) Deploy zabbix monitoring server

2) Add "inbound traffic" and "outbound traffic" monitoring items for the local network card, and successfully obtain monitoring data

3) Create a monitoring graphic "Network Card Traffic Analysis", you can see the information of "Inbound Traffic" and "Outbound Traffic"

4) When the number of tasks running on this machine exceeds 200, the administrator can receive an alarm email. Experiment 3:

Step 1: Prepare the zabbix platform environment

1. Prepare a CentOS7 virtual machine

Host name: zbx.tedu.cn, IP address: 192.168.10.7/24

Add the local domain name record of zbx.tedu.cn in /etc/hosts

1) Set the host name

hostnamectl set-hostname zbx.tedu.cn //Set the host name 3) Set the local domain name record

vim /etc/hosts //Add local domain name record

… …

192.168.10.7 zbx.tedu.cn #ping zbx.tedu.cn 2. Install and enable the LAMP platform

1) Install the software package

[root@svr7 ~]# yum -y install httpd mariadb-server mariadb \ php php-mysql // install LAMP components

2) Turn on the service

[root@svr7 ~]# systemctl restart httpd mariadb //Start the service

[root@svr7 ~]# systemctl enable httpd mariadb//Set the boot to run automatically 3. Disable firewall and SELinux protection mechanism

1) Turn off the firewall

systemctl stop firewalld //Stop the firewall immediately

systemctl disable firewalld //Prohibit automatic operation on startup 2) Turn off SELinux mechanism

setenforce 0 //Invalidate SELinux

vim /etc/selinux/config //Disable when booting

SELINUX=disabled zabbix installation and initialization 1. Install zabbix related software packages

Method 2: offline installation (winscp software uploads zabbix-server to /root)

#ls /root/zabbix-server/

yum -y install zabbix-server/*.rpm 2. Configure the PHP parsing environment and set the time zone to Asia/Shanghai

vim /etc/httpd/conf.d/zabbix.conf

php_value date.timezone Asia/Shanghai //Set the time zone to Asia/Shanghai

#systemctl restart httpd 3. Initialize the database and connection

1) Create a new zabbix library, authorize user zabbix to access, the password is pwd@123

mysql -uroot -p

m ysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘pwd@123’;

mysql> quit; 2) Import the initial library provided by the zabbix service pack

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -ppwd@123 zabbix 3) Set up the database connection

vim /etc/zabbix/zabbix_server.conf

… …

DBName=zabbix //database name

DBUser=zabbix //database user

DBPassword=pwd@123 //Connection password case 4: zabbix monitoring interface

1. Open zabbix related services

[root@zbx ~]# systemctl restart zabbix-server httpd zabbix-agent //启动服务

[root@zbx ~]# systemctl enable zabbix-server httpd zabbix-agent //Set to self-run after booting 2. Restart httpd website service

[root@zbx ~]# systemctl restart httpd 3. Visit the web interface and follow the prompts to complete the initial settings

Set up the database connection (library name zabbix, user name zabbix, password pwd@123)

Finally, you can successfully see the login interface

Real machine visit http://192.168.10.7/zabbix/ Admin zabbix change to Chinese zabbix_get -s 127.0.0.1 -k "net.if.in[nes33]"

cp /usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc /usr/share/zabbix/fonts/graphfont.ttf 4. Database operation and backup (40 points). 1) Change the password of mariadb user root to pwd@123, and delete the user whose password is empty

2) Add a database user ctoking, which allows it to access from the client computers on the 192.168.10.0/24 network segment, has all permissions to all databases, and the password is tedu.cn12

3) Modify the password of zabbix management user Admin by operating the database and set it to tedu.cn12

4) Import the material sdyx.sql into the sdyx library, and use SQL operations to complete the following tasks: find out the names and annual income of employees whose annual income is between 1 million and 3 million in the staff table; the residence address in the statistical staff table contains The number of trainees in "Western Region" or "Donghai"; increase the annual salary of the employee named "Huang Rong" by 30% 5) Back up the databases zabbix and sdyx as /root/zabbix+sdyx.sql Experiment 4:

vim /etc/my.cnf

character_set_server=utf8

systemctl restart mariadb

systemctl enable mariadb

mysqladmin -uroot password ‘pwd@123’

mysql -uroot -ppwd@123

delete from mysql.user where password=’’; GRANT all ON . TO ctoking@‘192.168.10.*/24’ IDENTIFIED BY ‘tedu.cn1234’;

exit;

echo -n tedu.cn1234 | openssl md5

mysql -uroot -ppwd@123

update zabbix.users set passwd=’’ where alias=‘Admin’; create database sdyx;

quit;

mysql -uroot -ppwd@123 sdyx < /root/sdyx.sql

mysql -uroot -ppwd@123

use sdyx

select name, annual income from staff where annual income between 1000000 and 3000000;

select count(*) as the number of students from staff where residential address like'%东海%' or residential address like'%西域%';

update staff set annual income=annual income*1.3 where name='Huang Rong';

quit; mysqldump -uroot -ppwd@123 --databases zabbix sdyx > /root/zabbix+sdyx.sql

Introduction

This information is very comprehensive and detailed, covering almost every aspect of Linux basic learning , from common Linux commands to common Linux operations , to network management and performance optimization . It is very suitable for beginners to get started!

The information is also organized by table of contents, with more specific content below each chapter:

image.png

Love it!  The PDF version of Linux notes summarized by Huawei engineers is available for download for a limited time

Moreover, this information is not a scanned version, the text inside can be copied directly, which is very convenient for us to learn:

image.png

Love it!  The PDF version of Linux notes summarized by Huawei engineers is available for download for a limited time

How to obtain complete information: You can click here to get the advanced channel.

Guess you like

Origin blog.csdn.net/weixin_45136579/article/details/109183106