Installing Xen on NetBSD-5 on VMWare Player

July 26th, 2009

I gave up installing Xen since I can’t find any vmx|svm flags on my debian’s /proc/cpuinfo and/or since I have been unable to make Xen to work on it. The last installation hanged at booting domO process. I can’t remember what the error messages were.

Then I found this awesome page about netbsd/xen.  Combining the info from this page with some trial and error processes of getting the configuration files right, I finally managed to get NetBSD dom0 and domU running.

Installing dom0

  1. Install NetBSD-5 to vmware player as usual (use www.easyvmx.com to get vmplayer config and virtual disks)
  2. Install the followings using pkg_add:
    sysutils/grub
    sysutils/xentools3
    sysutils/xenkernel3
    sysutils/e2fsprogs
  3. cp /usr/pkg/share/examples/rc.d/xen* /etc/rc.d
  4. vi /etc/rc.conf
    xend=YES
    xenbackendd=YES
    xendomains=YES
  5. cd /dev
    sh MAKEDEV xen
  6. Get “netbsd-XEN3_DOM0.gz” from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/i386/binary/kernel/ or from netbsd installation iso/cdrom.
  7. Backup original netbsd kernel
    cp /netbsd /netbsd.old
  8. gunzip netbsd-XEN3_DOM0.gz
    mv netbsd-XEN3_DOM0 /netbsd
  9. cp /usr/pkg/xen3-kernel/xen.gz /
    cd /
    gunzip xen.gz
  10. mkdir /grub
    vi /grub/menu.lst
    default=0
    timeout=5
    title XEN3
    root(hd0,0)
    kernel (hd0,a)/xen dom0_mem=128M
    module (hd0,a)/netbsd bootdev=wd0a ro console=pc
    title NetBSD
    root (hd0,0,a)
    kernel /netbsd.old
  11. grub-install ‘(hd0)’
  12. grub –no-floppy
    root (hd0,a)
    setup (hd0)
    quit
  13. vi /etc/ifconfig.bridge0
    create
    !brconfig $int add pcn0 up    # replace pcn0 with your shared network interface.
  14. cd /dev
    sh MAKEDEV all
    sh MAKEDEV xen
  15. shutdown -r now

Installing self-made domU

  1. You need to mount the NetBSD-5 installation cd
    mkdir /mnt/cdrom
    mount /dev/cd0a /mnt/cdrom
  2. Make a directory to contain NetBSD-5 sets
    mkdir /root/lala
  3. Make a directory to contain domU kernel
    mkdir /root/kernels
  4. Get netbsd-XEN3_DOMU.gz from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/i386/binary/kernel/ or from netbsd installation iso/cdrom.
  5. cp netbsd-XEN3_DOMU.gz /root/kernels
    cd /root/kernels
    gunzip netbsd-XEN3_DOMU.gz
  6. Extract NetBSD sets:
    tar xzpfe /mnt/cdrom/i386/binary/sets/kern-XEN_DOMU… -C /root/lala
    tar xzpfe /mnt/cdrom/i386/binary/sets/base.tgz -C /root/lala
    tar xzpfe /mnt/cdrom/i386/binary/sets/comp.tgz -C /root/lala
    (… and the rest)
  7. cd /root
    makefs -M 1073741824 lala.ffs lala
    (Note. 1G=1073741824 and 2.5G=2684354560)
  8. A flat swap
    dd if=/dev/zero of=lala/swap bs=1024 count=400
  9. mv lala lala.old
    mkdir lala
    vnconfig vnd0 lala.ffs
    mount /dev/vnd0a lala
  10. vi lala/etc/fstab,
    /dev/xbd0a / ffs rw 1 1
    /swap none swap sw 0 0
    kernfs /kern kernfs rw
    procfs /proc procfs rw,noauto
  11. vi /etc/rc.conf
    rc_configured=YES
    hostname=blah
    dhclient=YES
    sshd=YES
    (… etc)
  12. vi /usr/pkg/etc/xen/nbsd
    kernel = “/root/kernels/netbsd_XEN3_DOMU”
    memory = 256
    name = “nbsd”
    vif = [ 'bridge=bridge0' ]
    disk = ['file:/root/lala.fs,0x01,w']
    root = “xbd0″
  13. To make nbsd domain start at boot
    vi /etc/rc.conf
    xendomains=”nbsd”   # edit this line  add your domains separated by space instead of “YES”
  14. shutdown -r now

Now, you should have NetBSD dom0 and domU running at boot. Use “xm list” to list domains and “xm console ID” to access domU console.

I am new to UNIX,  follow above instructions at your own risk.

References:
NetBSD/xen Howto : www.netbsd.org/ports/xen/howto.html
Xen on NetBSD : www.gutch.de/NetBSD/docs/xen.html
http://pbraun.nethence.com/doc/sysutils/xen_netbsd.html


Installing mod_fastcgi Apache on Windows

October 17th, 2008

This installation assumes installed Apache. Here you go:

  1. Download mod_fastcgi dll from http://www.fastcgi.com/dist/.
  2. Copy the dll into c:\program files\apache software foundation\apache2.2\modules\ (if you are using default installation directory) and rename it to mod_fastcgi.dll.
  3. Edit httpd.conf and add the following line:
    LoadModule fastcgi_module modules/mod_fastcgi.dll
  4. Restart Apache.

Installing mod_python apache on windows

October 17th, 2008

To install and test mod_python Apache on Windows (assuming that you’ve already had Apache and Python installed):

  1. Download mod_python Win32 Binaries from http://httpd.apache.org/modules/python-download.cgi
  2. Run the installer. When prompted for Apache installation directory, type C:\Program Files\Apache Software Foundation\Apache2.2 (Assuming default Apache installation).
  3. Edit httpd.conf.
  4. Add the following line:
    LoadModule python_module modules/mod_python.so
  5. Configure your Apache <Directory> directives to include AddHandler, PythonHandler, and PythonDebug (examples below).

To test your mod_python installation:

  1. Create a file named mptest.py in say C:\sites.
  2. The file will contain:
    from mod_python import apache
    def handler(req):
      req.content_type = ‘text/plain’
      req.write(”Hello World”)
      return apache.OK
  3. Edit httpd.conf.
  4. Under <Directory “C:/sites”> directive add:
    AddHandler mod_python .py
    PythonHandler mptest
    PythonDebug On
  5. Restart Apache and point your browser to the mptest.py url.

Disabling vista user account control (UAC) and its warnings

October 13th, 2008

To disable UAC in Windows Vista:

  1. Go to Start > Control Panel > User Accounts, and click Turn User Account Control on or off.
  2. Search “regedit” in Vista Start Menu. Execute regedit.exe.
  3. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center
  4. Right click on the right column, and New > DWORD (32-bit) VALUE.
  5. Enter Value name: UACDisableNotify, and Value data: 1.
  6. Save and reboot your computer.

Apache2 ssl windows

October 12th, 2008

To enable https for your site using VirtualHost follow the following steps.

  1. Download Apache 2.2.9 with openssl (MSI Installer) from http://httpd.apache.org/download.cgi
  2. Execute the installer and follow the instructions.
  3. Make sure Apache is installed properly by pointing your web browser to http://127.0.0.1/ or http//localhost/.
  4. If you are using default Apache installation directory, navigate to c:\program files\apache software foundation\apache2.2\conf.
  5. Execute:
    openssl req -config openssl.cnf -new -out domainname.csr -keyout domainname.pem
    to create a .pem key.
  6. Execute:
    openssl rsa -in domainname.pem -out domainname.key
    to create a .key key.
  7. Delete .rnd file.
  8. Execute:
    openssl x509 -in domainname.csr -out domainname.cert -req -signkey domainname.key -days 365
    to create .cert key.
  9. Create a directory called ssl in the conf directory. Move all keys (cert,csr,key,pem) to the newly created directory.
  10. Edit httpd.conf.
  11. Uncomment line that says:
    LoadModule ssl_module modules/mod_ssl.so.
  12. Uncomment line that says:
    Include conf/extra/httpd-ssl.conf
  13. Edit extra\httpd-ssl.conf.
  14. Under directive <VirtualHost _default_:443>, edit DocumentRoot and ServerName to reflect your site name.
  15. Point SSLCertificateFile to conf/ssl/domainname.cert
  16. Point SSLCertificateKeyFile to conf/ssl/domainname.key
  17. Modify options under <Directory> directives as required.

To know more about what each command does refer to http://www.neilstuff.com/apache/apache2-ssl-windows.htm.


Installing phpmyadmin on windows

October 11th, 2008
  1. Download the latest version of phpMyAdmin from http://www.phpmyadmin.net/home_page/downloads.php.
  2. Extract the content to your desired installation location. (I will use D:\sites\phpmyadmin for this article).
  3. Edit httpd.conf (Apache) to setup a virtual host by adding
    NameVirtualHost *:80
  4. <VirtualHost *:80>
    DocumentRoot “D:/sites/phpMyAdmin”
    ServerName phpMyAdmin
    <Directory “D:/sites/phpMyAdmin”>
            AllowOverride None
            Options None
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    lines to the bottom of the file.

  5. Restart Apache.
  6. Navigate to phpmyadmin installation directory and copy the file config.sample.inc.php to config.inc.php and edit it as you desired (or download mine here).
  7. You need to enable a few extensions (edit php.ini) in order to use phpmyadmin. Here’s a few:
    extension=php_mysql.dll
    extension=php_mysqli.dll
    extension=php_mcrypt.dll
  8. Since you are using virtual host, you need to edit your hosts file (%SystemRoot%\system32\drivers\etc\hosts).
    127.0.0.1 phpMyAdmin
  9. Point your browser to http://phpMyAdmin/ .
  10. You should now be able to login.
  11. Navigate to Import tab.
  12. Click Choose File.
  13. On the popup box, navigate to D:\sites\phpmyadmin\scripts and select create_tables.sql. SQL commands should successfully execute.
  14. Now, navigate to SQL tab.
  15. Type: grant all on pmadb.* to ‘pma’@'localhost’ identified by ‘pmapass’.
  16. Click Go.
  17. You are all set to use phpMyAdmin now.

Installing php on vista (And configure APACHE)

October 10th, 2008

Apache installation on Vista is a breeze. Just use the installer downloaded from http://httpd.apache.org/download.cgi.

If you are looking steps to install PHP using MSI Installer, this isn’t for you. I have tried installing PHP using MSI installer on Vista, and it was a pain. So I decided to manually install and setup the PHP environments.

Below are the steps:

  1. Download PHP Windows Binaries from http://www.php.net/downloads.php#v5 (zip package).
  2. Unzip them to your desired location. I recommend not to install PHP on the partition where your Vista resides (e.g. D:\PHP) to avoid UAC annoyance.
  3. Click on “Vista” icon (or “Start” button) on your desktop, right click on Computer and select Properties. Click on Advanced system settings.
  4. A dialog box pops up. Click on Environment Variables.
  5. Under System Variables scroll to find Path variable. Select and click Edit…
  6. Append your PHP path (e.g. D:\PHP) to the beginning of Variable value. Don’t forget to insert ; after it. And save it.
  7. Under System Variables click New…
  8. Variable name: PHPRC, Variable Value: D:\PHP. And save it.
  9. And just click OK buttons all the way to close all the dialog boxes.
  10. Open a Command Prompt and execute “php -v” to see if PHP is correctly installed.
  11. Edit php.ini file (under D:\PHP) and set your extension_dir to “./ext”.
  12. Edit httpd.conf (Apache’s) and add
    LoadModule php5_module “D:/PHP/php5apache2_2.dll”
    AddType application/x-httpd-php .php

    line to the bottom of the file.

Configuring vista Sidebar "rss feed" gadget via outlook 2007

October 9th, 2008

It took me sometime to understand that the Sidebar RSS Feed is tied to Internet Explorer RSS Feed.

First things first, you need to configure Outlook 2007 to share its RSS Feed. Follow the following steps if you haven’t already enabled Common Feed List:

  1. In outlook, go to Tools > Options > Others > Advanced Options.
  2. Put a check in the checkbox next to Sync RSS Feeds to the Common Feed List.

Next is to add RSS Feeds in Outlook 2007. If you look at the list of RSS Feeds in the Gadget, you are able to see the RSS Feed you just added, however, it doesn’t show any contents.

The last step is to open Internet Explorer. Click on the “Star” icon (or press Ctrl+J) and choose Feeds. You will see your newly added Feed, click it.

Refresh your Gadget, and you should see your new Feed entries.


Installing FreeBSD via FTP on VMWare Workstation 6

September 28th, 2008

For me, a UNIX/ Linux newbie, FreeBSD installer is a bit dodgy to use. So I want to share the successful FTP installation steps.

To get FreeBSD, go to http://www.freebsd.org/where.html. I’m using livefs version of FreeBSD ISO.

I created a new VMWare virtal machine with the following settings: NAT networking, 256MB RAM, 8GB HD, and CD-Rom pointing to the downloaded ISO.

Start up the Virtual Machine.

  1. On “Welcome to FreeBSD!” page, press Enter to choose default boot option.
  2. Select your “Country Selection”.
  3. Arriving at “Sysinstall Main Menu”, choose “Standard”.
  4. On “FDISK Partition Editor” page, choose “A” for “Use Entire Disk”, and “Q” to exit.
  5. On “Install Boot Manager” page, choose “BootMgr”.
  6. On “FreeBSD Disklabel Editor”, create 2 labels: 512M for “Swap” and the rest for root (/) “FS”. Press “Q” to exit.
  7. On “Choose Distribution”, choose Minimal and Custom: base, kernels, info, man, ports.
  8. On “Choose Installation Media”, choose “FTP Passive”.
  9. On “FTP distribution site”, choose “URL” and enter the “IP Address” of your nearest FreeBSD distribution site e.g. ftp://210.171.226.46/pub/FreeBSD (for ftp.jp.freebsd.org).
  10. On “Network interface information”, choose “le0″.
  11. Choose “No” for IPv6 configuration.
  12. Choose “No” for DHCP configuration.
  13. Enter your hostname, domain, IPv4 Gateway, Name Server, IPv4 Address, Netmask.

Step number 8, 9, 12, and 13 are critical. I never got the installer working, by choosing other choices on those steps.