Linux System Engineer Technology (Engineer)-------the next day

Source: Internet
Author: User
Tags stdin email account imap port

Two virtual machines, both fire and hostname modified

The firewall modifies the original----------public state---------to-------trusted state

Virtual Machine Server0:

# Firewall-cmd--set-default-zone=trusted?

# echo server0.example.com?>?/etc/hostname

# Cat/etc/hostname


Virtual Machine desktop0:

# Firewall-cmd--set-default-zone=trusted?

# echo desktop0.example.com?>?/etc/hostname

# Cat/etc/hostname


? Basic features of the e-mail server

– Provide users with an e-mail storage space (username @ mail domain name)

– Process user-sent messages-delivered to the receiving server

– Process messages received by users--post to mailbox


? ? ? User e-mail protocol:? SMTP? port 25

? ? ? User receive mail agreement:? POP3? port 110?? IMAP port 143????

? ?

######################################################

Virtual Machine Server0

Building a Basic mail server

1. Installing the Postfix service-side program

[Email protected] ~]# rpm-q postfix

Postfix-2.10.1-6.el7.x86_64


2. Configure the Postfix service, modify the configuration file

[Email protected] ~]# VIM/ETC/POSTFIX/MAIN.CF

? 76 lines? Myhostname = server0.example.com?? #指定主机名

? 83 lines? MyDomain = example.com??????? #指定域名

? 99 lines? Myorigin = server0.example.com?? #默认补全的邮件后缀

? 116 line inet_interfaces = All?????? #允许所有客户端

? 164 rows Mydestination = server0.example.com

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #判断邮件后缀为本域邮件

????: Vim command mode??? u Undo


3. Restart Postfix service, set to boot from

# systemctl restart Postfix??????????????????

# Systemctl enable Postfix?


4. Test Mail Sending and receiving


[Email protected] ~]# Useradd YG

[Email protected] ~]# echo 123 | passwd--stdin YG


[Email protected] ~]# Useradd XLN

[Email protected] ~]# echo 123 | passwd--stdin XLN


? Mail sending operation

–mail-s ' mail header '? -R sender?? recipient


? Mail receive operation

–mail [-u user Name]


[Email protected] ~]# mail-s ' test01 '-R YG? Xln


? There is only one in a row. "."?? when the representative ends

?

[Email Protected]rver0 ~]# mail-u XLN

? Enter message number 1 view message content

? Quit quitting

################################################# ?


Nullclient Mail Service


Empty client

? Nullclient, empty Client

– No email account is available, so no mail is required

– but you can send a message to the user on behalf of



I. Configuring DESKTOP0 as a mail server

1. Configure the Postfix service, modify the configuration file

[Email protected] ~]# VIM/ETC/POSTFIX/MAIN.CF


? 99 line?? myorigin = desktop0.example.com??

? 116 line? inet_interfaces = All??????

? 164 line? mydestination = desktop0.example.com


[Email protected] ~]# systemctl restart Postfix

[Email protected] ~]# Systemctl enable Postfix


Second, configure SERVER0 to be empty client mail server

[Email protected] ~]# vim/etc/postfix/main.cf?


? 99 lines?? Myorigin = desktop0.example.com

? 116 lines? inet_interfaces = localhost

? 164 lines? Mydestination =?

? 317 lines? Relayhost = [172.25.0.10]? #指定交给邮件服务器IP地址

? ?

[Email protected] ~]# systemctl restart Postfix


Third, testing

On the virtual machine Server0

# echo? ABC? |? Mail-s test1-r YG? Student


On the virtual machine desktop0

# Mail-u Student

######################################################

? database service Basics


? A common relational database management system

– Microsoft's SQL Server

–IBM's DB2

– Oracle, MySQL for Oracle

– Community Open Source version MariaDB



? MariaDB related packages in RHEL7

–mariadb-server: Provision of server-side related system programs

???????? Port number: 3306



I. Deployment of the MARIADB database

1. Installing the Mariadb-server database software

[Email protected] ~]# yum-y install Mariadb-server


2. Start the MARIADB service

[Email protected] ~]# systemctl restart MARIADB

[Email protected] ~]# Systemctl enable MARIADB



##################################################


[[email protected] ~]# MySQL?


MariaDB [(None)]> show databases;????? #查看数据库

MariaDB [(None)]> CREATE Database nsd1709;? #创建数据库

MariaDB [(None)]> show databases;?????


MariaDB [(None)]> drop database nsd1709;?? #删除数据库

MariaDB [(None)]> show databases;


MariaDB [(None)]> CREATE Database nsd;??

MariaDB [(None)]> show databases;


MariaDB [(none)]> quit???????????????? #退出数据库


###################################################


? ? ? The database administrator is root, but it does not matter to the system user root


? Change password for database account

–mysqladmin [-u user name] [-p[old password]] password ' new password '


[Email protected] ~]# mysqladmin-u? root? Password? ' 123 '


[[email protected] ~]# MySQL

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)


[email protected] ~]# mysql?-u root?-P

Enter Password:?


[Email protected] ~]# mysql-u root-p123??? #免交互登陆



? Prohibit listening, only serve native-----------------means only to the native service, other users cannot access the database

[Email protected] ~]# vim/etc/my.cnf? #数据库主配置文件

[Mysqld]

Skip-networking???? #跳过网络监听

......

[Email protected] ~]# systemctl restart MARIADB


? MariaDB [(none)]> Interactive Instruction

---------------List database: show databases;

---------------/Select database: Use database name;

--------------lists which tables are in the library: show tables;

--------------Creating database: Create database name;

-----------Delete database: drop database name;




Http://172.25.254.254/pub/materials/users.sql


? Import/Restore to Database

–mysql [-u user name] [-p[password]] Database name?< backup file. sql



# wget Http://172.25.254.254/pub/materials/users.sql

# mysql-u root-p123 NSD < Users.sql


# mysql-u Root-p123


MariaDB [nsd]> use NSD;????? #进入nsd库

MariaDB [nsd]> show tables;??? #查看都有那些表格



######################################################


? query operations

# mysql-u Root-p123

MariaDB [nsd]> use NSD;


MariaDB [nsd]> SELECT * from base;

MariaDB [nsd]> SELECT * from location;


MariaDB [nsd]> Select Id,name from base;


MariaDB [nsd]> SELECT * from base where name= ' Tom ';


MariaDB [nsd]> SELECT * from location where city= ' Beijing ';


#######################################################

? Database authorization


MariaDB [(none)]> Interactive Instruction

–grant permissions list? The database name. Table name? To? user name @localhost

? Identified by ' Password '


?? When the Lisi user logs in from localhost, enter password 123, and the Library NSD all table query permissions


# mysql-u Root-p123


MariaDB [(None)]> Grant Select on nsd.* to [e-mail protected] identified by ' 123 ';


View the user table information in the MARIADB database


MariaDB [mysql]> Select User,password from Mysql.user;


#####################################################

Case 5: Working with database queries


2. Use the database NSD on the system Server0 and use the phase

The SQL query that is expected to answer the following questions:


1) password is the name of the person who solicitous?


> select * from nsd.base where password= ' solicitous ';

> select * from nsd.base where password= ' solicitous ' and? id= ' 3 ';


> select * from nsd.base where name= ' Barbara ' or? id= ' 3 ';


2) How many people's names are Barbara while residing in Sunnyvale?


> Use NSD;


> select * from Base,location

where Base.name= ' Barbara ' and location.city= ' Sunnyvale '? and? Base.id=location.id;


> select COUNT (*) from base,location??

where Base.name= ' Barbara ' and location.city= ' Sunnyvale ' and? Base.id=location.id;


> Insert Base VALUES (6, ' Barbara ', 123456);? #插入表记录

> Insert Location VALUES (6, ' Sunnyvale ');? #插入表记录

> select * from base;

> select * from location;




1. Disable null password root user access to MARIADB database


> Use MySQL;


> select User,host,password from user where password= ' and user= ' root ';


> Delete from user where password= ' and user= ' root ';------Delete with root username and empty password


> select User,host,password from User;


> desc. user;? #查看表结构












Linux System Engineer Technology (Engineer)-------the next day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.