CentOS7 编译安装snmpd,解决与与Mariadb10冲突问题
CentOS7安装了MariaDB10以后,无法使用yum安装snmp服务,会提示mariadb-libs与mariadb-common 10的冲突提示。翻墙在谷歌上查到有人说在特定版本的mariadb上fix了这个bug,但是不是全版本通用,所以很麻烦。
最后测试可以通过编译安装snmp解决这个问题。记录如下:
1、准备环境
yum -y installmake gcc gcc-c++ gcc-g77 openssl openssl-devel
2、编译和安装
首先我们需要下载Net-SNMP的源代码,
官方地址:
http://sourceforge.net/projects/net-snmp/files/net-snmp/
下载:net-snmp-5.7.3.tar.gz
接下来对下载的源代码包进行解压缩,
tar xzvfnet-snmp-5.7.3.tar.gz
然后通过configure来生成编译规则,
cdnet-snmp-5.7.3
./configure \
--prefix=/usr/local/snmp \
--with-mib-modules=ucd-snmp/diskio\
--with-default-snmp-version="2" \
--with-sys-contact=Robin \
--with-sys-location="shanghai"\
--with-logfile="/server/snmp/log/snmpd.log"\
--with-persistent-directory="/var/net-snmp"
注意,以上的
--with-mib-modules=ucd-snmp/diskio
选项,可以让服务器支持磁盘I/O监控。
回车出现下面问题,可以直接回车而不用回答,系统会采用默认信息,其中日志文件默认安装在/var/log/snmpd.log.数据存贮目录默认存放在/var/net-snmp下。
配置默认snmp协议版本(1,2c,3),配置为v3版的话,支持登录验证功能,相对来说更安全了
--with-default-snmp-version="2"
配置该设备的联系人信息,也可以是邮箱地址
--with-sys-contact=robin
配置该系统设备的地理位置
--with-sys-location="shanghai"
配置日志文件位置
--with-logfile="/server/snmp/log/snmpd.log"
配置数据存储目录
--with-persistent-directory="/var/net-snmp"
接下来,开始编译和安装:
make&& make install
到现在为止,我们已经有了可以运行的SNMP代理程序,它位于/server/snmp/sbin/snmpd,在启动它之前,我们还要进行一些必要的设置。
当然,路径什么的,可以根据需要调整。
3.创建并配置snmp配置文件
Vi/etc/snmpd/snmpd.conf #创建并编辑snmpd配置文件
代码如下:
###############################################################################
#
# EXAMPLE.conf:
# An example configuration file forconfiguring the ucd-snmp snmpd agent.
#
###############################################################################
#
# This file isintended to only be an example. If,however, you want
# to use it, itshould be placed in /usr/local/net-snmp/etc/snmp/snmpd.conf.
# When the snmpdagent starts up, this is where it will look for it.
#
# You might beinterested in generating your own snmpd.conf file using
# the"snmpconf" program (perl script) instead. It's a nice menu
# based interface towriting well commented configuration files. Try it!
#
# Note: This file isautomatically generated from EXAMPLE.conf.def.
# Do NOT read theEXAMPLE.conf.def file! Instead, after you have run
# configure &make, and then make sure you read the EXAMPLE.conf file
# instead, as itwill tailor itself to your configuration.
# All linesbeginning with a '#' are comments and are intended for you
# to read. All other lines are configuration commandsfor the agent.
#
# PLEASE: read thesnmpd.conf(5) manual page as well!
#
###############################################################################
# Access Control
###############################################################################
# YOU SHOULD CHANGETHE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY
# KNOWN AT YOURSITE. YOU *MUST* CHANGE THE NETWORKTOKEN BELOW TO
# SOMETHINGREFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.
# By far, the mostcommon question I get about the agent is "why won't
# it work?",when really it should be "how do I configure the agent to
# allow me to accessit?"
#
# By default, theagent responds to the "public" community for read
# only access, ifrun out of the box without any configuration file in
# place. The following examples show you other ways ofconfiguring
# the agent so thatyou can change the community names, and give
# yourself writeaccess as well.
#
# The followinglines change the access permissions of the agent so
# that the COMMUNITYstring provides read-only access to your entire
# NETWORK (EG:10.10.10.0/24), and read/write access to only the
# localhost(127.0.0.1, not its real ipaddress).
#
# For moreinformation, read the FAQ as well as the snmpd.conf(5)
# manual page.
####
# First, map thecommunity name (COMMUNITY) into a security name
# (local andmynetwork, depending on where the request is coming
# from):
# sec.name source community
#com2sec mynetwork 127.0.0.1 public
com2sec mynetwork default public
#com2sec mynetwork 60.195.252.107 public
#com2sec mynetwork 60.195.252.110 public
####
# Second, map thesecurity name into a group name:
# groupName securityModel securityName
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
group my_group v1 mynetwork
group my_group v2c mynetwork
####
# Third, create aview for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fastagain.
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
view all included .1 80
####
# Finally, grant thegroup read-only access to the systemview view.
# group context sec.model sec.level prefixread write notif
#access notConfigGroup "" any noauth exact systemview none none
access my_group "" any noauth exact all none none
#-----------------------------------------------------------------------------
4.创建snmp服务
进入源码目录,如/usr/local/src/net-snmp-5.7.3目录,将启动配置文件范例复制到/etc/init.d/目录:
cp/usr/local/src/net-snmp-5.7.3/dist/snmpd-init.d /etc/init.d/snmpd
修改/etc/init.d/snmpd文件
将其中的
vi /etc/init.d/snmpd
prog="/usr/local/sbin/snmpd"
修改为
prog="/usr/local/snmp/sbin/snmpd"
将其中的
[ -x $prog -a -f/usr/local/share/snmp/snmpd.conf ] || exit 0
修改为
[ -x $prog -a -f/etc/snmp/snmpd.conf ] || exit 0
groupaddsnmp #添加apache用户组及用户
useradd -g snmp -s/usr/sbin/nologin apache
chown -R snmp:snmp/usr/local/apache2
chmod +x/etc/init.d/snmpd
chkconfig--add snmpd #增加执行权限
chkconfig--level 2345 snmpd on #设置开机启动
chkconfig--list snmpd #查看是否设置成功
snmpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
5.配置snmpd服务启动
systemctlenable snmpd #设置开机启动
systemctlstart snmpd #启动snmpd服务
其他的不多说了
CentOS7 编译安装snmpd,解决与与Mariadb10冲突问题相关推荐
- Centos7 编译安装git 报错 git-compat-util.h:14:2: error
Centos7 编译安装git 报错 git-compat-util.h:14:2: error 环境: OS:CentOS7.9 Git版本: git-2.38.1 一.报错现象 [root@077 ...
- CentOS7 编译安装 gcc/c++ 9.1
目录 文章目录 目录 CentOS7 编译安装 gcc/c++ 9.1 CentOS7 编译安装 gcc/c++ 9.1 $ yum -y install bzip2 $ yum -y install ...
- linux教程:通过编译安装ansible解决apt install ansible后无法安装AWX的莫名问题
通过编译安装ansible解决apt install ansible后无法安装AWX的莫名问题 通过apt install ansible安装的ansible无法正常部署AWX(ansible的一个w ...
- centos7下安装python3 解决openssl等一系列问题
centos7下安装python3 解决openssl等一系列问题 参考文章: (1)centos7下安装python3 解决openssl等一系列问题 (2)https://www.cnblogs. ...
- CentOS7编译安装keepalived实现自动漂移、高可用及开机启动
CentOS7编译安装keepalived实现自动漂移.高可用及开机启动 一.先安装依赖包 [root@haoding205-jq1 hd205]# yum install -y epel-relea ...
- centOS7编译安装openssl并使用C接口
centOS7编译安装openssl并使用C接口. 1.编译安装: 下载OpenSSL安装包 sudo wget http://www.openssl.org/source/openssl-1.1.0 ...
- rpm、yum、编译安装轻松解决centos7程序包安装
撸了今年阿里.头条和美团的面试,我有一个重要发现.......>>> 程序包管理器之RPM 一.rpm是什么 RPM 是RPM Package Manager(RPM软件包管理器)的 ...
- 开发人员学Linux(8):CentOS7编译安装Subversion及Apache并集成
1.前言 本篇将介绍如何编译安装SVN服务器端管理软件subverion和Web服务器Apache.本来在前面的系列文章已经讲过使用Nginx作为Web服务器的,所以我一直在找有关subverion集 ...
- Centos7编译安装Xen环境(vtpm)
编译xen环境(http://www.lvtao.net/server/574.html#comment-1882): yum update yum groupinstall "Develo ...
最新文章
- 鱼佬:从数据竞赛到工作!
- 牛客练习赛39 B:选点(二叉树遍历+LIS)
- DNN(DotNetNuke)研究资源
- 计算机语言翻译的情诗,聂鲁达情诗翻译
- web安全攻防演练网站 靶机 测试环境 收集
- 浅析SEO优化中标签的作用?
- extjs多选下拉树
- 对于asp.net服务器推送和客户端拉拽技术知识讲述
- Android 四大组件 之 BroadcastReceiver(广播接收者)
- 【CF】438E. The Child and Binary Tree
- 找不到任何设备驱动程序.请确保安装介质_win10安装完全手册,详细全面,新手必备...
- Intel/Nvidia双显卡笔记本用U盘安装ubuntu和Nvidia驱动
- 2021年软件测试工具总结——接口测试工具
- uboot 1.1.6 移植8900网卡+tftp
- Exploitation and Exploration
- 网络--VLAN知识详解
- PHP获取真实客户端的真实IP
- ubuntu安装xcode包_Ubuntu12.04 安装 Mac OSX 10.9.5和 Xcode 6.2
- [转]无需看到你的脸就能认出你——实现Beyond Frontal Faces: Improving Person Recognition Using Multiple Cues...
- 金融结构对技术创新的影响效应 及其区域差异研究(马 微 惠 宁)
热门文章
- ps 基础 裁剪工具 修复工具 图章工具
- 苹果手机怎么备份所有数据_怎么把旧手机的东西导入新手机?苹果手机数据迁移的几种方法...
- java计算机毕业设计大学生社团管理系统源码+数据库+系统+lw文档+部署
- user_jj两条记录改成一条
- php:输入值/表单提交参数过滤,防止sql注入或非法攻击的方法
- 新版发布:大数据应用开发管理集成框架DataSphere Studio 1.1.0
- Unity 滚轮实现UGUI ScrollView的缩放
- 12306余票查询(三)——获取余票票价
- AUV路径跟踪视线法(Line Of Sight)制导原理
- 用户画像常见应用场景+技术实现