概述

服务器需要发告警邮件

查找是否已安装

[root@C8-1 ~]# type mail
-bash: type: mail: not found
[root@C8-1 ~]# which mailx
/usr/bin/which: no mailx in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

查看yum信息

[root@C8-1 ~]# yum info mail
Last metadata expiration check: 0:09:24 ago on Sat 20 Jun 2020 06:21:53 PM EDT.
Error: No matching Packages to list
[root@C8-1 ~]# yum info mailx
Last metadata expiration check: 0:09:32 ago on Sat 20 Jun 2020 06:21:53 PM EDT.
Available Packages
Name : mailx
Version : 12.5
Release : 29.el8
Architecture : x86_64
Size : 257 k
Source : mailx-12.5-29.el8.src.rpm
Repository : BaseOS
Summary : Enhanced implementation of the mailx command
URL : http://heirloom.sourceforge.net/mailx.html
License : BSD with advertising and MPLv1.1
Description : Mailx is an enhanced mail command, which provides the functionality
: of the POSIX mailx command, as well as SysV mail and Berkeley Mail
: (from which it is derived).
:
: Additionally to the POSIX features, mailx can work with Maildir/ e-mail
: storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
: protocols (including over SSL) to operate with remote hosts, handles mime
: types and different charsets. There are a lot of other useful features,
: see mailx(1).
:
: And as its ancient analogues, mailx can be used as a mail script language,
: both for sending and receiving mail.
:
: Besides the "mailx" command, this package provides "mail" and "Mail"
: (which should be compatible with its predecessors from the mailx-8.x source),
: as well as "nail" (the initial name of this project).

直接yum安装

[root@C8-1 ~]# yum info mailx
Last metadata expiration check: 0:09:32 ago on Sat 20 Jun 2020 06:21:53 PM EDT.
Available Packages
Name : mailx
Version : 12.5
Release : 29.el8
Architecture : x86_64
Size : 257 k
Source : mailx-12.5-29.el8.src.rpm
Repository : BaseOS
Summary : Enhanced implementation of the mailx command
URL : http://heirloom.sourceforge.net/mailx.html
License : BSD with advertising and MPLv1.1
Description : Mailx is an enhanced mail command, which provides the functionality
: of the POSIX mailx command, as well as SysV mail and Berkeley Mail
: (from which it is derived).
:
: Additionally to the POSIX features, mailx can work with Maildir/ e-mail
: storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
: protocols (including over SSL) to operate with remote hosts, handles mime
: types and different charsets. There are a lot of other useful features,
: see mailx(1).
:
: And as its ancient analogues, mailx can be used as a mail script language,
: both for sending and receiving mail.
:
: Besides the "mailx" command, this package provides "mail" and "Mail"
: (which should be compatible with its predecessors from the mailx-8.x source),
: as well as "nail" (the initial name of this project). [root@C8-1 ~]# yum -y install mailx
Last metadata expiration check: 0:10:34 ago on Sat 20 Jun 2020 06:21:53 PM EDT.
Dependencies resolved.
======================================================================================================================================
Package Architecture Version Repository Size
======================================================================================================================================
Installing:
mailx x86_64 12.5-29.el8 BaseOS 257 k Transaction Summary
======================================================================================================================================
Install 1 Package Total download size: 257 k
Installed size: 491 k
Downloading Packages:
mailx-12.5-29.el8.x86_64.rpm 2.2 MB/s | 257 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------
Total 160 kB/s | 257 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mailx-12.5-29.el8.x86_64 1/1
Running scriptlet: mailx-12.5-29.el8.x86_64 1/1
Verifying : mailx-12.5-29.el8.x86_64 1/1 Installed:
mailx-12.5-29.el8.x86_64 Complete!

安装好啦

[root@C8-1 ~]# type mail
mail is hashed (/usr/bin/mail)
[root@C8-1 ~]# rpm -qf /usr/bin/mail
mailx-12.5-29.el8.x86_64

在目录中配置smtp信息

[root@C8-1 ~]# cat .mailrc
set from=2……0@qq.com #邮箱地址
set smtp=smtp.qq.com #smtp服务器信息
set smtp-auth-user=2……0@qq.com #登录用户名
set smtp-auth-password=e……f #邮箱密码
set smtp-auth=login
set ssl-verify=ignore

发送邮件

[root@C8-1 ~]# echo "FBI Warning" | mail -s hellow 1……7@qq.com

华丽丽的收到邮件了

CentOS8安装本地mail工具-mailx-12.5-29.el8.x86_64的更多相关文章

  1. CentOS8安装VirtualBox,并创建CentOS虚拟机

    安装VirtualBox 执行以下命令并启用VirtualBox和EPEL包仓库 [root@localhost~] dnf config-manager --add-repo=https://dow ...

  2. eclipse安装反编译工具

    身为一名程序员来说,日常最常做的就是编写代码和查看别人写好的源代码了,有时候打开别人写的class文件发现根本不是自己想要的,所以给大家介绍一种eclipse中反编译class文件的工具. 第一步:下 ...

  3. Ubuntu14.04安装和配置Tomcat8.0.12(转)

    Ubuntu14.04长的好看,所以一时间很感兴趣,研究各种软件的安装和开发环境的配置.今天先把安装的tomcat 8.0.12的教程分享给大家.如果你需要,请收藏!!!   工具/原料 系统环境:U ...

  4. Oracle 客户端安装 + pl/sql工具安装配置

    Oracle 客户端安装 +  pl/sql工具安装配置 下载oracle客户端,并在本地安装. 11g下载地址为: http://www.oracle.com/technetwork/databas ...

  5. 下破解安装Python开发工具WingIDE4.1

    步骤: 1.将系统时间调整到一个月之前,然后执行安装. 可以使用date命令调整系统时间,如:date -s '2012-08-14 10:00:00' 2.安装成功后,打开程序,按照提示信息,申请一 ...

  6. 安装旧版的docker-engine-1.12.6

    执行kubeadm init --api-advertise-addresses=172.16.160.211命令的时候,提示docker版本太新了 想要安装旧版docker,可以使用以下方法: yu ...

  7. Navicat Premium 12.0.29 / 12.1.5.0安装与激活

    转自:https://www.jianshu.com/p/5f693b4c9468 本文介绍Navicat Premium 12.0.29和Navicat Premium 12.1.5.0的安装.激活 ...

  8. Zookeeper Windows版的服务安装和管理工具

    以前研究过负载均衡,最近正在项目上实施(从来没做过小项目以上级别的东西,哈).然后遇到了多个一模一样但是同时运行的服务.不同服务但依赖同相同的配置数据(前端网页服务:Nginx+IIS+nodejs. ...

  9. Java基础-Eclipse第三方安装包管理工具之Maven

    Java基础-Eclipse第三方安装包管理工具之Maven 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 玩过Linux的小伙伴应该都知道yum吧,我们只要把搭建好的yum仓库配 ...

随机推荐

  1. 《C语言进阶剖析》课程目录

    <C语言进阶剖析>学习笔记                                                         本文总结自狄泰软件学院唐佐林老师的<C语言 ...

  2. ASP.NET Core 3.x启动时运行异步任务(一)

    这是一个大的题目,需要用几篇文章来说清楚.这是第一篇.   一.前言 在我们的项目中,有时候我们需要在应用程序启动前执行一些一次性的逻辑.比方说:验证配置的正确性.填充缓存.或者运行数据库清理/迁移等 ...

  3. 分布式系统监视zabbix讲解五之web监控

    Web 监控 概况 你可以使用 Zabbix 检查几个网站可用性方面. 如果要使用 Web 检测功能,必须在 编译Zabbix 的时候加入 cURL(libcurl) 的支持. 要使用 Web 监控, ...

  4. defer 延迟调用

    1. 延迟调用 defer 的用法很简单,只要在后面跟一个函数的调用,就能实现将这个  xxx 函数的调用延迟到当前函数执行完后再执行. defer xxx()   这是一个很简单的例子,可以很快帮助 ...

  5. 栈帧的内部结构--动态链接 (Dynamic Linking)

    每个栈帧中包含: 局部变量表(Local Variables) 操作数栈(Opreand Stack) 或表达式栈 动态链接 (Dynamic Linking) (或指向运行时常量的方法引用) 动态返 ...

  6. 刷题[GXYCTF2019]BabySQli

    解题思路 只有一个登陆框,查看源码,链接到search.php后发现注释中有这样一段内容 MMZFM422K5HDASKDN5TVU3SKOZRFGQRRMMZFM6KJJBSG6WSYJJWESSC ...

  7. PHP正则表达式核心技术完全详解 第2节

    作者:极客小俊 一个专注于web技术的80后 我不用拼过聪明人,我只需要拼过那些懒人 我就一定会超越大部分人! CSDN@极客小俊,原创文章, B站技术分享 B站视频 : Bilibili.com 个 ...

  8. 原创-公司项目部署交付环境预检查shell脚本

    大型项目环境预检查脚本,根据自己实际情况修改脚本中变量,给大家一个思路~ #!/usr/bin/env bash root=$( cd $(dirname $0) pwd ) source " ...

  9. java整合Elasticsearch,实现crud以及高级查询的分页,范围,排序功能,泰文分词器的使用,分组,最大,最小,平均值,以及自动补全功能

    //为index创建mapping,index相当于mysql的数据库,数据库里的表也要给各个字段创建类型,所以index也要给字段事先设置好类型: 使用postMan或者其他工具创建:(此处我使用p ...

  10. 大话Python函数底层逻辑

    函数 叫 子过程或子程序 描叙的更为贴近实际应用场景 这和数学中的函数实现上不同但语义上相识,如 f(x) = expressiom, 给定一个确定的输入必然返回一个确定的输出 数学中函数的关系是通过 ...