Tuesday, August 16, 2016

Centos YUM repo file

[root@host-172-17-95-73 yum.repos.d]# cat cent64.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedora.org/pub/epel/5/$basearch
baseurl=http://mirror.karneval.cz/pub/linux/fedora/epel/6/x86_64
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

[centscl]
name=Centos 6 scl
baseurl=http://176.124.110.3/centos/5/os/x86_64/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
#failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5
gpgcheck=0

[centos]
name=Centos Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
baseurl=http://176.124.110.3/centos/5/os/x86_64/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
#failovermethod=priority
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5
gpgcheck=0

Wednesday, December 2, 2015

Java options for taking heap dump on Out of memory

Java options for taking heap dump on Out of memory

javaoptions="-XX:MaxPermSize=4096m -Xms1024m -Xmx4096mm -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger -Dmail.mime.applefilenames=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/heap/"

Add these two options and start jetty, when you want to take heap dump on out of memory exception:

-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/opt/heap/"

Thursday, October 29, 2015

Python any version installation with wget

Python any version installation without yum:

# Python 2.7.6:
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

# Python 3.3.5:
wget http://python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
tar xf Python-3.3.5.tar.xz
cd Python-3.3.5
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

https://www.python.org/ftp/python/

http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/


Thursday, October 8, 2015

Cannot remove virtual disk because it is used by "TransferVM for VDI "

You run in to this issue when you are trying to copy/migrate a VM and that operation is interrupted due to what ever reason. You are now stuck with two disks for a VM and the TransferVM has the same VDI as your actual disk.

As a result, when you try to start your VM, you run in to the "This operation cannot be performed because a VDI is in use by some other operation" error


Solution: Remove the "TransferVM for VDI <vdi-number> " disk and start your VM as usual.


Step 1:Get the VM UUID - You don't want to destroy this:

Use "xe vm-list" command

uuid ( RO): 6db58f7d-c411-2b12-a244-9fe2ed866017
name-label ( RW): Deepti2
    power-state ( RO): halted

Step 2:Get the vdi details from "xe vdi-list" command


uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
name-label ( RW): Deepti2
    name-description ( RW): Created by template provisioner
sr-uuid ( RO): 686852f4-9ce7-e6a7-3c45-eb05963c7db8
virtual-size ( RO): 16106127360
sharable ( RO): false
read-only ( RO): false


Step 3: Get the list of VM's tagged to the VDI


[root@DeeptiTest ~]# xe vbd-list vdi-uuid=af2b63e7-b110-4258-b027-8c44aa42e5d3
uuid ( RO)             : c6bb40f8-682b-09a4-4827-8c7f539b27bf
          vm-uuid ( RO): 759ef766-d6a5-67e0-c42b-f389cef3ddb3
    vm-name-label ( RO): Transfer VM for VDI af2b63e7-b110-4258-b027-8c44aa42e5d3
         vdi-uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
            empty ( RO): false
           device ( RO): xvdb


uuid ( RO)             : 9f699636-03f0-0f0d-5419-c0cf352f3dc6
          vm-uuid ( RO): 6db58f7d-c411-2b12-a244-9fe2ed866017
    vm-name-label ( RO): Deepti2
         vdi-uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
            empty ( RO): false
           device ( RO): xvda

Step 4: Shutdown the vdi disks that you don't need

[root@DeeptiTest ~]# xe vm-shutdown --force vm=759ef766-d6a5-67e0-c42b-f389cef3ddb3

Step 5: Destroy the vm that you don't need. 


[root@DeeptiTest ~]# xe vm-destroy uuid=759ef766-d6a5-67e0-c42b-f389cef3ddb3

Step 6: Recheck


[root@DeeptiTest ~]# xe vbd-list vdi-uuid=af2b63e7-b110-4258-b027-8c44aa42e5d3

uuid ( RO)             : 9f699636-03f0-0f0d-5419-c0cf352f3dc6
          vm-uuid ( RO): 6db58f7d-c411-2b12-a244-9fe2ed866017
    vm-name-label ( RO): Deepti2
         vdi-uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
            empty ( RO): false
           device ( RO): xvda

Start the VM and it should start!

Thursday, July 16, 2015

Useful yum options

 yum distribution-synchronization : Synchronize installed packages to the latest available versions

[root@localhost yum.repos.d]# cat rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Set enabled=1 to enable the repo


Yum help. Nothing much. For self reference

[root@localhost yum.repos.d]# yum
Loaded plugins: product-id, subscription-manager
Updating certificate-based repositories.
You need to give some command
Usage: yum [options] COMMAND

List of Commands:

check          Check for problems in the rpmdb
check-update   Check for available package updates
clean          Remove cached data
deplist        List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade      downgrade a package
erase          Remove a package or packages from your system
groupinfo      Display details about a package group
groupinstall   Install the packages in a group on your system
grouplist      List available package groups
groupremove    Remove the packages in a group from your system
help           Display a helpful usage message
history        Display, or use, the transaction history
info           Display details about a package or group of packages
install        Install a package or packages on your system
list           List a package or groups of packages
load-transaction load a saved transaction from filename
makecache      Generate the metadata cache
provides       Find what package provides the given value
reinstall      reinstall a package
repolist       Display the configured software repositories
resolvedep     Determine which package provides the given dependency
search         Search package details for the given string
shell          Run an interactive yum shell
update         Update a package or packages on your system
upgrade        Update packages taking obsoletes into account
version        Display a version for the machine and/or available repos.


Options:
  -h, --help            show this help message and exit
  -t, --tolerant        be tolerant of errors
  -C, --cacheonly       run entirely from system cache, don't update cache
  -c [config file], --config=[config file]
                        config file location
  -R [minutes], --randomwait=[minutes]
                        maximum command wait time
  -d [debug level], --debuglevel=[debug level]
                        debugging output level
  --showduplicates      show duplicates, in repos, in list/search commands
  -e [error level], --errorlevel=[error level]
                        error output level
  --rpmverbosity=[debug level name]
                        debugging output level for rpm
  -q, --quiet           quiet operation
  -v, --verbose         verbose operation
  -y, --assumeyes       answer yes for all questions
  --version             show Yum version and exit
  --installroot=[path]  set install root
  --enablerepo=[repo]   enable one or more repositories (wildcards allowed)
  --disablerepo=[repo]  disable one or more repositories (wildcards allowed)
  -x [package], --exclude=[package]
                        exclude package(s) by name or glob
  --disableexcludes=[repo]
                        disable exclude from main, for a repo or for
                        everything
  --obsoletes           enable obsoletes processing during updates
  --noplugins           disable Yum plugins
  --nogpgcheck          disable gpg signature checking
  --disableplugin=[plugin]
                        disable plugins by name
  --enableplugin=[plugin]
                        enable plugins by name
  --skip-broken         skip packages with depsolving problems
  --color=COLOR         control whether color is used
  --releasever=RELEASEVER
                        set value of $releasever in yum config and repo files
  --setopt=SETOPTS      set arbitrary config and repo options

  Plugin Options:

Yum Fix package problems:


Error that I was facing:
"pre-existing rpmdb problem(s), 'yum check' output follows"

The following commands fixed it:
https://www.centos.org/forums/viewtopic.php?t=2576


  • yum clean all 
  • rpm --rebuilddb
  • yum update
  • yum reinstall glibc glibc-common libgcc
  • yum upgrade
  • yum install yum-utils
  • package-cleanup --problems
  • package-cleanup --dupes
  • yum clean all