LinuxSysAdmin

Things I don't want to look for twice..

Monthly Archives: February 2011

Install headless OpenOffice.org on Ubuntu 10.04.2

I needed this for an Alfresco Community Edition installation, so ..here are the steps:

1. install the necessary packages:
apt-get install openoffice.org-writer openoffice.org-calc openoffice.org-draw \
openoffice.org-impress openoffice.org-java-common openoffice.org-headless


2. create the init script:
nano /etc/init.d/openoffice

fill it with:
#!/bin/bash
# openoffice.org headless server script
#
# chkconfig: 2345 80 30
# description: headless openoffice server script
# processname: openoffice
#
# Author: Vic Vijayakumar
# Modified by Federico Ch. Tomasczik
#
OOo_HOME=/usr/bin
SOFFICE_PATH=$OOo_HOME/soffice
PIDFILE=/var/run/openoffice-server.pid
set -e
case “$1” in
start)
if [ -f $PIDFILE ]; then
echo “OpenOffice headless server has already started.”
sleep 5
exit
fi
echo “Starting OpenOffice headless server”
$SOFFICE_PATH -headless -nologo -nofirststartwizard -accept=”socket,host=127.0.0.1,port=8100;urp” & > /dev/null 2>&1
touch $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo “Stopping OpenOffice headless server.”
killall -9 soffice && killall -9 soffice.bin
rm -f $PIDFILE
exit
fi
echo “Openoffice headless server is not running.”
exit
;;
*)
echo “Usage: $0 {start|stop}”
exit 1
esac
exit 0


3. make the script executable:
chmod 755 /etc/init.d/openoffice


4. make it start at common runlevels:
update-rc.d openoffice defaults


That’s all folks 🙂

Advertisements

PF – FreeBSD packet filter (I)

So, this is about the default firewall in *BSD distros. Considering I know iptables, this should be easy to learn. First of all, to be sure it will get autorun at startup, modify /etc/rc.conf like this:

pf_enable=”YES”                  # Set to YES to enable packet filter (pf)
pf_rules=”/etc/pf.conf”         # rules definition file for pf
pf_program=”/sbin/pfctl”        # where the pfctl program lives
pf_flags=””                     # additional flags for pfctl
pflog_enable=”NO”               # Set to YES to enable packet filter logging
pflog_logfile=”/var/log/pflog”  # where pflogd should store the logfile
pflog_program=”/sbin/pflogd”    # where the pflogd program lives
pflog_flags=”” # additional flags for pflogd


This should autorun PF using the config file found at /etc/pf.conf. But first, and I just have to do it right now, to enable PF advanced features, you should compile your kernel with:

device pf
device pflog
device pfsync

…and, to use packet queuing, you should also add this:

options         ALTQ
options         ALTQ_CBQ        # Class Bases Queuing (CBQ)
options         ALTQ_RED        # Random Early Detection (RED)
options         ALTQ_RIO        # RED In/Out
options         ALTQ_HFSC       # Hierarchical Packet Scheduler (HFSC)
options         ALTQ_PRIQ       # Priority Queuing (PRIQ)
options         ALTQ_NOPCC      # Required for SMP build

This is it for now, that’s because I got something already compiling on my FreeBSD VM and it’s more than enough for a VM running on a EEE PC 🙂

2 bugs with Linux Mint 10 on MSI laptop (and probably Ubuntu 10.10)

1. ath5k phy0: gain calibration timeout
NetworkManager shows wireless as disconnected and doesn’t search/find for wlans. To fix this, you just have to completely shutdown the laptop and then power on (reboot doesn’t seem to do the trick)

2. Laptop battery critically low. Computer will hibernate very soon unless it is plugged in.
When the power cord is disconnected, a popup appears with this message, no matter how full the battery is. That’s why some fucked up batteries, BIOSes when you disconnect the power cord, they mistakenly show –  0:04 remaining (92%) – in the popup from the power manager. So it actually thinks it only has 4 minutes left, and wants to hibernate, although you still have 92% of battery left. So to avoid this crap, go to gconf-editor > apps > gnome-power-manager > general and uncheck “use_time_for_policy“. So, next time you disconnect the power cord, it will use percentage to calculate if it’s time to suspend or hibernate.

Debian 6 – no graphical interface

So, I tried twice to install Debian 6 on a VMWare Workstation 7 and at the end, there was no graphical interface installed, of course, using the net installer, not the whole 52 (WTF???) CDs. Nothing, just the good old command line prompt. So if I type:

apt-get autoremove

..it will practically remove a LOT of packages most of them related to gnome and X. So, what’s missing?
If you type “startx” you’ll notice there is no /usr/bin/X. So, to really have a graphical interface on your newly installed Debian 6 you should just:

apt-get install xorg

After that, X will start automatically..
But, it’s not over yet, because if you enter:

apt-get autoremove

..again, you’ll still be removing a LOT of packages including gnome ones. I’m actually at this point so I have to figure out what’s missing..Anyway, everything seems to work..