Friday, August 9, 2013

How to install MongoDB in XAMPP in Linux?

Hi,

Use the below steps to install MongoDB in XAMPP in Linux OS.


Install MongoDB in XAMPP in Linux.

Steps :

1. Download and install XAMPP devel package first. If you installed XAMPP in /opt folder then use the below command or You can replace /opt/ to the path where you installed XAMPP.

# tar xvfz xampp-linux-devel-1.x.x.tar.gz -C /opt/

2. Then install autoconf, automake and gcc if it is not installed in your system.

# yum install autoconf automake gcc -y

3. Then use the below command to install mongodb extension in xampp

# /opt/lampp/bin/pecl install mongo

4. Then edit php.ini file in xampp and add the mongo.so extension

# vi /opt/lampp/etc/php.ini

extension="mongo.so"

:wq

5. Now restart the xampp using the below command.

# /opt/lampp/lampp restart

6. Now use the below command to install mongo and run the mongo service.

# yum --disablerepo=* --enablerepo=fedora,updates install mongodb mongodb-server
# service mongod start
# chkconfig mongod on

Thursday, August 1, 2013

bash: autojump_add_to_database: command not found

Linux terminal shows the below error when .bashrc file does not exist in user's home folder.

Somebody may delete the .bashrc file unknowingly.

Error : bash: autojump_add_to_database: command not found

To solve this issue.

1. Open terminal.
2. $ vi .bashrc
3. Copy and Paste the below script


# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions

4. Save the file.
5. Now that bash error gets vanished.

If it is not work then you can copy the contents of .bashrc file from another user in that same system and paste it in user who faced this issue.

Script to shutdown all Linux machines in network

Use the below shell script to shutdown all Linux systems in LAN.

This shell script will be useful for system admins.


#!/bin/sh
read -p "Do you want to shutdown all systems? (y/n)" OUT
if [ "$OUT" = "y" ] || [ "$OUT" = "Y" ]; then
sys_ip="11 12 13"
for i in $sys_ip; do
if ping -c 1 "192.168.2.$i">/dev/null 2>&1; then
ssh root@192.168.2.$i init 0
else
echo "192.168.2.$i system is already down"
fi
done
elif [ "$OUT" = "n" ] || [ "$OUT" = "N" ]; then
 echo "Okay. No problem. You can shutdown it later."
else
 echo "You have entered wrong character. Enter only y or n."
fi