Skip to content

Instantly share code, notes, and snippets.

View lokesh-webonise's full-sized avatar

lokesh-webonise

View GitHub Profile

Mongo DB dump & restore

To dump database

 mongodump --host localhost --port 27017  --db dbname --out dump_dir_name

To dump specific collection

 mongodump --host localhost --port 27017  --db dbname --collection collectioname --out dump_dir_name

##To restore db mongorestore --host localhost --port 27017 dump_dir_name

@lokesh-webonise
lokesh-webonise / Exclude directory fom htpasswd.md
Last active September 28, 2021 09:46
Exclude specific folder from password protected directory area in Apache

Exclude specific folder from password protected directory area in Apache

  1. Assume your directory structure is /var/www/dir1/dir2/dir3

  2. Now your directory dir1 should be password protected & directory dir3 should be unprotected. So do this follow below mentioned steps.

Steps 1. Create virtualhost for password protected dir

@lokesh-webonise
lokesh-webonise / NRPE Plugin installation
Created June 6, 2013 05:18
NRPE Plugin installation from source code
lets get started first SSH into your remote machine and enter:
/usr/sbin/useradd nagios
passwd nagios
this will setup a new Nagios user, now we need to install some plugins:
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
tar -xzf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
LDAP server setup
1] Setup Ubuntu Server 64-bit (Use "Minimal install" in "Modes".)
2] sudo apt-get install slapd ldap-utils migrationtools
You will be prompted for the LDAP admin password. Please remember it.
3] sudo mv /etc/ldap/slapd.d /etc/ldap/slap.d.orig
4] sudo dpkg-reconfigure slapd
@lokesh-webonise
lokesh-webonise / Tomcat setup.md
Last active November 5, 2023 20:23
Tomcat virtual host configuration

Apache tomcat setup

###Pre-requisites JDK (java) should be install.

####1. To Install Java

Download jdk binary package.

Goto the downloaded directory. Give executable permission to jdk-6u31-linux-x64.bin file

@lokesh-webonise
lokesh-webonise / Add remote host to nagios server.md
Last active July 3, 2017 20:58
Add remote host to nagios server

##Add remote host to Nagios server

###On Remote Host ####Pre-requisite #####Below listed package should be installed i.gcc ii. xinetd iii.openssl

#####Step 1

@lokesh-webonise
lokesh-webonise / Github Multiple key
Created June 27, 2013 12:16
github authentication with multiple keys
Multiple github account SSH key switch
github using SSH connection with the client. If it is a single-user (first), generate a key pair, the public key saved to github, each time you connect the SSH client sends local private key (default ~ / .ssh / id_rsa) to the service-side validation. Single-user case, the connection saved on the server's private key and send the public key is naturally paired. But if it is a multi-user (first, second), we are connected to the second account when, second save their own public key, but still send the default SSH client private key, the private key that is first, then the verification will naturally be through. However, to achieve multiple accounts under the SSH key to switch on the client to do some configuration can be.
First, cd to ~ /. Ssh using ssh-keygen-t-rsa-C 'second@mail.com' to generate new SSH key: id_rsa_second, after generating a new SSH public key will be added to github.
ssh-keygen-t-rsa-C 'second@mail.com'
Default SSH only reads id_rsa, so in order to allow

##Step #1: Install nginx repo

Type the following wget command to install nginx yum configuration file:

#cd /tmp

CentOS Linux v6.x user type the following command:

# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

####1. generate a private key on the Linux server that runs Apache webserver using openssl command as shown below.

# openssl genrsa -out www.thegeekstuff.com.key 1024
Generating RSA private key, 1024 bit long modulus
.......................................++++++...................................................++++++
e is 73547 (0x01001)
Enter pass phrase for www.thegeekstuff.com.key:
Verifying - Enter pass phrase for www.thegeekstuff.com.key:

The generated private key looks like the following.