3) { $init_modules[] = 'auth'; } require realpath(__DIR__ . '/..') . '/includes/init.php'; // List of php modules we expect to see $modules = array('gd','mysqli'); $dbhost = @$_POST['dbhost'] ?: 'localhost'; $dbuser = @$_POST['dbuser'] ?: 'librenms'; $dbpass = @$_POST['dbpass'] ?: ''; $dbname = @$_POST['dbname'] ?: 'librenms'; $dbport = @$_POST['dbport'] ?: 3306; if (empty($_POST['dbsocket'])) { $dbsocket = null; } else { $dbhost = 'localhost'; $dbsocket = $_POST['dbsocket']; $dbport = null; } $add_user = @$_POST['add_user'] ?: ''; $add_pass = @$_POST['add_pass'] ?: ''; $add_email = @$_POST['add_email'] ?: ''; // Check we can connect to MySQL DB, if not, back to stage 1 :) if ($stage > 1) { try { if ($stage != 6) { dbConnect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbsocket); } if ($stage == 2 && $_SESSION['build-ok'] == true) { $stage = 3; $msg = "It appears that the database is already setup so have moved onto stage $stage"; } } catch (\LibreNMS\Exceptions\DatabaseConnectException $e) { $stage = 1; $msg = "Couldn't connect to the database, please check your details
" . $e->getMessage(); } $_SESSION['stage'] = $stage; } session_write_close(); if ($stage == 4) { // Now check we have a username, password and email before adding new user if (empty($add_user) || empty($add_pass) || empty($add_email)) { $stage = 3; $msg = "You haven't entered enough information to add the user account, please check below and re-try"; } } elseif ($stage == 6) { // If we get here then let's do some final checks. if (!file_exists("../config.php")) { // config.php file doesn't exist. go back to that stage $msg = "config.php still doesn't exist"; $stage = 5; } else { // all done, remove all traces of the install session session_unset(); session_destroy(); setcookie(session_name(), '', 0, '/'); session_regenerate_id(true); } } if (empty($stage)) { $stage = 0; } $total_stages = 6; $stage_perc = $stage / $total_stages * 100; $complete = 1; ?> <?php echo($config['page_title_prefix']); ?>

Welcome to the install

Stage of complete

% Complete

Pre-Install Checks

"; } if (is_writable(session_save_path() === '' ? '/tmp' : session_save_path())) { $status = 'yes'; $row_class = 'success'; } else { $status = 'no'; $row_class = 'danger'; $complete = false; } echo ""; ?>
Item Status Comments
PHP module $extension$status
Session directory writable$status"; if ($status == 'no') { echo session_save_path() . " is not writable"; if (function_exists('posix_getgrgid')) { $group_info = posix_getgrgid(filegroup(session_save_path())); if ($group_info['gid'] !== 0) { // don't suggest adding users to the root group $group = $group_info['name']; $user = get_current_user(); echo ", suggested fix usermod -a -G $group $user"; } } } echo "
Importing MySQL DB - Do not close this page or interrupt the import
If you don't see any errors or messages above then the database setup has been successful.
We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)
"); echo("
<?php\n".stripslashes($config_file)."
"); } else { $config_file = stripslashes($config_file); fwrite($conf, $config_file); echo("
The config file has been created
"); } } else { echo("
We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)
"); echo("
<?php\n".stripslashes($config_file)."
"); } } ?>
canManageUsers()) { if (!Auth::get()->userExists($add_user)) { if (Auth::get()->addUser($add_user, $add_pass, '10', $add_email)) { echo("
User has been added successfully
"); $proceed = 0; } else { echo("
User hasn't been added, please try again
"); } } else { echo("
User $add_user already exists!
"); } } else { echo("
Auth module isn't loaded
"); } ?>

You haven't quite finished yet!

First, you need to validate your install and fix any issues.

Thank you for setting up LibreNMS.

It would be great if you would consider contributing to our statistics, you can do this on the About LibreNMS Page and check the box under Statistics.