1)Allow root login into the system and restart ssh service
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo systemctl restart ssh
change the password after enabling root login as per requirement
sudo passwd
2) Install necessary packages,Php7.4 and add repository
apt install software-properties-common
add-apt-repository universe
apt update
apt install acl curl apache2 composer fping git graphviz imagemagick libapache2-mod-fcgid mariadb-client mariadb-server mtr-tiny nmap php7.4-cli php7.4-curl php7.4-fpm php7.4-gd php7.4-gmp php7.4-json php7.4-mbstring php7.4-mysql php7.4-snmp php7.4-xml php7.4-zip rrdtool snmp snmpd whois python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip
3)Add Librenms user
useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
4) Download Librenms
cd /opt
git clone https://github.com/librenms/librenms.git
5)set permissions
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/
6)Install PhP dependencies
su - librenms
./scripts/composer_wrapper.php install --no-dev
exit
Note: If proxy is used to access internet the install the compose package, if necessary
wget https://getcomposer.org/composer-stable.phar
mv composer-stable.phar /usr/bin/composer
chmod +x /usr/bin/composer
7)set timezone
nano /etc/php/7.4/fpm/php.ini
nano /etc/php/7.4/cli/php.ini
Note: Edit the file and add timezone
i.e. time.zone= Asia/Kolkata
8) update the timezone of the system
timedatectl set-timezone Asia/Kolkata
9) Configure MariaDB
nano /etc/mysql/mariadb.conf.d/50-server.cnf
Add this lines within [mysqld]
innodb_file_per_table=1
lower_case_table_names=0
10)Rrestart sql services
systemctl enable mariadb
systemctl restart mariadb
11) Create database for librenms
mysql -u root
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password'; (change the 'password')
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit
12)Configure php-fpm
cp /etc/php/7.4/fpm/pool.d/www.conf /etc/php/7.4/fpm/pool.d/librenms.conf
nano /etc/php/7.4/fpm/pool.d/librenms.conf
change [www]-->[librenms]
user = librenms
group = librenms
listen = /run/php-fpm-librenms.sock
13)Configure web server
nano /etc/apache2/sites-available/librenms.conf
<VirtualHost *:80>
DocumentRoot /opt/librenms/html/
ServerName librenms.example.com (change librenms.example.com to system-ip-addr)
AllowEncodedSlashes NoDecode
<Directory "/opt/librenms/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
# Enable http authorization headers
<IfModule setenvif_module>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
</IfModule>
<FilesMatch ".+\.php$">
SetHandler "proxy:unix:/run/php-fpm-librenms.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
then run this commands
a2dissite 000-default
a2enmod proxy_fcgi setenvif rewrite
a2ensite librenms.conf
systemctl restart apache2
systemctl restart php7.4-fpm
14)Enable lnms
ln -s /opt/librenms/lnms /usr/bin/lnms
cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/
15)Configure snmpd
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
Edit/change the text "RANDOMSTRINGGOESHERE" any text(like public) in copyied file
nano /etc/snmp/snmpd.conf
then run the below commands
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
16)cron job
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
17)copy logrotate config
cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
Now open the Browser and enter IP-ADDRESS
0 Comments