Wednesday, December 3, 2014

Java 1.7.x on Debian Squeeze manual install

Recently Oracle made changes in java package license and it will be no longer shipped with Debian. Debian people said that this prevents even updates for old packages to be released. For more information read here:

Here is solution how to install newer java packages manually on Debian Squeeze.

Download the package and unpack it in /usr/lib/jvm/
# zcat jdk-7u71-linux-i586.tar.gz|tar xvf -
# mv jdk1.7.0_71 /usr/lib/jvm/java-1.7
# chown -R root:root /usr/lib/jvm/java-1.7/*
Now use update-alternatives script to add it to /etc/alternatives
# update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-1.7/bin/java" 1
# update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/java-1.7/bin/javaws" 1
# update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-1.7/bin/javac" 1
Now set the new java binaries as default (choose the one with the right path):
# update-alternatives --config java
# update-alternatives --config javac
# update-alternatives --config javaws

Friday, October 24, 2014

Multiboot NetBSD and Debian GNU/Linux with GRUB2

Debian GNU/Linux 8 Jessie Beta2 and NetBSD 7_BETA on the same pc.
Linux is on /dev/sda1
NetBSD partition is on /dev/sda4
Grub is installed on master boot record (/dev/sda).

Edit /etc/grub.d/40_custom and add the following lines:

menuentry "NetBSD 7 on sda4" {
        insmod ufs2
        insmod bsd
        set root=(hd0,4)
        chainloader (hd0,4)+1

Don't forget to do 'update-grub' before rebooting.

Multiboot FreeBSD 10.0 and Debian GNU/Linux using GRUB2

Debian GNU/Linux 8 Jessie Beta2 and FreeBSD 10.0 multiboot with grub2

Linux is on /dev/sda1
FreeBSD partition is on /dev/sda3 (ada0s3a - BSD style)
Grub is installed on master boot record.

Edit /etc/grub.d/40_custom and add the following lines:
menuentry "FreeBSD 10.0" --class freebsd --class bsd --class os {
insmod ufs2
insmod bsd
set root=(hd0,3)
kfreebsd /boot/kernel/kernel
kfreebsd_loadenv /boot/device.hints
set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s3a
set kFreeBSD.vfs.root.mountfrom.options=rw

Don't forget to run 'update-grub' after that and reboot.

Thursday, September 25, 2014

Debian automatic apache redirect to https

This post just show how to enable redirecting all traffic from http://site to https://site. It does NOT cover the part of configuring Apache for SSL

Make mod rewrite enabled in apache:
# ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
Edit /etc/apache2/sites-enabled/000-default
Add the following lines in <VirtualHost *:80> section:
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Save the file and restart the apache web server.

Wednesday, July 30, 2014

Installing dovecot with vpopmail support on Ubuntu 12.04.4 LTS

The problem is that dovecot is not compiled with --with-vpopmail support. Here is step-by-step guide how to make debian package from source.

First you need working vpopmail installed somewhere on the system. Second we need some deb packages installed for the build process:
# apt-get install build-essential dpkg-dev debhelper pkg-config libssl-dev libpam0g-dev libldap2-dev libpq-dev libmysqlclient-dev drac-dev libsasl2-dev libsqlite3-dev libbz2-dev libdb-dev libcurl4-gnutls-dev libexpat-dev hardening-wrapper
Now download the source package:
# apt-get source dovecot
This will get the source and unpack it in current directory
root@mail2:/usr/src/tmp# ls -l
drwxr-xr-x 7 root root    4096 Jul 30 10:53 dovecot-2.0.19
-rw-r--r-- 1 root root 1278258 May 15 17:29 dovecot_2.0.19-0ubuntu2.1.debian.tar.gz
-rw-r--r-- 1 root root    3142 May 15 17:29 dovecot_2.0.19-0ubuntu2.1.dsc
-rw-r--r-- 1 root root 3357056 Apr  8  2012 dovecot_2.0.19.orig.tar.gz
Now enter dovecot directory and edit the file debian/rules. Find the lines:
$(shell dpkg-buildflags --export=configure) sh configure \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
and add another line like this:

 $(shell dpkg-buildflags --export=configure) sh configure \
                 --with-vpopmail \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
Alternatively here is a patch:

--- dovecot-2.0.19/debian/rules    2012-06-29 00:33:07.000000000 +0300
+++ ../dovecot-2.0.19/debian/rules    2014-07-30 10:18:00.469643701 +0300
@@ -25,6 +25,7 @@
     # Dovecot
     $(shell dpkg-buildflags --export=configure) sh configure \
+            --with-vpopmail \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
Now go to unpacked dovecot's directory and build the package:
# dpkg-buildpackage -uc -rfakeroot
You will end up with lot of *.deb files. The one that you need is 'dovecot-core_2.0.19-0ubuntu2.1_i386.deb'. Install it, restart dovecot and use your vpopmail support.
# dpkg -i dovecot-core_2.0.19-0ubuntu2.1_i386.deb
# service dovecot restart

Monday, April 28, 2014

MRTG error on Debian Squeeze

The error:
rogue:~# mrtg /etc/mrtg.cfg
2014-04-28 16:32:17: WARNING: Can not determine ifNumber for public@     ref: 'Name'     key: 'eth0'
2014-04-28 16:32:17: WARNING: Can not determine ifNumber for public@     ref: 'Name'     key: 'eth1'
2014-04-28 16:32:17: ERROR: Target[][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
2014-04-28 16:32:17: ERROR: Target[][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data
2014-04-28 16:32:17: ERROR: Target[][_IN_] ' $target->[1]{$mode} ' did not eval into defined data
2014-04-28 16:32:17: ERROR: Target[][_OUT_] ' $target->[1]{$mode} ' did not eval into defined data
How to fix it:

# cd /var/lib/mrtg
# mv _etc_mrtg.cfg _etc_mrtg.cfg.old

Now run again mrtg /etc/mrtg.cfg - the error is gone.

Monday, April 14, 2014

Lotus Notes 9 on RHEL/CentOS/Oracle Linux

Dependencies needed by ibm_notes-9.0.i586.rpm on RHEL.
# yum install gnome-desktop libatk atk libart art libart_lgpl.i686 libXt.i686 
libzip.i686 libXScrnSaver.i686 libXtst.i686 libXp.i686 libXrender.i686 
libxml2.i686 libxkbfile.i686 libXft.i686 libXcursor.i686 libpng.i686 pam.i68 
libgnomeprintui22.i686 libgnomeprint22.i686 GConf2.i686 ORBit2.i686 
gnome-vfs2.i686 libgnomeui.i686 alsa-lib.i686
Install the package:

 # rpm -i /path/to/ibm_notes-9.0.i586.rpm

Friday, January 10, 2014

Увеличаване на Max opened files под Debian Squeeze.

Трябва да направим следното:

Редактираме /etc/security/limits.conf и за съответният потребител добавяме определените лимити. Примерно:
nginx   soft    nofile  16144
nginx   hard    nofile  18191
За да проработи е нужно и да добавим в /etc/pam.d/common-session следното:
session required
Остава само да рестартираме процесът, който се нуждае от промените по лимитите.