Category Archives: Debian

PostgreSQL 9.3 Debian

To install PostgreSQL 9.3 I used the following steps as root:

echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -c | awk '{print $2}'`-pgdg main" > /etc/apt/sources.list.d/postgre.list &&
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update && apt-get dist-upgrade && apt-get install postgresql-9.3

 

Problem with sudo after upgrade to wheezy

after an upgrade from squeeze to wheezy I had a strange error when using sudo:

dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: error: 2 expected programs not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.

First I tried to fix the /etc/profile to stop it using strange …game folder in my PATH. But the solution was to add the following line just after “Defaults env_reset” in /etc/sudoers:

Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

 

Install Tomcat under Debian

  1. Download Tomcat.
  2. Create /etc/init.d/tomcat as listed below and change properties in it as needed.
  3. Execute the following commands as root.
cd /opt
tar -xf apache-tomcat-7.0.25.tar.gz
ln -s apache-tomcat-7.0.25 tomcat
groupadd tomcat
useradd -g tomcat -d /opt/tomcat tomcat
usermod -G www-data tomcat
chown tomcat:tomcat /opt/apache-tomcat-7.0.25 -R
chmod +x /etc/init.d/tomcat
update-rc.d tomcat defaults

/etc/init.d/tomcat

#!/bin/sh
CATALINA_HOME=/opt/tomcat
export CATALINA_HOME
JAVA_HOME=/opt/jdk1.6.0_25
export JAVA_HOME
TOMCAT_OWNER=tomcat
export TOMCAT_OWNER
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms768m -Xmx768m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m 
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"
export JAVA_OPTS

start() {
  echo -n "Starting Tomcat:  "
  su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh 
}
stop() {
   echo -n "Stopping Tomcat: "
   su $TOMCAT_OWNER -c $CATALINA_HOME/bin/shutdown.sh
}

case "$1" in
start)
   start
   ;;
stop)
   stop
   ;;
restart)
   stop
   start
   ;;
*)
   echo $"Usage: tomcat {start|stop|restart}"
   exit
esac

 

Oracle JDK under Debian

OpenJDK sometimes makes problems, so I still prefer the Oracle version. Here is how to install it manually under debian/ubuntu:

  1. Download binary installer from Oracle’s download page and save it to /opt.
  2. Execute the following commands
cd /opt
chmod +x jdk-6u25-linux-x64.bin
./jdk-6u25-linux-x64.bin
update-alternatives --install /usr/bin/java java /opt/jdk1.6.0_25/bin/java 2000

Debian Bash Completion

If you got used to bash completion under ubuntu and want this feature under debian too, you first have to install the package bash-completion with your favourite package manager.

apt-get install bash-completion

Then add the following to your /etc/profile to enable the feature for all users:

if [ -f /etc/bash_completion ]; then
 . /etc/bash_completion
fi

Your have to relogin after adding this to enable the feature.

Remove MySQL from Ubuntu startup

If you want to remove mysql from your system startup rcconf or sysv-rc-conf can’t disable it because of the SysV init approach. Here is how to do it:

sudo vim /etc/init/mysql.conf

Comment out the whole start on entry. This should look like the following:

#start on (net-device-up
#          and local-filesystems
#         and runlevel [2345])