Sunday 12 June 2016

Install VLC PLAYER IN CENTOS

  1. rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  2.  
  3. rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
  4.  
  5. yum info vlc
  6. yum install vlc

Wednesday 21 October 2015

Reinstall a corrupted or destroyed boot partition. How to install Adobe Reader on Centos 6

How to install Adobe Reader on Centos 6

yum localinstall http://linuxdownload.adobe.com/linux/i386/AdbeRdr9.5.5-1_i486linux_enu.rpm

                    or

yum localinstall http://linuxdownload.adobe.com/linux/x86_64/adobe-release-x86_64-1.0-1.noarch.rpm

cannot create key change index database disk image is malformed

#yum clean all

#yum clean metadata

#yum clean dbcache

or

#yum history new

then
#yum makecache

Yum segmentation fault ( core dumped )

#rm -rf /var/lib/rpm/__db.* 
 
#rpm --rebuilddb 
 
#yum clean all 
 
#yum makecache

Scriptlet failed exit status 1

Run the following command

#rpm -e package-name --noscripts

Error : cannot retreive metalink for repository : epel. Please verify its path and try again

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

Running these commands will update the repo to use HTTP rather than HTTPS

ftp issue 500: oops : cannot change directory

#getenforce ( Selinux status )
enforcing ( if output)

#getsebool -a | grep ftp

check for ftp_home_dir ---- off
if it is in off state then
#setsebool -P ftp_home_dir 1 ( or on )

hence problem solved

Reinstall a corrupted or destroyed boot partition.


Lately I have had a couple of systems where the boot partition got corrupted or it's contents
deleted mistakenly. Even though I could not boot the system, I did not want to reinstall the whole
system and recover the data from backups.

1. Boot the computer into rescue mode with the relevant CD/DVD by typing "linux rescue" at the boot prompt.
2. Mount the / partition of the system. On CentOS this is automatically done and the / is mounted on /mnt/sysimage.
Otherwise just do (assuming the root partition is on /dev/sda2)
mount /dev/sda2 /mnt/sysimage
3. Chroot into the old root partition since that is where we actually want to make all the changes
chroot /mnt/sysimage
4. If the filesystem labels got deleted up for some reason or they don't agree with what is described in /etc/fstab we should fix that (Assuming the boot partition is /dev/sda1):
e2label /dev/sda1 /boot
5. Make sure the boot partition is mounted:
mount /dev/sda1 /boot
6. Mount the CD-ROM we used to boot the machine
mkdir /media/cdrom
mount -o loop,ro /dev/hdc /media/cdrom
7. Now we need to install the relevant rpms. Make sure you pick the correct kernel for your configuration system (PAE etc..):
cd /media/cdrom/CentOS (this will vary depending on the distro)
rpm -ivh --force kernel-2.6.18-164.el5.i686.rpm
rpm -Uvh --force grub-0.97-13.5.i386.rpm
rpm -Uvh --force redhat-logos-4.9.99-11.el5.centos.noarch.rpm
8. Install GRUB:
grub-install /dev/sda1 (or whichever partition boot is mounted on)
9. If /boot/grub/grub.conf is also lost, you need to create it manually.
vim /boot/grub/grub.conf default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS
        root (hd0,0)
        kernel /vmlinuz-6.18-164.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-164.el5.img
10. Lastly make a soft link to grub.conf:
cd /boot/grub
ln -s grub.conf menu.lst
Reboot the system and if everything goes well it should boot normally. Run immediately a yum upgrade incase you had to install an older version of the kernel from the CD-ROM.

Wednesday 12 August 2015

How to Set or Increase Memory Heap Size in Apache Tomcat



By default Tomcat server sets its own memory heap size 64MB but its not

enough for run your application, so we can set size  by CATALINA_OPTS or  

JAVA_OPTS,

-Xmx   set Maximum Java Heap Size
-Xms   set Initial Java Heap Size

Option 1:

Open the catalina.sh script file under $CATALINA_HOME/bin/catalina.sh

directory assign it,


1
2
export CATALINA_OPTS="-Xms128M -Xmx512M"

or simply export,
1
2
export CATALINA_OPTS="-Xms128M -Xmx512MB"

The heap size has been set to Minumum 128MB and maximum 512MB

Option 2:

$CATALINA_HOME/bin/setenv.sh


Another option is create a setenv.sh file and add below line,
1
2
export CATALINA_OPTS="${CATALINA_OPTS} -Djava.awt.headless=true -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Xms128m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=950m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

or
1
export CATALINA_OPTS="-Xms128M -Xmx512MB"


You might restart tomcat server,
 
# pkill -9 java

# /usr/local/apache-tomcat/bin/startup.sh

# ps aux | grep java
1
2
3
root      9447  1.1 13.2 2127844 543868 ?      Sl   17:20   3:38 /usr/java/jdk1.7.0/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/local/tomcat7/conf/logging.properties -Djava.awt.headless=true -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Xms128m -Xmx512m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -Djava.endorsed.dirs=/usr/local/tomcat7/endorsed -classpath :/usr/local/tomcat6/bin/bootstrap.jar:/usr/local/tomcat7/bin/commons-logging-api.jar -Dcatalina.base=/usr/local/tomcat7 -Dcatalina.home=/usr/local/tomcat7 -Djava.io.tmpdir=/usr/local/tomcat6/temp org.apache.catalina.startup.Bootstrap start
root     12761  0.0  0.0 103244   868 pts/0    S+   22:24   0:00 grep java

or can use netstat command,
 
# netstat -anp | grep java
1
2
3
4
5
6
7
tcp        0      0 :::8009                     :::*                        LISTEN      9447/java           
tcp        0      0 :::8080                     :::*                        LISTEN      9447/java           
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      9447/java           
tcp        0      0 ::ffff:127.0.0.1:35334      ::ffff:127.0.0.1:3306       ESTABLISHED 9447/java           
tcp        0      0 ::ffff:127.0.0.1:56156      ::ffff:127.0.0.1:3306       ESTABLISHED 9447/java           
unix  2      [ ]         STREAM     CONNECTED     113825 9447/java 


Windows  Server:

To set in windows operating system, Create a setenv.bat file and add the below line,
1
export JAVA_OPTS="-server -Xmx512m"

or
1
set JAVA_OPTS="-Xms256m -Xmx512m"


Error:

If you may get an error java.lang.OutOfMemoryError: PermGen space in both windows or linux system,

Configure the MaxPermSize value in  setenv.sh or catalina.sh like,
1
2
export JAVA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=128m"

If you have changed any configuration might restart tomcat server.

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.
bacula=#
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=disabled
#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
Then
#su – postgres
#psql
#CREATE ROLE root;
#ALTER ROLE root LOGIN;
Now create postgresql tables.

5.Check the webacula tables
#su – postgres
#psql
#\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:
#wget  http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

#rpm -Uvh epel-release-6-8.noarch.rpm 
#wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 
#rpm -Uvh remi-release-6.rpm 
#yum --enablerepo=remi list firefox
 
#yum --enablerepo=remi install firefox
 
#firefox
 
#cd /usr/local
 
Download firefox 36: 
#wget http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/36.0.1/linux-x86_64/en-US/firefox-36.0.1.tar.bz2
 
#tar xvjf firefox-36.0.1.tar.bz2
 
#ln -s /usr/local/firefox/firefox /usr/bin/firefox
 
#firefox &

nmap

#nmap machin_name