Dns,mariadb. Mail service
# Auxiliary dns and its automatic synchronous encryption
Main dns end
[root@localhost ~] # hostnamectl set-hostname dns-server
Slave end
[root@localhost ~] # hostnamectl set-hostname dns-slave
[root@dns-slave ~] # yum install bind-y # install dns service software
[root@dns-slave ~] # vim / etc/named.conf # configure dns main configuration file
[root@dns-slave ~] # vim / etc/named.rfc1912.zones # configure DNS subprofile
Main dns end
[root@dns-server named] # vim / etc/named.rfc1912.zones
[root@dns-server named] # systemctl restart named
Slave end
[root@dns-slave named] # firewall-cmd-add-service=dns-permanent
Success
[root@dns-slave named] # firewall-cmd-- reload
Success
[root@dns-slave named] # setenforce 0
[root@dns-slave named] # systemctl enable named.service
Ln-s'/ usr/lib/systemd/system/named.service''/ etc/systemd/system/multi-user.target.wants/named.service'
[root@dns-slave named] # systemctl restart named
[root@dns-slave named] # vim / etc/resolv.conf # configure dns to point to native ip to test whether the secondary dns is successful
Nameserver 172.25.254.16
[root@dns-slave named] # dig www.westos.com # # testing
Success
# automatically synchronize the main dns
Main dns end
[root@dns-server named] # vim / etc/named.rfc1912.zones
(also-notify {;};) # notify a dns server that it has changed its dns information
[root@dns-server named] # vim westos.com.zone # set the series value
[root@dns-server named] # systemctl restart named
Auxiliary DNS terminal
[root@dns-slave named] # systemctl restart named
[root@dns-slave slaves] # dig www.westos.com
Secondary dns domain name resolution has been synchronized
# remotely change the main dns
Main dns end
[root@dns-server named] # vim / etc/named.rfc1912.zones # set the host ip that is allowed to update the dns data of this server
[root@dns-server named] # ll-d / var/named/
Drwxr-x---. 5 root named 4096 Dec 1 00:33 / var/named/
[root@dns-server named] # chmod 770 / var/named/ # give / var/named/ folder group rwx permission to allow updates
[root@dns-server named] # systemctl restart named
Auxiliary DNS terminal
Updated successfully
# encryption
Main dns end
[root@dns-server named] # dnssec-keygen-a HMAC-MD5-b 128-n HOST westos # make a key that conforms to the encryption mode of bind software
[root@dns-server mnt] # cp-p / etc/rndc.key / etc/westos.key
[root@dns-server mnt] # cat / mnt/Kwestos.+157+32233.private
# (Private-key-format: v1.3
Algorithm: 157 (HMAC_MD5)
Key: PCQtwlJGxXyx1aiyKmpxsA==
Bits: AAA=
Created: 20161201060243
Publish: 20161201060243
Activate: 20161201060243
#)
[root@dns-server mnt] # vim / etc/westos.key # copy key content and paste it into / etc/westos.key file
[root@dns-server mnt] # vim / etc/named.conf
[root@dns-server mnt] # vim / etc/named.rfc1912.zones
[root@dns-server mnt] # systemctl restart named
[root@dns-server mnt] # scp Kwestos.+157+32233.* root@172.25.254.16:/mnt # copy the key to the remote host side that allows updates
Auxiliary DNS terminal
[root@dns-slave mnt] # nsupdate-k Kwestos.+157+32233.private
The test succeeded
# dns automatic update synchronization
Configure the dhcp service
Modify domain name resolution data in dns file
Auxiliary DNS terminal
[root@dns-slave mnt] # systemctl restart network
[root@dns-slave mnt] # dig music.westos.com
Restart the network test successfully
Main dns end
[root@dns-server named] # vim / etc/dhcp/dhcpd.conf
[root@dns-server named] # systemctl restart named
[root@dns-server named] # systemctl restart dhcpd.service
Synchronized end
[root@dns-slave mnt] # systemctl restart network
[root@dns-slave mnt] # dig www.westos.com
Updated successfully
# Database
[root@dns-server named] # yum install mariadb-server.x86_64-y # install database management software
[root@dns-server named] # systemctl stop firewalld.service
[root@dns-server named] # vim / etc/my.cnf
[root@dns-server named] # systemctl start mariadb
[root@dns-server named] # mysql_secure_installation # install the database
Basic use of database
[root@dns-server named] # mysql-uroot-p
Enter password:
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id is 12
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
MariaDB [(none)] > SHOW DATABASES
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
+-+
3 rows in set (0.00 sec)
MariaDB [(none)] > USE mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-A
Database changed
MariaDB [mysql] > SHOW TABLES
+-+
| | Tables_in_mysql |
+-+
| | columns_priv |
| | db |
| | event |
| | func |
| | general_log |
| | help_category |
| | help_keyword |
| | help_relation |
| | help_topic |
| | host |
| | ndb_binlog_index |
| | plugin |
| | proc |
| | procs_priv |
| | proxies_priv |
| | servers |
| | slow_log |
| | tables_priv |
| | time_zone |
| | time_zone_leap_second |
| | time_zone_name |
| | time_zone_transition |
| | time_zone_transition_type |
| | user |
+-+
24 rows in set (0.00 sec)
MariaDB [mysql] > SELECT * FROM user
+-- + -+- -+ -+-+-- +- -- +-- +-+
| | Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | | | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string |
+-- + -+- -+ -+-+-- +- -- +-- +-+
| | localhost | root | * 28C1E2BE21B45562A34B6CC34A19CFAFC2F88F96 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | 0 | 0 | 0 | 0 | 0 | 0 |
| | 127.0.0.1 | root | * 28C1E2BE21B45562A34B6CC34A19CFAFC2F88F96 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | 0 | 0 | 0 | 0 | 0 |
| |:: 1 | root | * 28C1E2BE21B45562A34B6CC34A19CFAFC2F88F96 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | 0 | 0 | 0 | 0 | Y |
+-- + -+- -+ -+-+-- +- -- +-- +-+
3 rows in set (0.01sec)
MariaDB [mysql] > SELECT Host,User,Password FROM user
+-- +
| | Host | User | Password | |
+-- +
| | localhost | root | * 28C1E2BE21B45562A34B6CC34A19CFAFC2F88F96 |
| | 127.0.0.1 | root | * 28C1E2BE21B45562A34B6CC34A19CFAFC2F88F96 |
| |:: 1 | root | * 28C1E2BE21B45562A34B6CC34A19CFAFC2F88F96 |
+-- +
3 rows in set (0.00 sec)
MariaDB [mysql] >
# create database westos; # # create a westos database
Use westos
Create table linux (# # create table, username,password field
Username varchar (15) not null
Password varchar (15) not null
ALTER TABLE linux ADD age varchar (4); # add age fields to the linux table
ALTER TABLE linux DROP age # Delete age field
ALTER TABLE linux ADD age VARCHAR (5) AFTER name # # add the field age after the name field
Insert into linux values ('user1','passwd1')
Word = password1
Update linux set password=password ('passwd2') where username=user1; # # Update the user1 password in linux
Delete from linux where username=user1
Grant select on *. * to user1@localhost identified by 'passwd1'; # # authorized user1 password is passwd1
# # adding users
MariaDB [mysql] > CREATE USER westos@localhost identified by 'westos'
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql] > GRANT CREATE on *. * to westos@localhost; # # add permissions to create files for new westos users
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > FLUSH PRIVILEGES
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > REVOKE CREATE on *. * from westos@localhost; # revoke user rights
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)] > DROP USER westos@localhost; # delete users
Query OK, 0 rows affected (0.00 sec)
# if you forget your password, change it
[root@dns-server named] # systemctl stop mariadb.service
[root@dns-server named] # mysqld_safe-- skip-grant-tables &
[3] 12340
[root@dns-server named] # 161201 04:15:42 mysqld_safe Logging to'/ var/log/mariadb/mariadb.log'.
161201 04:15:42 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql
^ C
[root@dns-server named] # kill-9 12340
[root@dns-server named] # mysqld_safe-- skip-grant-tables &
[4] 12534
161201 04:16:29 mysqld_safe Logging to'/ var/log/mariadb/mariadb.log'.
161201 04:16:29 mysqld_safe A mysqld process already exists
[3] Killed mysqld_safe-skip-grant-tables
[root@dns-server named] # mysql-uroot
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id is 1
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
MariaDB [(none)] > UPDATE mysql.user set Password=password ('redhat') WHERE User='root'; # # set the root user password to redhat
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
MariaDB [(none)] > quit
Bye
[4] Exit 1 mysqld_safe-skip-grant-tables
[root@dns-server named] # systemctl start mariadb
[root@dns-server named] # mysql-uroot-predhat # New password changed successfully
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id is 3
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.
# # graphical Management Database
[root@dns-server named] # yum install httpd-y
[root@mariadb ~] # systemctl start httpd
# (you can create files in the / var/www/html/ directory and test whether the httpd service has successfully shared files with a browser
Download phpmyadmin software
[root@mariadb html] # tar-jxf phpMyAdmin-4.6.5.1-all-languages.tar.bz2 # decompress
[root@mariadb html] # mv phpMyAdmin-4.6.5.1-all-languages myadmin
[root@mariadb html] # yum install php.x86_64-y # # install PHP language
[root@mariadb ~] # yum install php-mysql.x86_64-y # install database php
[root@mariadb html] # cd myadmin/
[root@mariadb myadmin] # cp-p config.sample.inc.php config.inc.php
[root@mariadb myadmin] # vim config.inc.php # # configure php file
Test, indicating that the php version is less than 5.5. it can only be used after updating the php version.
# Mail Service
Set host maillinux,mialwestos
Maillinux end
[root@maillinux ~] # vim / etc/named.rfc1912.zones
[root@maillinux named] # vim westos.com.zone
[root@maillinux named] # cp-p westos.com.zone linux.com.zone
[root@maillinux named] # vim linux.com.zone
[root@mailwestos ~] # vim / etc/postfix/main.cf
Mailwestos end
[root@mailwestos ~] # systemctl restart postfix.service
[root@mailwestos ~] # mail root
Subject: but
Lajsf
Asg
Lasgas
.
EOT
[root@mailwestos ~] # mailq
Mail queue is empty
[root@mailwestos] # mail-u root
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/mail/root": 1 message 1 new
N 1 root Thu Dec 1 06:22 20amp 557 "but"
& 1
Message 1:
From root@westos.com Thu Dec 1 06:22:20 2016
Return-Path:
X-Original-To: root
Delivered-To: root@westos.com
Date: Thu, 01 Dec 2016 06:22:19-0500
To: root@westos.com
Subject: but
User-Agent: Heirloom mailx 12.5 7-5-10
Content-Type: text/plain; charset=us-ascii
From: root@westos.com (root)
Status: R
Lajsf
Asg
Lasgas # test succeeded
Maillinux end
[root@maillinux named] # vim / etc/postfix/main.cf
(change westos to linux, and the rest of the configuration is the same
# different hosts send and receive each other
[root@mailwestos ~] # vim / etc/resolv.conf
Nameserver 172.25.254.116
[root@mailwestos ~] # mail root@linux.com
Subject: seed
Alsdfj
Asdfh
.
EOT
[root@maillinux named] # mail-u root
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/mail/root": 2 messages 1 new 2 unread
U 1 root Thu Dec 1 06:32 21amp 556 "yes"
> N2 root Thu Dec 1 06:35 22amp 746 "seed" # tested successfully
&
Set mail user alias
[root@mailwestos ~] # vim / etc/aliases
[root@mailwestos ~] # postalias / etc/aliases
[root@mailwestos ~] # systemctl restart postfix.service
[root@mailwestos ~] # mail admin@westos.com # to set an alias to send mail
Subject: hhh
Alsdjf
Al;sjdf
.
EOT
[root@mailwestos] # mail-u root
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/mail/root": 2 messages 1 new
1 root Thu Dec 1 06:22 21amp 568 "but"
> N2 root Thu Dec 1 06:52 19amp 567 "hhh" # received successfully with the set alias user name
# # (if you set more to send in groups, you can edit the aliases file and add more:: include:/etc/moreusers
And edit the file setting name
# hide the address of the email sender
[root@mailwestos postfix] # vim generic
[root@mailwestos postfix] # postconf-e "smtp_generic_maps = hash:/etc/postfix/generic"
# encrypting address translation files
[root@mailwestos postfix] # postmap / etc/postfix/generic
[root@mailwestos postfix] # systemctl restart postfix.service
[root@mailwestos postfix] # mail root@linux.com # send email to linux.com to test
Subject: hash
Alsjfd
Alsj
.
EOT
Linx.com end
Message 3:
From superbike@sina.com Thu Dec 1 07:25:55 2016
Return-Path:
X-Original-To: root@linux.com
Delivered-To: root@linux.com
Date: Thu, 01 Dec 2016 07:25:55-0500
To: root@linux.com
Subject: hash
User-Agent: Heirloom mailx 12.5 7-5-10
Content-Type: text/plain; charset=us-ascii
From: superbike@sina.com (root) # Test succeeded
# remote operation of mail
[root@mailwestos ~] # yum search telnet
[root@mailwestos] # telnet 172.25.254.116 25
Trying 172.25.254.116...
Connected to 172.25.254.116.
Escape character is'^]'.
220 maillinux.linux.com ESMTP Postfix
Mail from:root@linux.com
250 2.1.0 Ok
Rcpt to:root@westos.com
250 2.1.5 Ok
Data
354 End data with.
123456 +
Al;jdsfl
Aljdfalsjfdl;sdjf
.
2502.0.0 Ok: queued as 7B15326CD4B # sent successfully