Linux Admin Steps Into Management

Linux Admin Steps Into Management -

adding java support ot firefox and chrome

First install the appropriate jre for your system –  http://java.com/en/download/manual.jsp?locale=en

then – as root:

updatedb 
locate libnpjp2.so

for firefox browser:

copy the locate of the file, in my case it was : 
/usr/java/jre1.7.0_51/lib/amd64/libnpjp2.so

cd /usr/lib64/mozilla/plugins
ln -s "location of file" .

example: 
ln -s /usr/java/jre1.7.0_51/lib/amd64/libnpjp2.so .

for chrome: 

cd /opt/google/chrome/
mkdir plugins
cd plugins
ln -s /usr/java/jre1.7.0_51/lib/amd64/libnpjp2.so .

restart both browsers

 

 

Upgrading mysql server on Centos from 5.5 to 5.6

before upgrading make sure to backup the my.cnf file if you wish to use your former settings

cp /etc/my.cnf /etc/my.cnf_bak_`date +%F`

better also to dump the current mysql data to somewhere else for backup.

remove the current mysql:

yum remove mysql55-server mysql55-libs mysql55-devel mysql55-bench mysql55

take note of the other applications this command removes – we would like to reinstall them later.

add the repository for the relvant mysql – 56 in our case:

cd /root/

wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum localinstall mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-server
yum install crontabs mysqltuner yum-cron sysstat postfix

set the service to start on boot:

chkconfig --list mysqld
chkconfig  mysqld on
chkconfig --list mysqld

start the service and upgrade:

service mysqld start
mysql_upgrade

at this point i like to clear the log and restart the mysql to check for errors after the upgrade:

service mysqld stop
echo :> /var/log/mysqld.log
service mysqld start

now you can read the log and check for errors from this fresh upgrade.

if you have a tomcat working with the mysql server, 
better stop the tomcat , clear its logs temp and work folders and restart to have it start clean.

 

 

Technorati Tags: , , ,

wkhtmltopdf install on Centos 6

htlp to pdf

from Google code site – what is wkhtmltopdf :

Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.

All the tutorials I found on the net are how to install it via aptitude, 
but I needed to install from source a specific older version , so this is what i did:

Preperations

install all the needed packages  - these are going to be a big bunch:

yum -y install openssl xorg-x11-server-Xorg openssl-devel qt qt-devel gcc-c++ qtwebkit qtwebkit-devel xorg-x11-server-Xvfb 

Get the code

you can download the source code from https://code.google.com/p/wkhtmltopdf/
I need the 0.9.9 version so I took that one

cd /root
wget "https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9.tar.bz2"
bunzip2 wkhtmltopdf-0.9.9.tar.bz2
tar xvf wkhtmltopdf-0.9.9.tar
cd wkhtmltopdf-0.9.9

 

fix error in code 

there was a problem to compile the code due to a link to a non existing module:

cp wkhtmltopdf.pro wkhtmltopdf.pro_bak
vim wkhtmltopdf.pro 
change line 19 from:
PRL  = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl
to: 
PRL  = $$[QT_INSTALL_LIBS] libQtGui.prl
save and exit 

compile !

qmake-qt4
make
make install

test !

we need to run the wkhtmltopdf in a virtual screen so the test line would look like:

xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltopdf http://www.google.com google.pdf

Technorati Tags: , ,

Postfix queue management – list, debug and clean

Postfix mail server

 

Pstfix mail server and acomulate a queue of stuck emails, 
we monitor them via Nagios and sometime get alerts similar to this one,
there are some methods to take care of this queue:

 

msg_q = 17 warn=10 crit=20
WARNING: mailq is 17 (threshold w = 10)

log into the mail server and use the list command to see the mail queue:

mailq

-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
AAE603481BD 3471 Thu Oct 18 14:44:30  user@domain.com
(connect to outside.com[xxx.xxx.xxx.xxx]: Connection timed out)
user2@outside.com


the Q-id number is the id for the mail , you can read the mail to understnad what it is about and why its stuck with:

postcat -q AAE603481BD

you can delete it with:

postsuper -d AAE603481BD 

 

useful bash loop to delete all mails from do-not-reply@domain.com:

for i in $(mailq | grep -B1 'do-not-reply@domain.com'| grep '^[A-Z,0-9]'| awk '{print $1}')
do 
postsuper -d $i
done

 

 

Technorati Tags: , ,

Finally a Linux jmx query tool that works out of the box!

I've tried many many jmx query tools from the command line, 
windows has the jconsole tool which is a part of the Java binaries pack, and works fine, 
but it is not a command line tool – it has a nice GUI. 

this command line jar works like a charm, 
displays all the beans it finds, and allows you to invoke them , 

take a look at :

http://crawler.archive.org/cmdline-jmxclient/

only the cmdline-jmxclient-0.10.3.jar files is available for some reason, 
searches in google didnt find the newer file at all. 

than you run it with :

java -jar cmdline-jmxclient.jar – SERVER:PORT

to get a listing of all the available beens.

more samples are available on the link above. 

works like a charm!

 

Technorati Tags: , ,

Jumpy KDE on a new T430

The KDE screen kept hanging every few seconds , and it drove me crazy, 
another error I've been seeing is in the messages log:

 

Jul  5 12:34:05 desktop kernel: [ 5807.441851] [drm:i915_hangcheck_ring_idle] *ERROR* Hangcheck timer elapsed… blt ring idle [waiting on 1688990, at 1688990], missed IRQ?
 
which kept repeating all the time.
 
I found a working solution at: 
 
the solution that worked for me is:

On Kernel 2.8.38: /sys/module/i915/parameters/semaphores is set to 0
On Kernel 2.8.39: /sys/module/i915/parameters/semaphores is set to 1

if i do the following:

sudo -i
echo 1 > /sys/module/i915/parameters/semaphores

The Bug is also gone on 2.8.38 …..

If i set semaphores on 2.8.39 to 0 as it is default on 2.8.38, the bug also appears.

 

also there is a comment there talkeing about setting it up in boot through grub (I didnt test this yet though):

 

you can put this option in /etc/default/grub to make the change permanent
replace following line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

by
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.semaphores=1"

 

now my KDE runs just fine :)

 

fix for the autoboot suggestion:

it didnt work, a working solution was to edit the /boot/grub/menu.lst file and add i915.semaphores=1  to the end of the kernel line.

Technorati Tags: , , , ,