How to fix W: Duplicate sources.list entry http://apt.newrelic.com/debian/ newrelic/non-free amd64 Packages (/var/lib/apt/lists/apt.newrelic.com_debian_dists_newrelic_non-free_binary-amd64_Packages)

How to fix this error ?

W: Duplicate sources.list entry http://apt.newrelic.com/debian/ newrelic/non-free amd64 Packages (/var/lib/apt/lists/apt.newrelic.com_debian_dists_newrelic_non-free_binary-amd64_Packages)

This comes on my hosting once you typed in apt-get update.

The resolution is pretty simple if you know where to look to for and they don’t make it easy.

Instead of navigating to

$cd /etc/apt/

you need to navigate to:

# cd /etc/apt/sources.list.d/ and edit newrelic file

it might just simpler to type:

$vim /etc/apt/sources.list.d/newrelic.list

and edit to file from:

deb http://apt.newrelic.com/debian newrelic non-free

deb http://apt.newrelic.com/debian newrelic non-free

So you need to remove one line and run apt-get update again.

Problem solved!

Or simply you can use this command to find where it is

grep -rnw /etc/ -e “deb http://apt.newrelic.com/debian”
/etc/apt/sources.list.d/newrelic.list:1:deb http://apt.newrelic.com/debian/ newrelic non-free

Kaspersky How to fix database updates

If the database is not updating even if the “Update task worked” then follow the below

1. Log in to the Kaspersky Management console.

2. Navigate to affected server.

3. Run Database Update task.

4. Check if the task worked by checking the database timestamp in the Application->Kaspersky Server-> Database Date. If the timestamp hasn’t changed then do the following

5. Under Application Stop/Start Kaspersky Server.

6. Under Task Run a Database Rollback

7. Under Taks Run the database Update.

8. Go out of the server and refresh the view.

9. Check the database timestamp but it should be “green” already.

How to fix Less than 25% free in the configuration cache for Zabbix

  1. Remove old disabled host in configuration tab. This will free up your cache.
  2. Allow more cache in zabbix e.g change default value from 8mb to 16mb and restart zabbix servic /etc/ini.d/zabbix_server restart
 ### Option: CacheSize
   #       Size of configuration cache, in bytes.
   #       Shared memory size for storing host, item and trigger data.
   #
   # Mandatory: no
   # Range: 128K-8G
   # Default:
   # CacheSize=8M

How to Install MediaWiki with MySQL and PHP and LDAP/AD extension

Assumptions:

System: Linux Debian with PHP and Apache web server already installed and running.

Install the following:

  1. apt-get install mysql-server
  2. apt-get install php5-mysql
  3. Download wiki https://www.mediawiki.org/wiki/Manual:Installation_guide
  4. Setup Apache site then a2ensmode Name to enable it.
  5. Setup database for wiki follow this https://www.mediawiki.org/wiki/Manual:Installing_MediaWiki

mysql -u root -p

CREATE DATABASE wikidb;
GRANT ALL PRIVILEGES ON wikidb.* TO 'wikiuser'@'localhost' IDENTIFIED BY 'password';

6. Restart apache.

service apache2 restart

If the Wiki is not showing mysql then you need to restart service.

7. Install LDAP support for php.

on ubuntu apt-get install php5-ldap

8. Restart apache – service apache2 restart

9. Download ldap extention from wiki

https://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Configuration_Options

then clik on the download the snapshot for the correct version then unpack

tar -xzf LdapAuthentication-REL1_28-770c89e.tar.gz -C /var/www/mediawiki/extensions

10. Run the updater php maintenance/update.php

If you get the following error then you need to run the update script again!

A database query error has occurred. This may indicate a bug in the software.[a6131d2bdeda3f290ca8cc67] 2017-02-15 11:28:39: Fatal exception of type “DBQueryError”

You need to have a ldap_domain table created in wiki database. You can run double check if it’s there by logging to mysql

mysql -p -u root

then show databases; use wikidb; show tables; you should see the ldap_domains

Once you setup ldap you will no longer be able to access the Admin account. Log first as a ldap/ad user then log in to mysql

mysql -p -u root

show databases;

use yourdatabase;

select * from user; (to get your user _id)

then run the following (2 is my user_id)

INSERT INTO user_groups (ug_user,ug_group) VALUES (2,”bureaucrat”);

Once completed log to wiki and you will have a full rights to it.

Once you LDAP setup is ready you may wan to change from clear to tls/ssl in the LocalSettings.php section.

To get ssl/tls working you need to trust the certification from your active directory.

  1. Get a Certification

openssl s_client -connect yourdomaincontroller-dc1:636

copy all section from ——-BEGIN to END —- Certficate

Install ldap-utils

apt-get install ldap-utils

Open up vim /etc/ldap/ldap.conf

then look for entry

TLS_CACERT /etc/ssl/certs/ca-certificates.crt

open up vim /etc/ssl/certs/ca-certificates.crt and paste your Certificate to the end.

I have found that this works only temporary until you run update-ca-certificates.

To get this permamment.

create a local file with certificates e.g local-ca.crt then copy it to /usr/local/share/ca-certificates and run update-ca-certificates.

Restart apache service apache2 restart

It should be working now.

If you have the following error  DatabaseBase::factory no viable database extension found for type ‘mysql’ then you need to install apt-get install php5-mysql and service apache2 restart.