Building and installing Apache Maven 3.0.5 from sources

cd ~/tools
wget http://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.0.5/apache-maven-3.0.5-src.tar.gz
tar xvzf apache-maven-3.0.5-src.tar.gz
cd apache-maven-3.0.5
#for the next line to succeed, you need a binary maven version in the path
mvn clean install -DskipTests
cd ..
tar xvzf apache-maven-3.0.5/apache-maven/target/apache-maven-3.0.5-bin.tar.gz


Regenerate hinting for all fonts

First you have to install TTF Autohinter.
sudo apt-get install libtool automake autoconf
cd ~/tools
git clone http://repo.or.cz/ttfautohint.git
cd ttfautohint/
make install
Then it's so simple:
mkdir -p ~/.fonts
for file in $(find /usr/share -name '*.ttf'); do ~/tools/ttfautohint/frontend/ttfautohint -i $file ~/.fonts/${file##*/}; done
fc-cache -fv


Installing Nexus OSS from sources

After all it's not that tricky. Build fails with Maven 3.0.x, make sure to use a later version, 3.2.3 seems to be working fine. You'll also need the http.ssl hacks.


You'll need git. Using Ubuntu/Debian, a
sudo apt-get install git
will do, or on FreeBSD you can use
sudo portmaster devel/git
And now the fun part:
cd ~/tools
wget http://apache.cu.be/maven/maven-3/3.2.3/binaries/apache-maven-3.2.3-bin.tar.gz
tar xvzf apache-maven-3.2.3-bin.tar.gz
ln -s ~/tools/apache-maven-3.2.3 ~/tools/maven
export PATH=~/tools/maven/bin:$PATH
export MAVEN_OPTS="-XX:PermSize=1500m -XX:MaxPermSize=1900m -Xmx1512m"

cd ~/dev
git clone https://github.com/sonatype/nexus-oss.git
cd nexus-oss
mvn -Dskip-testsuite -DskipTests -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
unzip -d ~/tools/nexus assemblies/nexus-base-template/target/nexus-base-template-*.zip

Autostart on Ubuntu/Debian

As of today, the wrapper service we can use in Karaf to autostart things does not work. As a workaround to autostart, create a /etc/init.d/nexus file:


case "$1" in
    log_begin_msg "Starting Nexus OSS..."
    log_end_msg 0
    log_begin_msg "Shutting down Nexus OSS..."
    log_end_msg 0
...and execute this statement:
sudo update-rc.d nexus defaults 98 02

Autostart on FreeBSD

Start by putting the following script to /etc/nexus:

. /etc/rc.subr

export NEXUS_HOME=/opt/nexus
export JAVA_HOME=/usr/local/openjdk7

nexus_start() {

nexus_stop() {

load_rc_config $name
run_rc_command "$1"
...and adapt appropriately to your system of course.
To activate it, you need to add the following to your /etc/rc.conf:


To deploy to the locally installed Nexus, you can
  • - change your pom.xmls to refer to this local nexus for deployment
  • - change your settings.xml use the local nexus for deployment
  • - use the following construct which overrides your default deployment directory:
    mvn clean deploy -DaltDeploymentRepository=nexus::default::

Possible errors

Using Maven versions earlier than 3.2.3 may yield to the following error:
Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

Fix Java font smoothing on Ubuntu: re-building OpenJDK 1.7 from sources with Infinality patches

First we need to install some pre-requisities:
sudo apt-get install libasound2-dev libcups2-dev libfreetype6-dev gawk g++ libxext-dev libxrender-dev libxtst-dev libfontconfig1-dev

export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-7-openjdk-amd64
Getting the sources:
cd ~/tools
mkdir jdk7u60
cd jdk7u60
hg clone http://hg.openjdk.java.net/jdk7u/jdk7u60 forest
cd forest
sh ./get_source.sh
Patching fonts with Infinality:
cd ~
git clone https://gist.github.com/2893461.git
mv 2893461/fontfix.patch ~/tools/jdk7u60/forest/jdk/
cd ~/tools/jdk7u60/forest/jdk/
patch -p1 < fontfix.patch
The actual build:
cd ~/tools/jdk7u60/forest
. jdk/make/jdk_generic_profile.sh
#make ALLOW_DOWNLOADS=true fastdebug_build
make all
build/linux-amd64-fastdebug/j2sdk-image/bin/java -version


Fix Java font smoothing on FreeBSD: re-building the port tree's OpenJDK 1.7 from sources with Infinality patches

The current OpenJDK 7 available in FreeBSD's port tree lacks some eye-candy regarding font-rendering capabilities. Since Freetype2 already includes subpixel-rendering support, we just have to patch the JDK. So first we make an "extract patch" (e.g. no compile, only acquiring sources, applying official FreeBSD patches), then we'll patch with the Infinality patches available in the git repo below.
cd /usr/ports/java/openjdk7
sudo make extract patch
cd ~
git clone https://gist.github.com/2893461.git
sudo mv 2893461/fontfix.patch /usr/ports/java/openjdk7/work/openjdk/jdk/
cd /usr/ports/java/openjdk7/work/openjdk/jdk/
sudo patch -p1 < fontfix.patch
cd /usr/ports/java/openjdk7/
sudo make install clean
If you already have openjdk7 installed, you'll need to reinstall instead. In this case replace the last line with
sudo make deinstall reinstall clean


Installing JDK 1.6, JDK 1.7 and JDK 1.8 from binary

You never know which one you need. Obviously if you have the luxury of a package manager, that will be better, especially if the PM supports multiple versions. Here I didn't have root permissions on a PC still I needed all versions; the switch can be made by sim-linking the proper version to ~/tools/jdk. Don't forget to download the files first - can't do wget since we have to accept the license agreement. Here we go:


mv ~/Downloads/jdk-6u45-linux-x64.bin .
chmod +x jdk-6u45-linux-x64.bin


mv ~/Downloads/jdk-7u67-linux-x64.tar.gz ~/tools
tar xvzf jdk-7u67-linux-x64.tar.gz


mv ~/Downloads/jdk-8u11-linux-x64.tar.gz .
tar xvzf jdk-8u11-linux-x64.tar.gz
If you add ~/tools/jdk/bin to your PATH (via ~/.profile?), here's how touse jdk 1.8 as default:
ln -s ~/tools/jdk1.8.0_11 ~/tools/jdk

Building and installing PostgreSQL 9.3.5 from sources (no sudo needed)

cd ~/dev
wget http://ftp.postgresql.org/pub/source/v9.3.5/postgresql-9.3.5.tar.gz
tar xvzf postgresql-9.3.5.tar.gz
ln -s postgresql-9.3.5 postgresql
cd postgresql-9.3.5/
./configure --without-readline --prefix=$HOME/tools/postgresql
make install
~/tools/postgresql/bin/initdb -D ~/tools/postgresql/data
~/tools/postgresql/bin/pg_ctl -D ~/tools/postgresql/data -l ~/tools/postgresql/postgresql.log start
~/tools/postgresql/bin/createdb mydatabasename
To autostart the server, add this to a startup script:
~/tools/postgresql/bin/pg_ctl -D ~/tools/postgresql/data -l ~/tools/postgresql/postgresql.log start