Friday, 24 July 2015

Webacula Monitoring getting blank page/ How to get the Webacula login page

When you run webacula monitoring :
1.If you get the blank page then check the below command
#psql -h localhost -U postgres -d bacula
the output should be:
psql (9.2.4)
Type "help" for help.

if you get the error like below:
psql: could not connect to server : connection refused.
Is the server running on the localhost and accepting Tcp/Ip connection on port 5432?
Then run the below command
#setsebool -P httpd_can_network_connect 1
And disable selinux:
#cd /etc/sysconfig
#vi selinux
Add the below line and save the file
#SELINUX=enforcing /* comment this line*/
2.Error: In /etc/httpd/conf.d/errorlog /var/www/html/webacula/data/cache not exists
Solution: #chmod -R 777 /var/www/html/webacula/data/cache

3.Error: httpd could not reliably determine the server's fully qualified domain
Solution: Add the below line in /etc/httpd/conf/httpd.conf
#cd /etc/httpd/conf
#vim httpd.conf
ServerName localhost
And save the file.
Now restart the httpd
#service httpd restart

4.While creating postgresql tables if you get the error like below
role “root” does not exist
#su – postgres
Now create postgresql tables.

5.Check the webacula tables
#su – postgres
#\c bacula
Owner of webacula tables should be postgres otherwise change it.
#ALTER TABLE <table name> OWNER TO postgres;
like this do for all tables.

httpd could not reliably determine the server's fully qualified domain

Error: httpd could not reliably determine the server's fully qualified domain

Solution: Add the below line in /etc/httpd/conf/httpd.conf
#cd /etc/httpd/conf
#vim httpd.conf
ServerName localhost
And save the file.
Now restart the httpd
#service httpd restart

How to upgrade firefox on centos6/Rhel/Fedora

Download repo:

#rpm -Uvh epel-release-6-8.noarch.rpm 
#rpm -Uvh remi-release-6.rpm 
#yum --enablerepo=remi list firefox
#yum --enablerepo=remi install firefox
#cd /usr/local
Download firefox 36: 
#tar xvjf firefox-36.0.1.tar.bz2
#ln -s /usr/local/firefox/firefox /usr/bin/firefox
#firefox &

Errors And Fixes While booting

When I start the centos 6.2 system centos6 logo stucked it didn't give the login prompt
So, I restart the system by CTRL+ALT+DELETE and i pressed the ESC key when circle had come
to see the errors.
The errors are:
  • unexpectedly disconnected from boot status daemon
  • init: prefdm respawning too fast,stopped
In my system may be These errors are because httpd remove/update.

Before this I did following:
I removed httpd by #yum remove httpd*
after that I installed httpd-2.4.10 source file by following some steps.
After i reboot the system i got the above errors.

There are two ways to fix these errors:
  • by rescue installed system from centos 6.2 dvd
  • by upgrade an existing system from centos 6.5 dvd
Rescue installed system:
  • Insert centos 6.2 dvd
  • press F10 key
  • select cd/dvd sta
  • select rescue installed system
  • Language English OK
  • US OK
  • Drive Local cd/dvd OK
  • Enable network interface OK
  • Configure network IPv4 settings manually by giving IP address,Gateway and Nameserver
  • after that press OK until you get command line prompt like bash4.1$
  • $chroot /mnt/sysimage
  • #yum remove httpd*
  • you have to install httpd-2.2.15-29.el6.centos.x86_64
  • Download following rpm packages in another linux system
  • In that goto downloads copy the above three files to one folder and copy that folder to Desktop
  • compress the folder to .zip(
  • now open terminal
  • #cd /root/Desktop
  • ftp /*your system ip address*/
  • ftp>cd /root
  • ftp>bin
  • ftp>hash
  • ftp>prompt
  • ftp>mput
  • ftp>bye
  • now from your system #cd /root
  • #unzip
  • #rpm -ivh httpd-2.2.15-29.el6.centos.x86_64.rpm
  • #rpm -ivh httpd-devel-2.2.15-29.el6.centos.x86_64.rpm
  • #rpm -ivh httpd-tools-2.2.15-29.el6.centos.x86_64.rpm
  • #sync
  • #exit
  • #reboot
hence problem solved

Description about display manager/How to change display of Centos 6/Rhel/Fedora

There is a configuration file called /etc/sysconfig/desktop. This file defines default display manager and desktop name.
Display manager can be any one of the following:
[a] gnome (gdm)
[b] kde (kdm)
[c] xdm (xdm)
Desktop can be any one of the following
[a] KDE
[c] XFCE
Specifying GNOME as a display manager will invoke GDM.
Upon boot, the system will run /etc/init/prefdm.conf which will in turn call the "Preferred Display Manager" (prefdm) script /etc/X11/prefdm which will utilize the settings in /etc/sysconfig/desktop if available.

How to upgrade centos 6.2 to centos 6.5

Upgrade an existing system:
  • Insert centos 6.5 DVD
  • Press F10
  • Select Install or upgrade an existing system
  • skip
  • Next
  • English Next
  • U.S English Next
  • Select Basic storage devices Next
  • Select upgrade an existing system Next
  • Select Create a new bootloader Next
  • Select centos 6.5 Install
Hence problem solved
After this if you didn't get GUI then
#vi /etc/inittab
Replace 3 with 5 in the last line id:5
now you will get the gui
If you feel the desktop is different from the desktop before you used then follow below steps
#vim /etc/sysconfig/desktop

Installing Grub using grub-install: in rescue installed system centos 6/Rhel/Fedora

#df -h

check the filesystem name of /boot

#cd /sbin

#grub-install /dev/sda5 /* where /dev/sda5 is /boot filesystem name*/


Installation finished. No error reported.

This is the contents of the device map /boot/grub/

Check if this is correct or not. If any of the lines is incorrect,

fix it and re-run the script `grub-install'.

# this device map was generated by anaconda

(hd0) /dev/sda


unexpectedly disconnected from boot status daemon init: prefdm respawning too fast,stopped

Installing boot loader only using grub:in rescue installed system centos 6/Rhel/Fedora

# grub

Probing devices to guess BIOS drives. This may take a long time.

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB

lists possible command completions. Anywhere else TAB lists the possible

completions of a device/filename.]

grub> find /boot/grub/stage1



grub> root (hd0,5)

Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)

Checking if "/boot/grub/stage1" exists... yes

Checking if "/boot/grub/stage2" exists... yes

Checking if "/boot/grub/e2fs_stage1_5" exists... yes

Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 15 sectors are embedded.


Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p


/boot/grub/grub.conf"... succeeded


grub> quit


hence problem solved.


$ yum install postgresql-* openldap-servers-sql openldap-clients

$ su - postgres

$ initdb -D /var/lib/pgsql/data

$ postmaster -D /var/lib/pgsql/data &

$ exit

$ cat /etc/odbc.ini

[ODBC Data Sources]




Description=Connection to LDAP/Postgresql













$ cat /etc/odbcinst.ini


Description     = ODBC for PostgreSQL

Driver          = /usr/lib/

FileUsage       = 1

$ cd /usr/share/doc/openldap-servers-sql-2.3.43/rdbms_depend/pgsql

$ cp * /var/lib/pgsql/data 

$ cat /etc/openldap/slapd.conf

include         /etc/openldap/schema/core.schema

include         /etc/openldap/schema/cosine.schema

include         /etc/openldap/schema/inetorgperson.schema

include         /etc/openldap/schema/misc.schema

include         /etc/openldap/schema/nis.schema

include         /etc/openldap/schema/openldap.schema

include         /etc/openldap/schema/samba.schema

access to *

        by self write

        by * read

access to * by dn="cn=root,dc=example,dc=com" write         

pidfile         /var/run/openldap/

argsfile        /var/run/openldap/slapd.args

modulepath      /usr/lib/openldap


database        sql

suffix         "dc=example,dc=com"

rootdn         "cn=root,dc=example,dc=com"

rootpw          secret

dbname          PgSQL

dbuser          test

dbpasswd        test

insentry_query  "insert into ldap_entries (id,dn,oc_map_id,parent,keyval) values ((select max(id)+1 from ldap_entries),?,?,?,?)"

upper_func      "upper"

strcast_func    "text"

concat_pattern  "?||?"

has_ldapinfo_dn_ru      no         

lastmod off

$ su - postgres

$ cd /var/lib/pgsql/data

$ createdb pg_ldap

$ createuser --no-createdb --no-createrole --no-adduser --password test

$ psql -d pg_ldap < backsql_create.sql

$ psql -d pg_ldap < testdb_create.sql

$ psql -d pg_ldap < testdb_metadata.sql

$ psql -d pg_ldap < testdb_data.sql

$psql -d pg_ldap -c "GRANT ALL ON ldap_attr_mappings,ldap_entries,ldap_entry_objclasses,ldap_oc_mappings,referrals,certs TO test1;"

 $psql -d pg_ldap -c "GRANT ALL ON ldap_attr_mappings_id_seq,ldap_entries_id_seq,ldap_oc_mappings_id_seq,referrals_id_seq TO test1;"

$psql -d pg_ldap -c "GRANT ALL ON authors_docs,documents,institutes,persons,phones TO test1;"

$ psql -d pg_ldap -c "GRANT ALL ON documents_id_seq,institutes_id_seq,persons_id_seq,phones_id_seq TO test1;"

$ exit

$ /etc/init.d/ldap start

$ ldapsearch -x -h localhost -b "dc=example,dc=com" "(objectClass=*)"

$ echo ‘dn: cn=Test Entry,dc=example,dc=com

objectClass: inetOrgPerson

cn: Test Entry

sn: Entry

givenName: Test’>1.ldif

$ ldapadd -x -h localhost -D “cn=root,dc=example,dc=com” -w secret -f 1.ldif

Thursday, 23 July 2015

How to Install uPortal 4+Postgresql+Centos6/Rhel/Fedora

Uportal Installation and Configuration

Download uPortal 4.2 from the below link:

uPortal Dependencies:
  • apache-ant-1.8.2
  • Centos 6.5
  • apache-maven-3.0.5
  • apache-tomcat-7.0.59
  • Java 7
  • Postgresql
Download links:



#cp /root/Downloads/apache-ant-1.8.2-bin.tar.gz /opt/uportal_dep

#cp /root/Downloads/apache-maven-3.0.5-bin.tar.gz /opt/uportal_dep

#cp /root/Downloads/apache-tomcat-7.0.59.tar.gz /usr/local

#cd /usr/local

#mv apache-tomcat-7.0.59 uPortal_tomcat

#vim ~/.bashrc

add below lines:
export ANT_HOME=/opt/uportal_dep/apache-ant-1.8.2
export M2_HOME=/opt/uportal_dep/apache-maven-3.0.5
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export JAVA_HOME=/usr
export TOMCAT_HOME=/usr/local/uPortal_tomcat

and save it by :wq
#source ~/.bashrc

#vim /usr/local/uPortal_tomcat/conf/


and save it by :wq

#vim /usr/local/uPortal_tomcat/bin/

export JAVA_OPTS="$JAVA_OPTS -XX:+PrintCommandLineFlags -XX:MaxPermSize=384m -Xms1024m -Xmx1024m -Djsse.enableSNIExtension=false"

and save it by :wq

#vim /usr/local/uPortal_tomcat/bin/

export CATALINA_OPTS=”-Xms512M -Xmx1024M”

and save it by :wq

#su – postgres


=#create database uportal;

=#create user uportal with password 'uportal';

=#grant all privileges on database uportal to uportal;



#cd /opt

#cp /root/Downloads/uPortal-4.2.0-M1.tar.gz /opt

#tar -zxvf uPortal-4.2.0-M1.tar.gz

#cd uPortal-4.2.0-M1

#cd uportal-db

#vim pom.xml

uncomment postgresql dependency
if your postgresql is below 9.2 version then it should be

if your postgresql is 9.2 later then it should be

#cd /opt/uPortal-4.2.0-M1/filters


comment hsql lines
add postgresql below lines
## Database Connection Settings (Uncomment the Maven Filters section in 1

and save it by :wq

#cd /opt/ uPortal-4.2.0-M1




and save it by :wq

#cd /opt/uPortal-4.2.0-M1

#ant dbtest > antdbtest.log &

#tail -f antdbtest.log

After getting build successful

#ant clean initportal > antinit.log &

After getting build successful
Restart Tomcat as below

#cd /usr/local/uPortal_tomcat

#cd bin


check whether tomcat process is running or not by

#ps -efa | grep tomcat

check whether any process is running at port 8080 by

#netstat -tlnp | grep '8080'


open the web browser and check



Wednesday, 22 July 2015

Forgot Rootpassword / How to Reset Root Password

In this post will guide you simple steps to reset forgotten root password in RHEL, CentOS and Fedora Linux with example. There are various ways to reset root password which are.
  1. Booting into single user mode.
  2. Using boot disk and edit passwd file.
  3. Mount drive to another system and change passwd file.
 STEP 1. Boot Computer and Interrupt while booting at GRUB stage hitting   ‘arrow‘ keys or “space bar“.

 STEP 2. Type ‘a‘ to modify kernel argument. Anytime you can cancel typing ‘ESC‘ key.

 STEP 3. Append 1 at the end of “rhgb quiet” and press “Enter” key to boot into single user mode.

 STEP 4. Type command “runlevel” to know the the runlevel  

 STEP 5. Type ‘passwd‘ command without username and press ‘Enter‘ key in command prompt. It’ll ask to supply new root password and re-type the same password for confirmation. “Your are Done” Congratulation!!!where you are standing. Here “1 S” state that your are in a single user mode.

Infinite Arithmetic Precision Shell Script/arithmetic operations


sum=$(echo $a + $b | bc)
echo $sum
sum=$(echo $a - $b | bc)
echo $sum
sum=$(echo $a \* $b | bc)
echo $sum
sum=$(echo $a / $b | bc)
echo $sum
echo "Enter any Two Numbers:"
read  a b
echo $a $b
addition $a $b
subtraction $a $b
multiplication $a $b
division $a $b

Tuesday, 21 July 2015

How to Encrypt files on centos6/Rhel/Fedora

GNU Privacy Guard (GnuPG) is the backend encryption engine.

Before you can use Gnupg you need to create key pair by "gpg --gen-key"

#gpg --gen-key

gpg (GnuPG) 2.0.14; Copyright (C) 2009 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)

Your selection? 1

RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 1024
Requested keysize is 1024 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years

Key is valid for? (0) 2

Key expires at Fri 24 Jul 2015 10:58:51 AM IST
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: shaurya

Email address: xxxxxxxxxx


You selected this USER-ID:
    "shaurya (xxxxxxxxxxxxxxx) <xxxxxxxxxx>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o

You need a Passphrase to protect your secret key.
gpg: problem with the agent: Not implemented
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 44759702 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2015-07-24
pub   1024R/44759702 2015-07-22 [expires: 2015-07-24]
      Key fingerprint = 06EE 569F DC55 18F0 4E4C  16E3 64D6 389C 4475 9702
uid                  shaurya (xxxxxxxxxxx) <xxxxxxxxxxxxxxx>
sub   1024R/45D6A561 2015-07-22 [expires: 2015-07-24]

To encrypt "gpg --encrypt --default-recipient-self filename"

[root@sk ~]# gpg --encrypt --default-recipient-self test.txt


And this will create filename.gpg which is encrypted.

How to Install yad(shell script gui) on centos6/Rhel/Fedora

YAD  is a program that will display GTK+ dialogs, and return (either in the return code, or on standard output) the users input. This allows you
to present information, and ask for information from the user, from all manner of shell scripts.

YAD is the fork of Zenity program.

#cd /opt


#tar -xvf yad-0.25.1.tar.xz

#cd yad-0.25.1



#make install

you can read manual of yad by below command

#man yad /*for how to use*/

examples for how to use yad

#yad --calendar

example script to get the


frmdata=$(yad --title "Login" --form --field "Username" --field="Password")

frmaddr=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $1 }')
frmname=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $2 }')

echo $frmaddr > test.txt
echo $frmname >> test.txt

cannot change directory in ftp

#500:oops: cannot change directory.


...check selinux status

#getsebool -a | grep ftp

check for ftp_home_dir----off

#setsebool -P ftp_home_dir 1 (or ON)

How to install Microsoft TrueType Fonts in CentOS 6 / RHEL 6

[root@dha Desktop]$ su root 



[root@dha Desktop]/# wget 

nstall rpm package.


[root@dha Desktop]# rpm -Uvh msttcore-fonts-2.0-3.noarch.rpm

Software Installation Through YUM getting error

ERROR : Cannot retrieve  metalink for repository:epel. please verify its  path and try again.

Run Following Commands In  your Terminal

#sed -i "s/mirrorlist=https/mirrorlist=http/" /etc/yum.repos.d/epel.repo

# yum check-update

 Running this command will update the repo to use http rather than https

Monday, 20 July 2015

How to Install TeamViewer 10 on CentOS, RHEL & Fedora

1.Install TeamViewer on CentOS, RHEL & Fedora
#yum install
#cd /opt
#rpm --import
#yum install
#rpm -Uvh teamviewer.i686.rpm
2.Launch TeamViewer

Webacula Installation and Configuration with postgresql on Centos 6

Install Apache Server:

#yum install httpd
#chkconfig httpd on
#service httpd start

1.Download webacula-7.0.0 from the below link.

2.Untar the file.
#cd /root/Downloads
#tar -zxvf webacula-7.0.0.tar.gz

3.copy the directory to /var/www/html
#cp webacula-7.0.0 /var/www/html/

4.Rename the directory.
#mv webacula-7.0.0 webacula

5.Check the System Requirements.
#cd /var/www/html/webacula/install/

Webacula check System Requirements...

Current MySQL version = 5.5.41 OK
Current PostgreSQL version = 9.2.4 OK
Current Sqlite version = 3.6.20 OK

Current PHP version = 5.3.3 OK

php pdo installed. OK
php gd installed. OK
php xml installed. OK
php dom installed. OK

Warning. PHP extension pdo_mysql not installed.
php pdo_pgsql installed. OK
php pdo_sqlite installed. OK
php-dom, php-xml installed. OK

7.I am using postgresql database so, i am ignoring this warning.

8.If you don't have these requirements then you can install by the below commands.
Go to website and search for php-pgsql-5.3.3-40.el6_6.x86_64.
Download that package.
Install by the below command.
#rpm -ivh php-pgsql-5.3.3-40.el6_6.x86_64
It will ask for Dependency Packages.
So,you have to install dependency packages also.
Download all the below packages from

After downloading all packages install by the below command.
#rpm -ivh <package name>

9.After installing all packages again check_system_requirements.

10.Download ZendFramework-1.11.5-minimal. Copy the directory ZendFramework-1.11.5-minimal/library/Zend to /var/www/html/webacula/library/
#cp ZendFramework-1.11.5-minimal/library/Zend /var/www/html/webacula/library/

11.Go to directory /var/www/html/webacula/application
#cd /var/www/html/webacula/application
Edit the config.ini file.
#vim config.ini
change the below lines as following:

db.adapter = PDO_PGSQL = localhost
db.config.username = postgres
db.config.password = postgres
db.config.dbname = bacula

def.timezone = "Asia/Kolkata"

bacula.sudo = ""
bacula.bconsole = "/opt/bacula/bin/bconsole"
bacula.bconsolecmd = "-n -c /opt/bacula/bin/bconsole.conf"

Create system group account (if not yet created) :
#groupadd bacula

Add apache to group:
usermod -aG bacula apache

Without using sudo
chown root:bacula /opt/bacula/bin/bconsole
chmod u=rwx,g=rx,o= /opt/bacula/bin/bconsole
chown root:bacula /opt/bacula/bin/bconsole.conf
chmod u=rw,g=r,o= /opt/bacula/bin/bconsole.conf

Edit application/config.ini
bacula.sudo = ""
bacula.bconsole = "/opt/bacula/bin/bconsole"

Here I am using without sudo.

With sudo

Edit application/config.ini
bacula.sudo = "/usr/bin/sudo"
bacula.bconsole = "/opt/bacula/sbin/bconsole"
Run visudo and changes

# (!!! comment here !!!) Defaults requiretty
apache ALL=NOPASSWD: /opt/bacula/sbin/bconsole
Check out the run bconsole :

# su -l apache -s /bin/sh \
-c "/usr/bin/sudo /opt/bacula/sbin/bconsole -n -c /opt/bacula/etc/bconsole.conf"

Edit webacula.conf

#cd /var/www/html/webacula/install/apache
#vim webacula.conf
Change the paths to /var/www/html instead of /usr/share.
Copy the file to /etc/httpd/conf.d/webacula.conf
#cp /var/www/html/webacula/install/apache/webacula.conf /etc/httpd/conf.d/webacula.conf

mod rewrite
Setup mod rewrite see html/.htaccess.
Edit RewriteBase parameter if
NOTE. Specific directories on your system may be different.
Check mod rewrite installed :
$ apachectl -t -D DUMP_MODULES 2>&1 | grep rewrite
rewrite_module (shared)

Increase values in /etc/php.ini :
memory_limit = 32M
max_execution_time = 3600

Edit db.conf file
#cd /var/www/html/webacula/install/
#vim db.conf
To set webacula_root_pwd you have to come out of the file and do like below
#./password-to-hash.php password
whatever your pssword is type instead of password in the above command.
Copy the output and pasteit into webacula_root_pwd in db.conf file.
Save the file by :wq

Next create Webacula tables, Webacula built-in roles and Webacula built-in

For MySQL:
#cd install/MySql

For PostgreSQL:
#cd install/PostgreSql

For Sqlite:
#cd install/SqLite

And further run scripts for your DBMS is running on localhost:

Now you can run webacula monitoring by