Installing OpenSUSE 11.3 under Virtual Box 3.2

You will need

  1. VirtualBox
  2. OpenSUSE Live CD

Instructions

Guest Additions

  1. Update the packages
    zypper up
  2. Reboot
  3. Install Kernel Development Packages
    sudo zypper in -t pattern devel_kernel
  4. Mount the VirtualBox Guest Additions CD[VirtualBox Menu] Devices… Install Guest Additions
  5. Run the installer
    sudo /media/VBOXADDITIONS_3.2.10_66523/VBoxLinuxAdditions-x86.run
  6. Reboot

Amazon EC2 – Ubuntu Quickstart Guide

You will need

  1. A web browser
  2. An Amazon AWS Account
  3. Download PuTTY

Instructions

  1. Create a new key pair in AWS
    https://console.aws.amazon.com/ec2/home#c=EC2&s=KeyPairs

    It will automatically download the key for you – go put it somewhere safe (c:\amazon\keys\your-key.pem)

  2. Load up puttygen.exe
  3. Conversions… Import Key
  4. Import c:\amazon\keys\your-key.pem
  5. Save Public Key:
    c:\amazon\keys\PublicKey.ppk
  6. Save Private Key
    c:\amazon\keys\PrivateKey.ppk

    Ideally set a password but not required – what this means is that when you go to connect and it uses your key it will ask for this password

  7. Launch and instance from AWS
    https://console.aws.amazon.com/ec2/home#s=Home
  8. Choose Community AMI

    Search for  ami-480df921 (It may take a while – be patient)
    This is Canonical’s 32-Bit Ubuntu 10.04

  9. Click Select then choose a t1.micro (or relevant size) instance
  10. Keep the rest of the defaults but when it asks for keypair – use the one you created in step 1 from the drop-down
  11. Go to the end and it will launch…
  12. In your Instances
    https://console.aws.amazon.com/ec2/home#s=Instances

    Select your instance then Instance Actions then Connect.
    Copy the hostname

  13. In PuTTY paste the hostname into the Hostname or IP box
  14. Under SSH… Auth browse to c:\amazon\keys\PrivateKey.ppk
  15. Then back under Sessions click Connect
  16. When prompted log in as “ubuntu”

Auto mount (autofs) sshfs access

1. Install autofs

Ubuntu/Debian: sudo apt-get install autofs
Red Hat/Fedora based: sudo yum install autofs

2. Edit /etc/auto.master and add a line:

/media/sshfs   /etc/auto.sshfs uid=1000,gid=1000,--timeout=30,--ghost

3. Edit /etc/auto.sshfs

mountpoint   -fstype=fuse,rw,nodev,nonempty,allow_other,reconnect,uid=1000
,gid=1000,max_read=65536,compression=yes,auto_cache,no_check_root,
kernel_cache :sshfs\#user@server\:/remotedir

4. Make the autofs mount point

mkdir -p /media/sshfs

5. SSH Access using Keys – for root

To make efficient use of sshfs access and a prequisite for autofs you need to set up host based key authentication. It is required that you can ssh from the root user to the target user on the remote filesystem using keys.

ssh-keygen -t rsa
scp .ssh/id_rsa.pub user@server:
ssh user@server
mkdir --mode=0700 -p .ssh
cat id_rsa.pub >> .ssh/authorized_keys
chmod 0600 .ssh/authorized_keys

Now test you can log in to user@remote from the root user without it prompting for a password

6. Start Autofs

Ubuntu/Debian: sudo autofs start
RedHat/Fedora: sudo service autofs start

7. Access your remote filesystem by going to /media/sshfs/mountpoint

cd /media/sshfs/mountpoint

You should now be access the remote machine as if it was part of your local filesystem

Apache, FancyIndexing and PHP 5 (mod_autoindex)

Introduction
The default Directory Listing in Apache is pretty much awful, but I had a need to present some files through a web browser. Rather than produce something with PHP alone I decided to enhance the Apache FancyIndexing option as it is designed for exactly this purpose.
I came across a nice PHP enhancement (update to include link and credit) to the FancyIndexing that added guided navigation to the directory listing, as well as improve the default font and general styling thanks to effective use of CSS.

Instructions

1. Edit httpd.conf and add or modify the following

AccessFileName .htaccess
<Files ~ “^\.ht”>
Order allow,deny
Deny from all
</Files>

<Directory /your/directory>
AllowOverride all
</Directory>

2. In the directory you want the listing of add the following .htaccess file

Options +Indexes +FollowSymlinks
IndexOptions FancyIndexing HTMLTable FoldersFirst SuppressRules SuppressDescription SuppressHTMLPreamble Charset=UTF-8
#
# AddIcon* directives tell the server which icon to show for different# files or filename extensions.  These are only displayed for
# FancyIndexed directories.
#
AddIcon /autoindex/icons/application.png .exe .app
AddIcon /autoindex/icons/type_binary.png .bin .hqx .uu
AddIcon /autoindex/icons/type_box.png .tar .tgz .tbz .tbz2 bundle .rar
AddIcon /autoindex/icons/type_code.png .html .htm .htx .htmls .dhtml .phtml .shtml .inc .ssi .c .cc .css .h .rb .js .rb .pl .py .sh .shar .csh .ksh .tcl .as
AddIcon /autoindex/icons/type_database.png .db .sqlite .dat
AddIcon /autoindex/icons/type_disc.png .iso .image
AddIcon /autoindex/icons/type_document.png .ttf
AddIcon /autoindex/icons/type_excel.png .xlsx .xls .xlm .xlt .xla .xlb .xld .xlk .xll .xlv .xlw
AddIcon /autoindex/icons/type_flash.png .flv
AddIcon /autoindex/icons/type_illustrator.png .ai .eps .epsf .epsi
AddIcon /autoindex/icons/type_pdf.png .pdf
AddIcon /autoindex/icons/type_php.png .php .phps .php5 .php3 .php4 .phtm
AddIcon /autoindex/icons/type_photoshop.png .psd
AddIcon /autoindex/icons/monitor.png .ps
AddIcon /autoindex/icons/type_powerpoint.png .ppt .pptx .ppz .pot .pwz .ppa .pps .pow
AddIcon /autoindex/icons/type_swf.png .swf
AddIcon /autoindex/icons/type_text.png .tex .dvi
AddIcon /autoindex/icons/type_vcf.png .vcf .vcard
AddIcon /autoindex/icons/type_word.png .doc .docx
AddIcon /autoindex/icons/type_zip.png .Z .z .tgz .gz .zip
AddIcon /autoindex/icons/globe.png .wrl .wrl.gz .vrm .vrml .iv
AddIcon /autoindex/icons/vector.png .plot

AddIconByType (TXT,/autoindex/icons/type_text.png) text/*
AddIconByType (IMG,/autoindex/icons/type_image.png) image/*
AddIconByType (SND,/autoindex/icons/type_audio.png) audio/*
AddIconByType (VID,/autoindex/icons/type_video.png) video/*
AddIconByEncoding (CMP,/autoindex/icons/type_box.png) x-compress x-gzip
AddIcon /autoindex/icons/back.png ..
AddIcon /autoindex/icons/information.png README INSTALL
AddIcon /autoindex/icons/type_folder.png ^^DIRECTORY^^
AddIcon /autoindex/icons/blank.png ^^BLANKICON^^

#
# DefaultIcon is which icon to show for files which do not have an icon# explicitly set.
#
DefaultIcon /autoindex/icons/type_document.png
#
# Enables PHP to be used in our header file
# 
AddHandler application/x-httpd-php .php
AddType text/html .php .html
#
# ReadmeName is the name of the README file the server will look for by
# default, and append to directory listings.
#
# HeaderName is the name of a file which should be prepended to
# directory indexes.
ReadmeName /autoindex/footer.php
HeaderName /autoindex/header.php
#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing.  Shell-style wildcarding is permitted.
#
IndexIgnore autoindex .??* *~ *# RCS CVS *,v *,t *.dat ..

IndexOptions +NameWidth=42
AddDescription "PNG images" *.png

Warning for PHP 5.3 and higher

I originally had this running with PHP 5.1 and it was working great.  I upgraded to PHP 5.3.3 (latest at the time of writing) and it refused to parse the PHP, despite the PHP working if I called the Header and Footer PHP pages directly.

It turned out to be the directive XHTML in the IndexOptions line.  Remove this and it will parse.  XHTML says:

The XHTML keyword forces mod_autoindex to emit XHTML 1.0 code instead of HTML 3.2.

Whereas the same pages says that a Header/Readme filename “must resolve to a document with a major content type of text/* (e.g.text/htmltext/plain, etc.).”

Building Apache 2.2, PHP 5 with GD and MySQLi support from source

1. Download the following
Apache 2.2 from http://httpd.apache.org/download.cgi [2.2.17]
PHP 5.3.3 from http://www.php.net/downloads.php [5.3.3]
Expat from http://sourceforge.net/projects/expat/ [2.0.1]
JPEG from http://www.ijg.org/ [v8b]
PNG from http://sourceforge.net/projects/libpng/files/ [1.4.4]

2. Apache

./configure --enable-so --enable-modules=most --enable-proxy --with-mpm=worker --disable-imap --enable-deflate
make
sudo make install

3. Expat XML Parser

./configure
make
sudo make install

4 JPEG

./configure
make
sudo make install

5. PNG

./configure
make
sudo make install

6. PHP

./configure --disable-cli --enable-embedded-mysqli --with-zlib --enable-shared --with-apxs2=/usr/local/apache2/bin/apxs --with-gd
make
sudo make install