dns,mariadb.邮件服务

####################辅助dns及其自动同步 加密
主dns端
[[email protected] ~]# hostnamectl set-hostname dns-server
slave端
[[email protected] ~]# hostnamectl set-hostname dns-slave
[[email protected] ~]# yum install bind -y      ###安装dns服务软件
[roo[email protected] ~]# vim /etc/named.conf      ####配置dns主配置文件

[[email protected] ~]# vim /etc/named.rfc1912.zones  ###配置dns子配置文件

主dns端
[[email protected] named]# vim /etc/named.rfc1912.zones

[[email protected] named]# systemctl restart named
slave端
[[email protected] named]# firewall-cmd --add-service=dns --permanent
success
[[email protected] named]# firewall-cmd --reload
success
[[email protected] named]# setenforce 0
[[email protected] named]# systemctl enable named.service
ln -s ‘/usr/lib/systemd/system/named.service‘ ‘/etc/systemd/system/multi-user.target.wants/named.service‘
[[email protected] named]# systemctl restart named
[[email protected] named]# vim /etc/resolv.conf   ###配置dns指向为本机ip,以测试辅助dns是否成功
 nameserver 172.25.254.16
[[email protected] named]# dig www.westos.com  ###测试
 成功

#####自动同步主dns
主dns端
[[email protected] named]# vim /etc/named.rfc1912.zones

(also-notify{ ;};)     ####通知某dns服务器自己改变了dns信息
[[email protected] named]# vim westos.com.zone   ###设定serial值

[[email protected] named]# systemctl restart named
辅助dns端
[[email protected] named]# systemctl restart named
[[email protected] slaves]# dig www.westos.com

辅助dns域名解析已同步
#######远程更改主dns
主dns端
[[email protected] named]# vim /etc/named.rfc1912.zones    ####设定允许更新本服务器dns数据的主机ip

[[email protected] named]# ll -d /var/named/
drwxr-x---. 5 root named 4096 Dec  1 00:33 /var/named/
[[email protected] named]# chmod 770 /var/named/   ####给/var/named/文件夹组rwx权限,以允许被更新
[[email protected] named]# systemctl restart named
辅助dns端
更新成功
######加密
主dns端
[[email protected] named]# dnssec-keygen -a HMAC-MD5 -b 128 -n HOST westos   ###制作符合bind软件加密方式的密钥
[[email protected] mnt]# cp -p /etc/rndc.key /etc/westos.key
[[email protected] 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
###)
[[email protected] mnt]# vim /etc/westos.key     ###复制key内容并粘贴到/etc/westos.key 文件中

[[email protected] mnt]# vim /etc/named.conf
[[email protected] mnt]# vim /etc/named.rfc1912.zones
[[email protected] mnt]# systemctl restart named
[[email protected] mnt]# scp Kwestos.+157+32233.* [email protected]:/mnt   ###复制钥匙到允许更新的远程主机端
辅助dns端
[[email protected] mnt]# nsupdate -k Kwestos.+157+32233.private
测试成功

####dns自动更新同步
配置dhcp服务

修改dns文件中域名解析数据
辅助dns端
[[email protected] mnt]# systemctl restart network
[[email protected] mnt]# dig music.westos.com
重启网络测试成功

主dns端
[[email protected] named]# vim /etc/dhcp/dhcpd.conf

[[email protected] named]# systemctl restart named
[[email protected] named]# systemctl restart dhcpd.service
被同步端
[[email protected] mnt]# systemctl    restart network
[[email protected] mnt]# dig www.westos.com
更新成功

###################数据库

[[email protected] named]# yum install mariadb-server.x86_64 -y       ###安装数据库管理软件
[[email protected] named]# systemctl stop firewalld.service
[[email protected] named]# vim /etc/my.cnf

[[email protected] named]# systemctl start mariadb
[[email protected] named]# mysql_secure_installation             ####安装数据库
 数据库的基本使用
[[email protected] 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                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             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              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             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                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |        |                       |
+-----------+------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+
3 rows in set (0.01 sec)

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;         ##创建westos数据库
 use westos;                  
 create table linux(             ##创建表, username,password字段
 username varchar(15) not null,
 password varchar(15) not null
 ALTER TABLE linux ADD age varchar(4);     ###添加age字段到linux表中
 ALTER TABLE linux DROP age                ###删除age字段
 ALTER TABLE linux ADD age VARCHAR(5) AFTER name   ##在name字段后添加字段age

insert into linux values (‘user1‘,‘passwd1‘);         
word = password1
update linux set password=password(‘passwd2‘) where username=user1; ##更新linux中user1密码
delete from linux where username=user1;
grant select on *.* to [email protected] identified by ‘passwd1‘;   ##授权user1密码为passwd1
##添加用户
MariaDB [mysql]> CREATE USER [email protected] identified by ‘westos‘;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> GRANT CREATE on *.* to [email protected]; ##为新建westos用户添加创建文件的权限
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 [email protected];   ###撤销用户权限
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> DROP USER [email protected];             ####删除用户
Query OK, 0 rows affected (0.00 sec)
###若忘记密码,更改密码
[[email protected] named]# systemctl stop mariadb.service
[[email protected] named]# mysqld_safe --skip-grant-tables &
[3] 12340
[[email protected] 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
[[email protected] named]# kill -9 12340
[[email protected] 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
[[email protected] 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‘; ##设定root用户密码为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
[[email protected] named]# systemctl start mariadb
[[email protected] named]# mysql -uroot -predhat     ###新密码更换成功
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.

##图形化管理数据库
[[email protected] named]# yum install httpd -y
[[email protected] ~]# systemctl start httpd
  #(可在/var/www/html/目录下创建文件,用浏览器测试httpd服务是否成功共享文件
下载phpmyadmin软件
[[email protected] html]# tar -jxf phpMyAdmin-4.6.5.1-all-languages.tar.bz2  #解压
[[email protected] html]# mv phpMyAdmin-4.6.5.1-all-languages myadmin
[[email protected] html]# yum install php.x86_64 -y   ##安装php语言
[[email protected] ~]# yum install php-mysql.x86_64 -y   ###安装数据库php
[[email protected] html]# cd myadmin/
[[email protected] myadmin]# cp -p config.sample.inc.php config.inc.php
[[email protected] myadmin]# vim config.inc.php          ##配置php文件

测试,提示php版本小于5.5,更新php版本后才可使用

###########邮件服务

设定主机maillinux,mialwestos
maillinux端
[[email protected] ~]# vim /etc/named.rfc1912.zones

[[email protected] named]# vim westos.com.zone

[[email protected] named]# cp -p westos.com.zone linux.com.zone
[[email protected] named]# vim linux.com.zone

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

mailwestos端
[[email protected] ~]# systemctl restart postfix.service
[[email protected] ~]# mail root
Subject: but
lajsf
asg
lasgas
.
EOT
[[email protected] ~]# mailq
Mail queue is empty
[[email protected] ~]# 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  20/557   "but"
& 1
Message  1:
From [email protected]  Thu Dec  1 06:22:20 2016
Return-Path: <[email protected]>
X-Original-To: root
Delivered-To: [email protected]
Date: Thu, 01 Dec 2016 06:22:19 -0500
To: [email protected]
Subject: but
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: [email protected] (root)
Status: R

lajsf
asg
lasgas                           ############测试成功
maillinux端
[[email protected] named]# vim /etc/postfix/main.cf
 (将westos换为linux,其余配置相同
####不同主机之间相互发送接收
[[email protected] ~]# vim /etc/resolv.conf

nameserver 172.25.254.116

[[email protected] ~]# mail [email protected]
Subject: seed
alsdfj
asdfh
.
EOT
[[email protected] 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  21/556   "yes"
>N  2 root                  Thu Dec  1 06:35  22/746   "seed"       ####测试成功
&

设定邮件用户别名
[[email protected] ~]# vim /etc/aliases

[[email protected] ~]# postalias /etc/aliases
[[email protected] ~]# systemctl restart postfix.service
[[email protected] ~]# mail [email protected]         ###以设定别名发送邮件
Subject: hhh   
alsdjf
al;sjdf
.
EOT
[[email protected] ~]# 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  21/568   "but"
>N  2 root                  Thu Dec  1 06:52  19/567   "hhh"   ###用被设定别名用户名接收成功
 ##(若设定更多以群发,可编辑aliases文件,添加more:  :include:/etc/moreusers
     并编辑文件设定名称
###隐藏邮件发送者地址
[[email protected] postfix]# vim generic

[[email protected] postfix]# postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"
                                          ###加密地址转换文件
[[email protected] postfix]# postmap /etc/postfix/generic
[[email protected] postfix]# systemctl restart postfix.service

[[email protected] postfix]# mail [email protected]    ###向linux.com发送邮件以测试
Subject: hash
alsjfd
alsj
.
EOT
linx.com端
Message  3:
From [email protected]  Thu Dec  1 07:25:55 2016
Return-Path: <[email protected]>                     
X-Original-To: [email protected]
Delivered-To: [email protected]
Date: Thu, 01 Dec 2016 07:25:55 -0500
To: [email protected]
Subject: hash
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: [email protected] (root)                         #######测试成功
###远程操作邮件
[[email protected] ~]# yum search telnet
[[email protected] ~]# 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:[email protected]
250 2.1.0 Ok
rcpt to:[email protected]
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
123456+
al;jdsfl
aljdfalsjfdl;sdjf
.
250 2.0.0 Ok: queued as 7B15326CD4B               ###发送成功

时间: 2024-08-03 03:11:57

dns,mariadb.邮件服务的相关文章

《Linux菜鸟入门2》空壳邮件服务

●空壳邮件 1.引入空壳邮件的意义 邮件服务器直接暴露在网络环境下安全性会大大降低,所以引入"空壳服务器"是为了保证真正服务器的安全,空壳服务器的功能就是将受到的邮件转发(双向的). 2.制作空壳邮件 在配置好DNS的前提下: 空壳服务器配置(maillinux.linux.com): vim /etc/named.rfc1912.zones cd /var/named/ cp -p westos.com.zone westos.org.zone vim westos.org.zone

邮件服务配置(虚拟域&虚拟用户)

邮件服务配置(虚拟域&虚拟用户) 本文首发:https://www.somata.work/2019/VirtualMailServerConfig_MariaDB.html 现在我做的是:Linux + httpd + php + mariadb + postfix + dovecot + phpMyAdmin + postfixadmin + roundcubemail 这里我将会讲解 如何制作基于 虚拟域和虚拟用户 的邮件服务.需要的软件如下: phpMyAdmin-3.4.3-all-l

邮件服务

邮件语言:M4 SASL: v2 cyrus-sasl 认证框架 courier-authlib MTA: 邮件传输代理,SMTP服务器 sendmail,  UUCP qmail 数学家当程序员,他写的算法绝对是一流的 postfix 安全.兼容.效率高 exim Exchange (异步消息协作平台) 重量级 MDA: 邮件投递代理 procmail maildrop MRA: 邮件检索代理(pop3, imap4) cyrus-imap dovecot MUA: 邮件用户代理 Outloo

【初学菜鸟作--邮件服务的简单配置案例】

邮件服务器的配置以及使用 实验一:                    实验目的:简单搭建出邮件服务器并测试其可用性                    实验环境:DNS服务器一台,安装有Portfix的邮件服务器一台 实验步骤: 一.邮件的发送(SMTP) 1.在邮件服务器配置主机名,ip,并安装portfix并启动 [[email protected]~]# tail -2 /etc/sysconfig/network HOSTNAME=mail.tarena.com   [[email

编译安装postfix邮件服务

一.安装前的准备 1.邮件服务基本知识: wget http://sourceforge.net/p SMTP:(Simple Mail Transfer Protocol)即简单邮件传输协议 POP3:邮局协议     IMAP4:internet mail access protocol 互联网邮件访问协议 SASL:simple Authentication Secure layer  简单安全认证层 (版本v1,v2目前主流v2版本) MDA:邮件投递代理(procmail,maildr

Linux的postfix邮件服务

一.postfix邮件服务 postfix提供smtp协议用来投递邮件默认端口25/var/log/maillog    服务日志mail [email protected]Subject: hellohello world .                           用"."来结束录入内容并发送mailq                  查看邮件队列postqueue -f      重新处理邮件队列 默认情况下邮件端口只在127.0.0.1上开启 二.环境配置 1.设

Linux搭建Postfix邮件服务

Postfix为何物,详见:http://zh.wikipedia.org/wiki/Postfix 0.关于Postfix postfix的产生是为了替代传统的sendmail.相较于sendmail,postfix在速度,性能和稳定性上都更胜一筹.现在目前非常多的主流邮件服务其实都在采用postfix. 当我们需要一个轻量级的的邮件服务器是,postfix不失为一种选择. 1. postfix是免费的: postfix想要作用的范围是广大的Internet用户,试图影响大多数的Interne

postfix邮件服务

一.postfix介绍1. postfix提供smtp协议用来投递邮件 默认端口25 /var/log/maillog##服务日志 mail [email protected]   ##发送一封邮件 Subject: hello hello world .#用"."来结束录入内容并发送 mailq##查看邮件队列 postqueue -f##重新处理邮件队列 默认情况下邮件端口只在127.0.0.1上开启 二.搭建邮件服务的环境 1.配置两台主机 desktop主机 (1)hostna

企业级邮件服务搭建

背景:两台虚拟机:一台作为邮件服务器(115.179)另一台作为DNS服务器以及客户端(115.175) DNS服务器: 搭建DNS服务器,使之能解析出www.mail域名 安装DNS软件并配置/etc/named.conf./etc/named.rf1912.zones等 DNS服务器搭建好之后,将测试机的DNS指向DNS服务器的IP地址 POSTFIX服务器: 安装gcc yum install -y gcc* 安装数据库以及mailx yum install -y mysql mysql-