首页 > 系统相关 >Ubuntu24.04安装Librenms

Ubuntu24.04安装Librenms

时间:2024-12-30 11:13:51浏览次数:1  
标签:opt Ubuntu24.04 etc systemctl Librenms conf librenms php 安装

1 安装所需的软件包

apt install acl curl fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php-cli php-curl php-fpm php-gd php-gmp php-json php-mbstring php-mysql php-snmp php-xml php-zip rrdtool snmp snmpd unzip python3-command-runner python3-pymysql python3-dotenv python3-redis python3-setuptools python3-psutil python3-systemd python3-pip whois traceroute
   

2 添加用户

useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
   

3 下载LibreNMS

cd /opt
git clone https://github.com/librenms/librenms.git
   

4 设置权限

chown -R librenms:librenms /opt/librenms
chmod 771 /opt/librenms
setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
   

5 安装PHP相关

su - librenms
./scripts/composer_wrapper.php install --no-dev
exit
   

手动模式

wget https://getcomposer.org/composer-stable.phar
mv composer-stable.phar /usr/bin/composer
chmod +x /usr/bin/composer
   

6 设置时区

vi /etc/php/8.3/fpm/php.ini
vi /etc/php/8.3/cli/php.ini
   

示例: "Asia/Shanghai", "Australia/Brisbane"

同时修改系统时区

timedatectl set-timezone Asia/Shanghai
   

7 设置MariaDB

vi /etc/mysql/mariadb.conf.d/50-server.cnf
   

在 [mysql]区块添加:

innodb_file_per_table=1
lower_case_table_names=0
   

然后重启MariaDB

systemctl enable mariadb
systemctl restart mariadb
   

登入到数据库:

mysql -u root
创
   

建数据库:

CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
exit
   

8 配置PHP-FPM

cp /etc/php/8.3/fpm/pool.d/www.conf /etc/php/8.3/fpm/pool.d/librenms.conf
vi /etc/php/8.3/fpm/pool.d/librenms.conf
   

将[www]改成[librenms]:

[librenms]
   

将 user 和 group 改成 "librenms":

user = librenms
group = librenms
   

将listen改成:

listen = /run/php-fpm-librenms.sock
   

9 配置Web Server

vi /etc/nginx/conf.d/librenms.conf
   

添加如下配置,编辑server_name成实际的域名或者IP:

server {
   
 listen      80;
 server_name librenms.example.com;
 root        /opt/librenms/html;
 index       index.php;

 charset utf-8;
 gzip on;
 gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 location / {
   
  try_files $uri $uri/ /index.php?$query_string;
 }
 location ~ [^/]\.php(/|$) {
   
  fastcgi_pass unix:/run/php-fpm-librenms.sock;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  include fastcgi.conf;
 }
 location ~ /\.(?!well-known).* {
   
  deny all;
 }
}
   
rm /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default
systemctl restart nginx
systemctl restart php8.3-fpm
   

10 Selinux和Firewall

均设置成默认关闭

11 启用lnms命令补全

ln -s /opt/librenms/lnms /usr/bin/lnms
cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/
   

12 配置snmpd

cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
vi /etc/snmp/snmpd.conf
   

将文件中RANDOMSTRINGGOESHERE替换成所需的团体字

curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
chmod +x /usr/bin/distro
systemctl enable snmpd
systemctl restart snmpd
   

13 Cron job

cp /opt/librenms/dist/librenms.cron /etc/cron.d/librenms
   

14 开启调度程序

cp /opt/librenms/dist/librenms-scheduler.service /opt/librenms/dist/librenms-scheduler.timer /etc/systemd/system/

systemctl enable librenms-scheduler.timer
systemctl start librenms-scheduler.timer
   

15 日志配置

cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
   

16 网页安装程序

访问http://librenms.example.com/install进行安装

chown librenms:librenms /opt/librenms/config.php
   

17 最后

通过http://librenms.example.com/访问、设置、使用

标签:opt,Ubuntu24.04,etc,systemctl,Librenms,conf,librenms,php,安装
From: https://www.cnblogs.com/mybook000/p/18640459

相关文章

  • 解决在虚拟机中安装Jupyter Notebook,无法从宿主机防问的问题
    解决方案:主要原因是JupyterNotebook默认绑定到127.0.0.1了默认情况下,JupyterNotebook仅监听127.0.0.1(本地主机),只能在虚拟机内部访问。解决方法:修改JupyterNotebook的启动方式,使其监听虚拟机的网络接口。修改启动命令:jupyternotebook--allow-root--ip=0.0.0.0......
  • Docker compose安装
    1.通过以下命令自动下载并安装适应系统版本的Compose:到:https://github.com/docker/compose/releases/查找最新版release,替换路径的1.10.0curl-L"https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(uname-s)-$(uname-m)"-o/usr/local/bin/......
  • 【亲手实践】本地multipass安装kubernetes,再也不怕环境被铲
    一、安装multipass 1.安装multipaas软件版本brewinstallmultipass 2.创建三个虚拟机master(192.168.64.6)、node1(192.168.64.14)、node2(192.168.64.15),2Gcpu+2G内存+40G硬盘,Qemu+桥连模式   $ multipassfind查找可用ubuntu版本,这里选择22.04这个版本   $ m......
  • 记录:wsl2 安装 CentOS8-stream 安装docker 安装redis-cluster集群 一些步骤及问题
     一。解压  下载的CentOS8-stream.zip压缩包,双击安装   (下载地址记录:wsl2安装centOS7一些问题解决并使用shell工具连接)  二。修改root密码 (安装后直接进入root 不知道密码所以修改)  直接passwd即可修改   三。yumli......
  • LunarVim安装
            LunarVim以其丰富的功能和灵活的定制性,迅速在Nvim用户中流行开来。它不仅提供了一套完善的默认配置,还允许用户根据自己的需求进行深度定制。无论是自动补全、内置终端、文件浏览器,还是模糊查找、LSP支持、代码检测、格式化和调试,LunarVim都能轻松应对。一、安......
  • Linux1-入门及VM,centos安装
    1,重点linux系统简介及特点下载安装开关机2,具体内容2.1linux系统简介:Linux内核最初只是由芬兰人林纳斯·托瓦兹(LinusTorvalds)在赫尔辛基大学上学时(22岁)出于个人爱好而编写的。softwarelikesex;It`sbetterwhenit`sfree;......
  • 2024-12-25《linux上安装redis报错》
     在linux上安装redis时,首先要安装c/c++编译器,然后安装redis,不然redis跑不了,安装时报错:cdsrc&&makeallmake[1]:Enteringdirectory'/opt/redis-7.0.0/src'CCMakefile.depCCserver.oInfileincludedfromserver.c:30:server.h:57:10:fatalerror:systemd......
  • 后台上传后无法进入安装页面
    问题描述:在预装软件并默认安装到 www 目录后,安装成功但无法自动跳转到安装界面。无论是直接输入域名还是附加路径(如 /install),都无法正常进入安装页面,浏览器显示500错误。请帮助排查并解决此问题。解决方案:您好,根据您的描述,可能是由于PHP版本不兼容或环境配置问题导致的500错......
  • sysstat 源码编译安装与配置
    下载cd/usr/local/srcsudowgethttps://github.com/sysstat/sysstat/releases/download/v12.5.7/sysstat-12.5.7.tar.xz解压sudotar-xvfsysstat-12.5.7.tar.xzcdsysstat-12.5.7编译安装mkdir-p/usr/local/sysstatsudo./configure--prefix=/usr/local/sysstatss......
  • Windows11安装Linux子系统(WSL2)
    1、确认BIOS中已经打开虚拟化VirtualizationTechnology(我的机器默认已经打开Enabled/Disabled,主板不同进入的地方不一样,自行搜索)2、以管理员身份打开PowerShell3、输入(此步安装WSL):dism.exe/online/enable-feature/featurename:Microsoft-Windows-Subsystem-Linux/......