Eigener Vagrant Catalog aufbauen

    1. Debian-Pakete
      aptitude install php5-curl libapache2-mod-php5 php5-cli php5-common apache2
    2.  Composer installieren
      curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin
      ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
      ;
    3. vagrant-boxer installieren
      cd /opt/
      git clone https://github.com/vube/vagrant-boxer
      cd vagrant-boxer
      composer update
      ln -sf /opt/vagrant-boxer/boxer.php /usr/local/bin/boxer.php
    4. vagrant-catalog installieren
      cd /opt/
      git clone https://github.com/vube/vagrant-catalog
      cd vagrant-catalog/
      composer update
      ln -s -v /opt/vagrant-catalog/ /var/www/vagrant-catalog
    5. vagrant-catalog konfigurieren
      cd /var/www/vagrant-catalog
      cp config.php.dist config.php
      vim config.php
      die config.php sollte ungefähr das aussehen:
      <?php
          return array(
          'metadata-root' => 'files',
          'download-url-prefix' => 'files',
          'catalog-uri' => 'catalog',
      );
    6. Verzeichnisstruktur vorbereiten
      mkdir -vp files/company/basebox
    7. Apache vhost-Konfiguration /etc/apache2/sites-available/vagrant anlegen
      <VirtualHost *:80>
          ServerAdmin webmaster@domain.tld
          ServerName vagrant.domain.tld;
          DocumentRoot /var/www/vagrant-catalog
          <Directory />
               AllowOverride All
          </Directory>
          # Possible values include: debug, info, notice, warn, error, crit,
          # alert, emerg.
          LogLevel warn
          CustomLog ${APACHE_LOG_DIR}/vagrant_80.access.log combined
          ErrorLog ${APACHE_LOG_DIR}/vagrant_80.error.log
      </VirtualHost>
      und dann aktivieren
      a2ensite vagrant
      apache2ctl configtest
      /etc/init.d/apache2 reload

So kann man beispielsweise eine box bauen:
boxer.php --verbose --base "base" --boxer-id "company/base" --major-version 1.0 --url-prefix "https://vagrant.domain.tld/" --upload-base-uri "root@vagrant.domain.tld:/var/www/vagrant-catalog"

Install JAVA on debian

This is a short tutorial how to install JAVA under Debian Squeeze. I’m used to download the normal „tar.gz“ archives from http://www.java.com.

In this short how-to I’m using the 32bit Java for Linux.

  1. First download the package from java.com. I’m used to download it as my user.
  2. Switch to „root“. I’m used to install these optional software under the „/opt/“ directory
  3. Jump into the „/opt/“-directory:
    root@srvr:~# cd /opt
  4. extract the archive
    root@srvr:/opt# tar xvf /home/inet/jre-7u7-linux-i586.tar.gz
  5. install java over the Debian alternatives system:
    root@srvr:/opt# update-alternatives –install \
    /usr/bin/java java /opt/jre1.7.0_07/bin/java 100


    root@srvr:/opt# update-alternatives –install \
    /usr/bin/ControlPanel java-CP /opt/jre1.7.0_07/bin/ControlPanel 100


    root@srvr:/opt# update-alternatives –install \
    /usr/bin/java_vm java_vm /opt/jre1.7.0_07/bin/java_vm 100


    root@srvr:/opt# update-alternatives –install \
    /usr/bin/javaws javaws /opt/jre1.7.0_07/bin/javaws 100

That’s all. Now you can use java.

Veröffentlicht unter Linux

Multithreaded BASH scripts

To create multithreaded BASH scripts with a maximun of parallel processes you can use this framework:

#!/bin/bash
MAX_PROCS=10
this_pid="$$"
jobs_running=0
trap 'decrement_jobs' SIGALRM

decrement_jobs()
{
    jobs_running=$(($jobs_running - 1))
    if [ -n "${sleep_pid}" ]; then
        kill -s SIGKILL "${sleep_pid}"
        sleep_pid=
    fi
}

start_thread()
{
    if [ ${jobs_running} -gt $MAX_PROCS ]; then
        (
        while true; do
            sleep 30
        done
        );
        sleep_pid=$!
        wait ${sleep_pid}
    fi

    # Launch the requested task, signalling the parent upon completion
    (
    # Here you can write own commands in one thread with the 
    # arguments in $@ or write one command in $@
    "$@"
    kill -s SIGALRM "${this_pid}"
    );
    jobs_running=$((${jobs_running} + 1))
}

while read line; do
    start_thread $line
done << EOF
Argument thread 1
Argument thread 2
...
EOF