| | 167 | == LibreNMS == |
| | 168 | |
| | 169 | === Installing LibreNMS === |
| | 170 | |
| | 171 | These instructions assume you are the root user. If you are not, prepend ''sudo'' to the shell commands (the ones that aren't at ''mysql>'' prompts) or temporarily invoke root privileges. |
| | 172 | |
| | 173 | |
| | 174 | ==== Create database ==== |
| | 175 | |
| | 176 | '''NOTE''': These instructions are based on the official LibreNMS installation notes and have been tested on a fresh install of Ubuntu 16.0. |
| | 177 | |
| | 178 | We will assume that the database is running on the same machine as your network management server (this is the most common initial deployment scenario). |
| | 179 | |
| | 180 | First install mysql and configure: |
| | 181 | {{{ |
| | 182 | # apt-get update (Already done) |
| | 183 | # apt-get install mysql-server mysql-client |
| | 184 | }}} |
| | 185 | You will be asked to enter a password for the MySQL root user. Be absolutely sure that you remember what you choose here. You will use this later. |
| | 186 | {{{ |
| | 187 | # mysql -uroot -p |
| | 188 | }}} |
| | 189 | Input the MySQL root password (the one you chose in the previous step) to enter the MySQL command-line interface where you will get a mysql> prompt. |
| | 190 | |
| | 191 | Create the database: |
| | 192 | {{{ |
| | 193 | CREATE DATABASE librenms; |
| | 194 | GRANT ALL PRIVILEGES ON librenms.* |
| | 195 | TO 'librenms'@'localhost' |
| | 196 | IDENTIFIED BY '<Your Password>' |
| | 197 | ; |
| | 198 | FLUSH PRIVILEGES; |
| | 199 | exit |
| | 200 | }}} |
| | 201 | PLEASE NOTE |
| | 202 | |
| | 203 | Here we are using <your Password> as the password for LibreNMS to access MySQL. Please replace <your Password> with, Please do not forget the password as you will need it in the future |
| | 204 | |
| | 205 | ==== Install LibreNMS ==== |
| | 206 | |
| | 207 | The NMS is the host is where the web server and SNMP poller run. |
| | 208 | |
| | 209 | Install the required software: |
| | 210 | {{{ |
| | 211 | apt-get install libapache2-mod-php7.0 php7.0-cli php7.0-mysql php7.0-gd php7.0-snmp php-pear php7.0-curl snmp graphviz php7.0-mcrypt php7.0-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git |
| | 212 | }}} |
| | 213 | |
| | 214 | The packages listed above are an all-inclusive list of packages that were necessary on a clean install of Ubuntu 16.0 |
| | 215 | |
| | 216 | ==== snmp ==== |
| | 217 | |
| | 218 | You need to configure snmpd appropriately if you have not already done so. We will do a minimal snmp configuration on our server -- '''please DON'T''' do this if you've already configured SNMP earlier! |
| | 219 | {{{ |
| | 220 | # mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig |
| | 221 | # vi /etc/snmp/snmpd.conf |
| | 222 | }}} |
| | 223 | and, add the following line to the empty file: |
| | 224 | {{{ |
| | 225 | rocommunity NetManage 127.0.0.1 |
| | 226 | }}} |
| | 227 | And, now restart the snmp service so that the changes become active. |
| | 228 | {{{ |
| | 229 | # service snmpd restart |
| | 230 | }}} |
| | 231 | You can verify that snmp now responds to you locally by typing: |
| | 232 | {{{ |
| | 233 | # snmpstatus -v2c -c NetManage 127.0.0.1 sysStatus |
| | 234 | }}} |
| | 235 | |
| | 236 | ==== php ==== |
| | 237 | |
| | 238 | In both '''/etc/php/7.0/apache2/php.ini''' and '''/etc/php/7.0/cli/php.ini''', ensure '''date.timezone''' is set to your preferred time zone. |
| | 239 | |
| | 240 | See <http://php.net/manual/en/timezones.php> or files under ''/usr/share/zoneinfo'' for a list of supported timezones. For this workshop we are all going to use the same timezone. |
| | 241 | |
| | 242 | In the two archives noted above find the line that reads: |
| | 243 | {{{ |
| | 244 | ;date.timezone = |
| | 245 | }}} |
| | 246 | and change it to: |
| | 247 | {{{ |
| | 248 | date.timezone = Asia/Colombo |
| | 249 | }}} |
| | 250 | Save and exit from the files. |
| | 251 | |
| | 252 | |
| | 253 | ==== Adding the LibreNMS user ==== |
| | 254 | |
| | 255 | We need to create a LibreNMS system user, librenms |
| | 256 | |
| | 257 | # useradd librenms -d /opt/librenms -M -r |
| | 258 | # usermod -a -G librenms www-data |
| | 259 | |
| | 260 | |
| | 261 | ==== Cloning the LibreNMS source code with git ==== |
| | 262 | |
| | 263 | LibreNMS is installed using git. If you're not familiar with git, check out the git book or the tips at git ready. The initial install from github.com is called a ''git clone''; subsequent updates are done through ''git pull''. |
| | 264 | |
| | 265 | The initial clone can take quite a while (nearly 3 minutes on a 10Mbps connection is typical) as the size of the software repository is 220+ MB in size. |
| | 266 | |
| | 267 | Run the following: |
| | 268 | {{{ |
| | 269 | # cd /opt |
| | 270 | # git clone https://github.com/librenms/librenms.git librenms |
| | 271 | }}} |
| | 272 | At this point, you should have a ''librenms'' directory, with the most recent revision checked out. |
| | 273 | |
| | 274 | |
| | 275 | ==== Web Interface ==== |
| | 276 | |
| | 277 | To prepare the web interface (and adding devices shortly), you'll need to create and change the ownership of a directory as well as create an Apache Virtul Host definition. |
| | 278 | |
| | 279 | First, create and chown the ''rrd'' directory and create the ''logs'' directory: |
| | 280 | {{{ |
| | 281 | # cd /opt/librenms |
| | 282 | # mkdir rrd logs |
| | 283 | # chown -R librenms:librenms /opt/librenms |
| | 284 | # chmod 775 rrd |
| | 285 | # chown www-data /opt/librenms |
| | 286 | }}} |
| | 287 | Next, create '''/etc/apache2/sites-available/librenms.conf''': |
| | 288 | {{{ |
| | 289 | # vi /etc/apache2/sites-available/librenms.conf |
| | 290 | }}} |
| | 291 | Add the following lines: |
| | 292 | {{{ |
| | 293 | <VirtualHost *:80> |
| | 294 | DocumentRoot /opt/librenms/html/ |
| | 295 | ServerName librenms."your domain".ws.ac.lk |
| | 296 | CustomLog /opt/librenms/logs/access_log combined |
| | 297 | ErrorLog /opt/librenms/logs/error_log |
| | 298 | AllowEncodedSlashes NoDecode |
| | 299 | <Directory "/opt/librenms/html/"> |
| | 300 | Require all granted |
| | 301 | AllowOverride All |
| | 302 | Options FollowSymLinks MultiViews |
| | 303 | </Directory> |
| | 304 | </VirtualHost> |
| | 305 | }}} |
| | 306 | |
| | 307 | Now enable the Virtual Host, but wait to restart Apache |
| | 308 | {{{ |
| | 309 | # a2ensite librenms.conf |
| | 310 | # a2enmod rewrite |
| | 311 | # service apache2 restart |
| | 312 | }}} |
| | 313 | |