yum install epel-release 指定 php 版本 yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum install -y yum-utils yum-config-manager --disable remi-php54 yum-config-manager --enable remi-php73 新版 mariadb curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash 新版 apache cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo yum install git cronie fping jwhois ImageMagick mtr MySQL-python net-snmp net-snmp-utils nmap python-memcached rrdtool policycoreutils-python httpd mariadb mariadb-server unzip wget nano yum install mod_php php-cli php-common php-curl php-gd php-mbstring php-process php-snmp php-xml php-zip php-memcached php-mysqlnd php -y useradd librenms -d /opt/librenms -M -r usermod -a -G librenms apache cd /opt git clone https://github.com/librenms/librenms.git chown -R librenms:librenms /opt/librenms chmod 770 /opt/librenms setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ /opt/librenms/cache setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ /opt/librenms/cache su - librenms ./scripts/composer_wrapper.php install --no-dev exit systemctl start mariadb mysql -u root CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci; CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost'; FLUSH PRIVILEGES; exit nano //etc/my.cnf.d/server.cnf Within the [mysqld] section please add: innodb_file_per_table=1 lower_case_table_names=0 systemctl enable mariadb systemctl restart mariadb timedatectl set-timezone Asia/Taipei sed -e 's/memory_limit = 128M/memory_limit = 1024M/' -i /etc/php.ini sed -e 's/max_execution_time = 30/max_execution_time = 3600/' -i /etc/php.ini sed -e 's/max_input_time = 60/max_input_time = 3600/' -i /etc/php.ini sed -e 's/upload_max_filesize = 2M/upload_max_filesize = 1024M/' -i /etc/php.ini sed -e 's/post_max_size = 8M/post_max_size = 1024M/' -i /etc/php.ini sed -e 's/^;date.timezone =/date\.timezone ="Asia\/Taipei"/' -i /etc/php.ini systemctl enable httpd systemctl start httpd test php_admin_value[open_basedir] = "/opt/librenms:/usr/lib64/nagios/plugins:/dev/urandom:/usr/sbin/fping:/usr/sbin/fping6:/usr/bin/snmpgetnext:/usr/bin/rrdtool:/usr/bin/snmpwalk:/usr/bin/snmpget:/usr/bin/snmpbulkwalk:/usr/bin/snmptranslate:/usr/bin/traceroute:/usr/bin/whois:/bin/ping:/usr/sbin/mtr:/usr/bin/nmap:/usr/sbin/ipmitool:/usr/bin/virsh:/usr/bin/nfdump" nano /etc/httpd/conf.d/librenms.conf <VirtualHost *:80> DocumentRoot /opt/librenms/html/ ServerName librenms.example.com AllowEncodedSlashes NoDecode <Directory "/opt/librenms/html/"> Require all granted AllowOverride All Options FollowSymLinks MultiViews </Directory> </VirtualHost> systemctl restart httpd disable selinux cd ~ nano http_fping.tt module http_fping 1.0; require { type httpd_t; class capability net_raw; class rawip_socket { getopt create setopt write read }; } #============= httpd_t ============== allow httpd_t self:capability net_raw; allow httpd_t self:rawip_socket { getopt create setopt write read }; checkmodule -M -m -o http_fping.mod http_fping.tt semodule_package -o http_fping.pp -m http_fping.mod semodule -i http_fping.pp systemctl disable firewalld cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf nano /etc/snmp/snmpd.conf Edit the text which says RANDOMSTRINGGOESHERE and set your own community string. 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 cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms