Saturday, October 10, 2015

Can't locate autodie.pm

Solution :
Run Command

cpan autodie

Can't locate Digest/Perl/MD5.pm in @INC

Solution :
Run command
cpan Digest::MD5

Can't locate CPAN.pm in @INC

If you are using CentOS/RHEL/Fedora and you get this error, Run following command to solve the error.
yum install perl-CPAN

Tuesday, September 8, 2015

gulp : watch error - Waiting…Fatal error: watch ENOSPC

gulp : watch error - Waiting…Fatal error: watch ENOSPC

Run command :
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Tuesday, August 18, 2015

ERROR:nacl_fork_delegate_linux.cc(314)] Bad NaCl helper startup ack (0 bytes)

Google Chrome Error :

Remove beta version if it is installed
sudo apt-get --purge remove google-chrome-beta
Remove stable version if it is installed

sudo apt-get --purge remove google-chrome-stable
Install stable version again suppose it is 36.

dpkg -i google-chrome-stable_current_i386_36.0.deb
 
If above solution is not working, Run following command in your terminal.

google-chrome --no-sandbox --user-data-dir

Monday, July 6, 2015

firefox start error - Couldn't load XPCOM

firefox start error - Couldn't load XPCOM

Check ubuntu is 32 bit or 64 bit and firefox is 32 bit or 64 bit.
Generally you get this when you install 32 bit firefox on 64 bit ubuntu.


Check your firefox is 32 bit or 64 bit, run in firefox
about:


If you get
Build identifier: Mozilla/5.0 (X11; Linux i686; rv:36.0) Gecko/20100101 Firefox/36.0
Note: i686, i386, i586 are 32-bit builds.

and if you get
Build identifier: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0
Note: x86_64 is 64-bit build.

Download 64 bit firefox from here.
Download 32 bit firefox from here.

DBD::Pg perl module hasn't been fully installed

install_driver(Pg) failed: Can't locate DBD/Pg.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 3) line 3.
Perhaps the DBD::Pg perl module hasn't been fully installed
sudo yum install perl-DBD-Pg
If you are using ubuntu, Run
sudo apt-get install libdbd-pg-perl

Friday, June 5, 2015

Install Zend Framework in XAMPP Ubuntu or any other Linux

Install Zend Framework 2 on XAMPP Linux


Ist method :
First change the directory.
cd /opt/lampp/htdocs
Now clone the framework using following git command :
git clone git://github.com/zendframework/ZendSkeletonApplication.git
Now change the directory again.
cd ZendSkeletonApplication
Run Command :
/opt/lampp/bin/php composer.phar self-update
Now
/opt/lampp/bin/php composer.phar install
and finally run command
curl -#L https://github.com/zendframework/ZendSkeletonApplication/tarball/master | tar xz --strip-components=1
Now you can open the zend frame work on your localhost using
http://localhost/ZendSkeletonApplication/public/

IInd method :
Run these commands :
cd /opt/lampp/htdocs
git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive
Now try to open framework using
http://localhost/ZendSkeletonApplication/public/

Thursday, May 14, 2015

ImportError: No module named pygtk

It means, the python your package is using is not the correct one or source package python.

Find using command `which python`.
If it is /usr/local/bin/python


Rename this file , the original python file will be in /usr/bin/python


Now run your package again.

Thursday, April 2, 2015

Ubuntu / Centos - Linux - Check Hyperthreading is enabled or not

Check Hyperthreading status :

Run command :
cat /proc/cpuinfo

If the number of siblings is equal to the number of cores then you have CPUs which are not hyperthreading or hyperthreading is switched off, If the number of siblings is 2x the number of cores then you have a hyperthreading CPU with hyperthreading switched on.

Friday, March 13, 2015

ssh-add - Add keys permanent

Keys are removed after reboot, Add ssh keys permanent

If you add private keys or .pem files using ssh-add and reboot your system, they are disappeared.

To add the keys permanently, here is the solution.

Suppose your key file is filename.pem and it is in Documents. In this case, Add the following command in your .bashrc file.


ssh-add /root/Documents/filename.pem 2>/dev/null

 
Now this key will be added permanently in your listing.


You can add as many keys you want.

Monday, February 23, 2015

Make xubuntu desktop classic

Remove Unity theme from xubuntu and install classic desktop


Install :
sudo apt-get install xubuntu-desktop gksu leafpad synaptic

Wednesday, February 18, 2015

AWS - Amazon - Stopping the instance changes my public IP

AWS - Public IP should not be changed

When you stop and start instance, it changes your public IP. If you do not want to change every time, Here is a solution for you.
You need to create Elastic IP for it. 
It will generate a new IP and it will not be changed.

EC2 > Elastic IPs (under network and security)
click on Allocate New address - A new IP will be generated
Now connect this IP to your instance.
Select the new created public IP. Click on the Associated Address.
Enter your instance name. It will show current private IP and current public IP in the drop down.
Now associated with it. Now your instance is connected to new created public IP.
Now if you stop or start your instance, public IP will not be changed.



Friday, January 2, 2015

Keep Python Server Running even after closing the terminal



Suppose you use following command to run your python server
python manage.py runserver
But once you close the terminal, process is killed and python server is stopped automatically.
This can be a bigger problem if server is placed remotely and you want to keep it running always whether your system is turned on or turned off.

Here is a solution for you. Use nohup with your command.
nohup your-command &

In this case, Run this command
nohup python manage.py runserver &
Now if you close the terminal, server still runs.

postgres: Postgres-XC: must start as either a Coordinator (--coordinator) or Datanode (--datanode)

Postgresql Server Error in Ubuntu :
postgres: Postgres-XC: must start as either a Coordinator (--coordinator) or Datanode (--datanode)

To remove this error, remove the package
apt-get --purge remove postgres-xc
But if you are not able to remove it because of an error, Find all processes of postgres using
ps aux | grep postgres
or
ps aux | grep psql

and kill all one by one. Now try to remove again.

Now install these packages:
apt-get install postgresql-client-common
apt-get install postgresql-common
apt-get install postgresql-9.3
apt-get install postgresql-client-9.3
apt-get install postgresql-contrib-9.3

* No PostgreSQL clusters exist; see "man pg_createcluster"

psql error : * No PostgreSQL clusters exist; see "man pg_createcluster"

If you are trying to start postgresql server and you get this error.
Here is solution for you.

First you need to find the server version of your postgresql then you need to create cluster.

Suppose your server version is 9.3
pg_createcluster 9.3 main --start


psql: could not connect to server: No such file or directory

 psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


 If you are trying to open command prompt of postgresql using command psql and it gives above error it means your postgresql server is not started, you need to start it first.
service postgresql start
If it is giving error postgresql: unrecognized service, it means you are not starting correct service, you need to verify the correct name of the service.
Is it postgresql-9.3 or postgresql-9.4 or postgresql-8.4?

Now restart it after confirmation.
service postgresql-9.3 start
or
service postgresql-9.4 start
or
service postgresql-8.4 start

psql: FATAL: Ident authentication failed for user "root"

Postgresql error
psql: FATAL:  Ident authentication failed for user "root"

If you run command psql on terminal as root user and you get the error
psql: FATAL:  Ident authentication failed for user "root"
Here is solution for you. 

To resolve this error, Run these two commands on your terminal.
sudo -u postgres createuser root
It might give you this message
could not change directory to "/root"
Do not worry about it, when it asks
Shall the new role be a superuser? (y/n)

Enter y and press return key.

and the other command is
sudo -u postgres createdb root -O root
Now run command psql on terminal and you will log into postgresql command prompt as user root.

To check the list of postgresql databases, run command
\list

to quit the psql command prompt, run command
\q

Find Orientation of an image captured by a digital camera or mobile / cell phone

Download exiftool tar file from http://www.sno.phy.queensu.ca/~phil/exiftool/ and extract it. Now run these commands.
First change directory.
cd Image-ExifTool-9.78/
Run these commands one by one.

perl Makefile.PL
make
make test
make install

To find the orientation of a camera image run command after installation :

exiftool Orientation -n "/path/of/camera_image.jpg"
Do not use downloaded image, make sure it is clicked by digital camera.

Note : Orientation means the correct position of the image with respect to the camera button when it was clicked.

ssh: Could not resolve hostname bitbucket.org: Name or service not known

If you are trying to run git commands to pull and push and you are getting this. Here is the solution for you.

Open file /etc/resolv.conf and add following line in it

nameserver 8.8.8.8
Now save the file and try to pull/push again.

Warning: No xauth data; using fake authentication data for X11 forwarding

Either you have changed your hostname or any similar activity on your system that's why other system is not identifying you.

Solution :
Run this command on terminal
xauth add :0 . `mcookie`
To check whether your hostname is added in the list or not, run
xauth list
Now ssh into other system, you will not get this error.

Received disconnect from IP: 2: Too many authentication failures for root

Received disconnect from : 2: Too many authentication failures for root

You are getting this error because your public keys are not saved on the server and it is not prompting for password so the public key authentication is failed, it throws you back on the command prompt with error.


The solution is simple. Either you need to save your public keys on server in authorized_keys file or set PubkeyAuthentication=no in your command. Now it will ask for password.

ssh -o PubkeyAuthentication=no server-IP
Example :
If you want to loginto server whose IP is 192.168.0.10, Run

ssh -o PubkeyAuthentication=no 192.168.0.10



Friday, December 26, 2014

Understanding Linux File Permissions

Linux File Permissions :

Understanding Linux File & Directory Permissions :



Linux File and directory Permission mechanism

Read Write Execute
Owner 400 200 100
Group 40 20 10
Others 4 2 1


If you want to give Read, Write & Execute permission to Owner, Groups & Others, it means full permission.
400+200+100+40+20+10+4+2+1 = 777

If you do not want to give Write permission to Groups Others, it means 
400+200+100+40+10+4+1 = 755

The best thing of this calculation, you can not make sum of a number in two different ways .
It means 644 can be made in this way only that is 400+200+40+4
The meaning of 644 is Read & Write permission to Owner and Read permission to Group and Others only.

To give 777 to a directory :

# chmod -R 777 /path/of/the/directory

where -R means Recursive, it means give this permission to all sub-directories and files.

To give 777 to a file :
# chmod 777 /path/of/the/file
Now you can create & give permissions by your own.

Thursday, December 11, 2014

Install mplayer on CentOS 7.0

Install mplayer on CentOS 7.0 X86_64

If you have tried to install mplayer on CentOS and you have faced dependency errors as well as broken package error, here is the solution for you.

Run these commands on your terminal.
wget https://sites.google.com/site/linuxamination/netembryo-0.1.1-4.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/lirc-libs-0.9.0-11.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/esound-libs-0.2.41-8.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/nas-libs-1.9.3-6.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/libnemesi-0.7.0-0.4.20110215git.fc19.x86_64.rpm

https://sites.google.com/site/linuxamination/dirac-libs-1.0.2-10.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/schroedinger-1.0.11-4.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/svgalib-1.9.25-12.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/arts-1.5.10-22.fc19.x86_64.rpm
These are the required packages which you need to download and install.

Now check if all packages are downloaded. Run this command.
ls -1 *rpm
Now install all packages using following command.
yum localinstall *rpm
Now you can install mplayer on your system. You will not get dependencies error.
yum install mplayer

Install mencoder on CentOS 7.0

Install mencoder on CentOS 7.0 X86_64

If you have tried to install mencoder on CentOS and you have faced dependency errors as well as broken package error, here is the solution for you.

Run these commands on your terminal.
wget https://sites.google.com/site/linuxamination/netembryo-0.1.1-4.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/lirc-libs-0.9.0-11.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/esound-libs-0.2.41-8.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/nas-libs-1.9.3-6.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/libnemesi-0.7.0-0.4.20110215git.fc19.x86_64.rpm

https://sites.google.com/site/linuxamination/dirac-libs-1.0.2-10.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/schroedinger-1.0.11-4.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/svgalib-1.9.25-12.fc19.x86_64.rpm

wget https://sites.google.com/site/linuxamination/arts-1.5.10-22.fc19.x86_64.rpm
These are the required packages which you need to download and install.

Now check if all packages are downloaded. Run this command.
ls -1 *rpm
Now install all packages using following command.
yum localinstall *rpm
Now you can install mencoder on your system. You will not get dependencies error.
yum install mplayer

Install ffmpeg on CentOS 7

Install ffmpeg on CentOS 7.0 X86_64

If you have tried to install ffmpeg on CentOS 7.0, you are not able to install it.
It shows message, "No package ffmpeg found."
It doesn't mean, you can not install this package on your CentOS 7.0.
Here is the solution for you.

Run following command on terminal to download the package.
wget ftp://rpmfind.net/linux/centos/6.5/os/x86_64/Packages/libdc1394-2.1.2-3.4.el6.x86_64.rpm
Now install this downloaded package
yum -y localinstall libdc1394-2.1.2-3.4.el6.x86_64.rpm
Now you need to install the repo atrpms
rpm -ivh http://dl.atrpms.net/el7-x86_64/atrpms/stable/atrpms-repo-7-7.el7.x86_64.rpm
Now install ffmpeg, it will not show the message "No package found."
yum -y install ffmpeg
I hope, it will work for you.

Friday, November 7, 2014

/usr/lib/apache2/modules/libphp5.so: cannot open shared object file

If you facing this error on your ubuntu system while operating apache2, here is solution for you.

Install following package on your ubuntu system.
sudo apt-get install libapache2-mod-php5
Now try again.

Ubuntu Login Error : failed to start session

Ubuntu Login Error : failed to start session

If you are not able to log into your account and it shows above error. Here is a solution for you.

Press ctrl+alt+f1 to open command prompt.

Now install following packages.
sudo apt-get install ubuntu-desktop
and
sudo apt-get install gnome-shell ubuntu-gnome-desktop
Now try to Login again.

Configure: error: memcache support requires ZLIB

checking for the location of zlib,configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/tmp/pear/temp/memcache/configure --enable-memcache-session=yes' failed


To remove this error,you need to install zlib package.

If you are using Debian or Ubuntu, Run command

sudo apt-get install zlib1g-dev libncurses5-dev
If you are using CentOS, fedora or RHEL, Run command
sudo yum install zlib-devel
Now run again,

sudo /opt/lampp/bin/pecl install memcache
If it runs successfully

Add line

extension=memcache.so
in the file php.ini.

Restart xampp.

Memcache php extension not loaded

 Memcache php extension not loaded

If you are using XAMPP and you are facing this error while running your web application, Run following command in terminal.
sudo /opt/lampp/bin/pecl install memcache
If you face error: phpize failed
To remove this error, you need to install autoconf package.

If you are using Debian or Ubuntu, Run command
sudo apt-get install autoconf
If you are using CentOS, fedora or RHEL, Run command
sudo yum install autoconf
Now Run:
sudo /opt/lampp/bin/pecl install memcache

If you face error: 
checking for the location of zlib,configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/tmp/pear/temp/memcache/configure --enable-memcache-session=yes' failed


To remove this error,you need to install zlib package.

If you are using Debian or Ubuntu, Run command

sudo apt-get install zlib1g-dev libncurses5-dev
If you are using CentOS, fedora or RHEL, Run command
sudo yum install zlib-devel
Now run again,

sudo /opt/lampp/bin/pecl install memcache
If it runs successfully

Add line

extension=memcache.so
in the file php.ini.

Restart xampp

Error while restarting xampp - apachectl returned 1.

Error while restarting xampp - apachectl returned 1.

If you are facing this error while restarting XAMPP, the reason may be your virtualhost file. (/opt/lampp//etc/extra/httpd-vhosts.conf)

Check your virtual host file if there is any garbage text in it and Apache is not able to understand it.

Garbage text means half closed tags, copy-paste unnecessary data etc

Check your file closely and make necessary corrections.

Solution II
If you are still facing same problem, open Directory /opt/lampp/logs
and remove the file httpd.pid.
sudo rm -f /opt/lampp/logs/httpd.pid 
Now restart xampp. You should not face this problem again.

php pdo driver not found

php connect to mssql database on Linux using pdo: driver not found
php pdo mssql driver installation on centos and ubuntu

If you are using CentOS, fedora or RHEL, Run commands
sudo yum install php-pdo
sudo yum install php-mssql
sudo yum install freetds-devel libxml2-devel
If you are using Debian or Ubuntu, Run

sudo apt-get install php5-dev php5-mysql php5-odbc php5-sybase libmysqlclient-dev freetds-dev

dblib is needed on Linux to connect to mssql server using pdo.

Here is php code to connect to ms sql server from Linux Apache using pdo.
<?php
$dsn = 'dblib:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';
$dbh = new PDO($dsn, $user, $password);
?>
Now try to connect MS SQL server.

mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h

/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6/ext/ffi_c/gem_make.out


If you are using CentOS, fedora or RHEL, Run command
sudo yum install ruby-devel
If you are using debian or ubuntu, Run command
sudo apt-get install ruby-dev

nodejs npm - Fatal error: unable to find local grunt

Fatal error: unable to find local grunt

You need to install grunt on your system.
All the explanations are here.

To solve this problem, Run following command in terminal :
npm install -g grunt-cli
npm install grunt --save-dev
npm install grunt-cli

cronjob is running at wrong timezone

cronjob time zone is wrong

First check hardware time and timezone using command
hwclock
If it is different than system time, it may be possible that your cron is following hardware time.

Set your hardware clock time same as system time using command
hwclock -w
Now check if cron is following correct time zone.

If you are still facing problem, Restart cron daemon once.
You need to restart cron when you change your time zone.

If you are still facing problem, Restart your system once.

karma - can not start chrome

INFO [karma]: Karma v0.12.24 server started at http://localhost:xxxx/
INFO [launcher]: Starting browser Chrome
ERROR [launcher]: Cannot start Chrome


Set chrome path using
export CHROME_BIN=/opt/google/chrome/google-chrome
Now run your script.

If you are still facing this error, Install chrome launcher using
npm install karma-chrome-launcher
Now run your script.

If you are still facing this error.
Kill all instances of chrome.
Output of `ps aux | grep chrome | grep -v grep` should be empty.
Now run your script.

Tuesday, October 7, 2014

Install ioncube loader on ubuntu

ioncube loaders are available for 32 bit and 64 bit system both.
Suppose you are using 32 bit Linux system (CentOs, Fedora, Ubuntu or Debian).

Download 32 bit ioncube loader zip file from

http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
Extract it and Put the directory in your htdocs, Now run

http://localhost/ioncube/loader-wizard.php
There are number of ioncube .so files in the ioncube directory because you may have different version of php. When you run the wizard, it shows required .so file which you should use, copy your required ioncube.so file and put it in /usr/lib/php5/200.....

Add following line at bottom of the line [php] in the file php.ini
zend_extension = /usr/lib/php5/200..../ioncube_loader_lin_5.x.so
Restart apache2, and run

http://localhost/ioncube/loader-wizard.php
you will get
The ionCube Loader version 4.6.1 for PHP 5.4 is already installed and encoded files should run without problems.

Friday, October 3, 2014

Install ioncube-loader on centOS 64bit

ioncube loaders are available for 32 bit and 64 bit system both.
Suppose you are using 64 bit Linux system (CentOs, Fedora, Ubuntu or Debian).

Download 64 bit ioncube loader zip file from

http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
Extract it and Put the directory in your htdocs, Now run

http://localhost/ioncube/loader-wizard.php
There are number of ioncube .so files in the ioncube directory because you may have different version of php. When you run the wizard, it shows required .so file which you should use, copy your required ioncube.so file and put it in /usr/lib64/php/modules (for centOS 64 bit) 

Add following line at bottom of the line [php] in the file php.ini
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.4.so
Restart httpd, and run

http://localhost/ioncube/loader-wizard.php
you will get
The ionCube Loader version 4.6.1 for PHP 5.4 is already installed and encoded files should run without problems.

If you restart httpd and check the status,if it says
httpd dead but subsys locked

 
It means zend_extension is somewhere defined in the ini file, comment the line, restart httpd and it will be running.

Cronjob is executing twice / multiple times

If you have set a script in cron and it executes twice, check following things.

1) Check if there is another entry of same cronjob.

2) Check if two different users are executing the same cron.

If both solutions are not working, Try this.

3) There may be high chances if cron daemon is running twice. Check if it is true using command

ps aux | grep cron | grep -v grep

If there are two entries, kill one job or stop the cron service twice and run it again. Make sure you check again that there is only one cron daemon is running.

Alias "bootstrap.helpers.*" is invalid. Make sure it points to an existing directory or file

Alias "bootstrap.helpers.*" is invalid. Make sure it points to an existing directory or file

If you are getting this error while executing a php web application. The reason may be your php version is less than 5.3. Upgrade it equal to or greater than 5.3 and try again.

If you have PHP Version 5.2.17 or similar, you may have this error.

Wednesday, September 3, 2014

Errors were encountered while processing: mysql-server-5.5 ... E: Sub-process /usr/bin/dpkg returned an error code (1)

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):

subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)


I know you have tried all these solutions that's why you are here but just take a look at once before watching my final solution which is going to work for you.

Solution : 1
Run command
sudo dpkg --configure -a
Solution : 2
Remove and install mysql server again, Run commands :
sudo apt-get --purge remove mysql-server
sudo apt-get install mysql-server

Solution : 3
Remove mysql-server and mysql-server-5.5 package from the file /var/lib/dpkg/status and reconfigure mysql-server
sudo dpkg --configure -a
But you have tried all these solutions and still you are facing same problem, try this Final Solution.
 
Final Solution
Run Command :
sudo apt-get install --reinstall apparmor
Now comment following line in the file /etc/mysql/my.cnf
skip-bdb
Restart mysql
sudo service mysql start
Now your mysql will be started.

Saturday, August 9, 2014

Transfer files from one linux server to another linux server

scp from one remote server to another remote server

If you are trying to transfer files from one remote server to another remote server using scp and you are getting permission denied error, here is the solution for you.

Suppose you are using system A and you want to transfer files from system B to system C and you are trying
scp user1@systemB-IP:/location/sourcefile user2@systemC-IP:/location/targetFile
But you are getting permission denied error

You should use
ssh user1@systemB-IP scp /location/sourceFile user2@systemC-IP:/location/targetFile
But still you are getting permission denied error, try
ssh -t user1@systemB-IP scp /location/sourceFile user2@systemC-IP:/location/targetFile
Example :
IP of system A - 192.168.0.11
IP of system B - 192.168.0.12
IP of system C - 192.168.0.13

Source file location on system B - /opt/lampp/htdocs/install.log
Destination location on system C - /opt/logs

You are log in to system A and you want to transfer file from system B to system C. Run following command :
ssh -t root@192.168.0.12 scp /opt/lampp/htdocs/install.log root@192.168.0.13:/opt/logs


Solution : 2
Save public key file of your system (system A) into system B and system C.

scp $HOME/.ssh/filename.pub root@192.168.0.12:/root/.ssh/authorized_keys

scp $HOME/.ssh/filename.pub root@192.168.0.13:/root/.ssh/authorized_keys

and now run
scp root@192.168.0.12:/opt/lampp/htdocs/install.log root@192.168.0.13:/opt/logs

Pseudo-terminal will not be allocated because stdin is not a terminal

Pseudo-terminal will not be allocated because stdin is not a terminal

if you get this error while log into another Linux account using ssh, here is the solution.

Use -t -t with ssh.
ssh -t -t hostname
Example :
ssh -t -t user@192.168.0.7

unknown job `servicename`

unknown job error ubuntu

Service is installed but when you try to start, stop or restart, it gives you unknown job error. 
If you are facing this problem in root account, here is the solution.

Use sudo with your command but there should be no need to use sudo in root account. Use sudo and if your command is executed successfully, it means you have not created alias for sudo.

Add this line in .bashrc file of root.
alias service="sudo service"
You will find the file here i.e. /root/.bashrc

ubuntu - root login not possible through ssh

ubuntu 14.04 - Enable root login for ssh

If you are trying to log into root account of ubuntu system using ssh and you are getting permission denied error. You are quite sure that your password is correct but still you are facing this error. It means root account is disabled for ssh.
Follow the steps to enable it.

Open file /etc/ssh/sshd_config on your ubuntu system.
Replace line
PermitRootLogin without-password
with
PermitRootLogin yes
Restart ssh.
Now try to log into root account using ssh.

Friday, July 4, 2014

Postfix : Port 25 is not opened in Linux, opened in firewall

Port 25 is not in opened port list

If you have installed postfix mail server and port 25 is not visible in opened port list. 
Have you opened it in iptables ( firewall ) ?
The line should be included in iptables.
-A INPUT -p tcp -m state -m tcp --dport 25 --state NEW -j ACCEPT

Yes, Yes, it is opened in firewall. I do not want this solution. 
Okay Okay

Open configuration file of postfix. /etc/postfix/main.cf
Check the parameter inet_interface, it should be
inet_interface=all
Now restart postfix again. It will be listed in opened port list.

lvm device not found in /dev/mapper

lvm device is missing. lvm Volume status is not available. Missing Volume.

If you are not able to find your logical volume (lvm device), check the status of the device or volume.
Run command
lvdisplay
If LV status is Not Available, it will not be listed in /dev/mapper or your lvm device directory.
Make the status available, Run command
vgchange -a y
It makes status available of all volumes.

Now the device will be visible in /dev/mapper or your lvm device directory.
Mount the device using
mount -t ext4 /path/of/the/lvm/device /path/of/mounted/location
Suppose I want to mount vg-lv_home in /home, I run
mount -t ext4 /dev/mapper/vg-lv_home /home
Now I can see all my files of the volume in /home

lvm commands not found

-bash: pvscan: command not found
-bash: lvdisplay: command not found
-bash: vgcreate: command not found
-bash: lvcreate: command not found
-bash: lvscan: command not found
-bash: pvdisplay: command not found
-bash: lvm: command not found

If you are using CentOS or fedora or RHEL and you are getting these errors again and again when you try to run lvm commands. It means lvm is not installed or corrupted on your system. Reinstall lvm again.
yum install lvm2
If it is not able to find lvm2 package and shows
No package lvm2 available.
It means your repositories do not have this package.
Enable appropriate repository like base, remi, rpmforge or epel and install it again.

If you have enabled all available repositories and still it shows "No package available."
Check the file /etc/yum.conf

The lvm2 package should not be there in exclude packages.
Repos do not list exclude packages and do not install them. If it is under exclude attribute, remove it and run install command again.
It should be installed.

Create Case insensitive databases and tables in mysql

Linux is case sensitive system. You can create Test or test or tesT files in same directory.
That's why you can create Test and teST both databases in mysql.
But if you do not want case sensitivity while creating databases and tables in mysql. Here is solution for you.

Add following attribute in the file my.cnf
lower_case_table_names = 1
Restart mysql.
It disables case sensitivity. Now you can not create linuxamination or Linuxamination or LinuXamination all three databases. You can create any one of three. Same rule is applicable for tables.

If you do not want this feature, remove this line or set the attribute 0.

Configure: error: not found. Please provide a path to MagickWand-config or Wand-config program. ERROR: `/tmp/pear/temp/imagick/configure --with-imagick' failed

/tmp/pear related errors while installing imagick

If you are facing this error in Ubuntu or Debian
sudo apt-get install libmagickwand-dev libmagickcore-dev
If you are facing this error in fedora or CentOS
sudo yum install imagemagick php-magickwand php-pecl-imagick