Thursday Dec 04, 2008

Django on OpenSolaris and ...

I recently started to play with Django and the first task was actually to set it up on all the platforms I am currently using (SXCE (build 96), OpenSolaris 2008.11 (RC2) and Mac OS X 10.5). The setup was not difficult and the mighty internet helped to answer all my questions but since the setup steps differ on each of the platforms I decided to write down what I learned.

My goal was to set up Django development environment with MySQL database. Django is a Python based web development framework, so the complete list of tools is as the following:

OpenSolaris

All the required packages are available, so the setup was just a matter of issuing a few IPS commands.

MySQL 5 is installed by command $ pfexec pkg install SUNwmysql5. It is installed in /usr/mysql. It is controlled by SMF, so to start the MySQL server it is necessary to enable it at first. This can be done either through a command line ($ pfexec svcadm enable mysql) or through a GUI tool (go to System/Administration/Services for a GUI tool, which shows available services and makes possible to enable or disable them).

Python version 2.4.4 is installed by default. MySQLdb is packaged as SUNWmysql-python package, so it gets installed by issuing $ pfexec pkg install SUNWmysql-python.

Django package also exists but it is stored in webstack repository, so this repository has to be added to a list of known authorities:
$ pfexec pkg set-authority -O http://pkg.opensolaris.org/webstack webstack
$ pfexec pkg refresh
$ pfexec pkg install Django

It is also a good idea to add MySQL in the PATH, e.g., $ export PATH=$PATH:/usr/mysql/bin

SXCE (build 96)

MySQL 5, MySQLdb, and Python are already installed, so only Django needed to be set up. I just downloaded the tar ball, unziped and untared it and then run inside the Django directory (as root): # python setup.py install. Again, set path to MySQL and enable it through SMF. Note, that two versions of MySQL are actually installed -- version 5 is at /usr/mysql and version 4 is at /usr/sfw/bin.

Mac OS X

Python is available by default. I downloaded MySQL binaries as a dmg package and installed it together with MySQL.prefPane, which integrates in System Preferences and makes possible to start and stop the MySQL server easily. The installed path is /usr/local/mysql. For Django and MySQLdb installation I found an excellent article How to install Django with MySQL on Mac OS X, which I followed.

Test the Installation

To make sure that everything is installed you can try the following:

$ python
>>> import MySQLdb
>>> print MySQLdb.apilevel
2.0
>>>

Verify also that django-admin.py is in your path.

Saturday Nov 15, 2008

Invitation to CZOSUG Meeting in December: OpenSolaris 2008.11

A new release of OpenSolaris is planned for end of November (version 2008.11). As it was already announced at the ug-czosug list, an all day event devoted to this OpenSolaris release is planned. An invitation to the event can be found at CZOSUG events page as usual.

The organizers, Martin Man and Roman Strobl (yes the Roumen ;-) ) set the event as an OpenSolaris 2008.11 training including hands-on labs, so bring your laptops and get ready for some work :-) .

OpenSolaris 2008.11 already generated some interest, check for example, this blog or this article.

Tuesday Aug 12, 2008

Setting Up a Build Machine for OpenSolaris

There are currently two options you can choose from for building OpenSolaris (exactly the ON gate) -- OpenSolaris 2008.05 and Solaris Express Community Edition (SXCE). As an experiment and learning exercise for myself I decided to start from a scratch and use both of these distributions to set up a build machine. The text below contains the main links I used to get the necessary information and also a lot of wisdom I got from Solaris RPE build masters in Prague -- Vlada Kotal and Vita Batrla.

Iso Images

In the time of writing this blog I used images based on b93 and b94 sources and closed binaries (closed-bins). Download links to both distributions can be found at Downloads web page (part of OpenSolaris web site). OpenSolaris 2008.05 can be also downloaded from opensolaris.com web.

SXCE: Link to SXCE leads to Sun's Downlad Center, which requires a simple registration. If you have already an SDN account you can use this one.

OpenSolaris 2008.05 OpenSolaris 2008.05 can be downloaded directly (no registration is needed) or via BitTorrent. Since the goal is to use the OpenSolaris 2008.05 for building OpenSolaris then the following has to be considered: OpenSolaris 2008.05 is based on Nevada (ON) build 86. OpenSolaris should not be built on a machine, which is more than 2 builds behind the current sources, so it is necessary to update the vanilla OpenSolaris 2008.05 to the most recent development builds. Another option is to download the latest iso image produced, which is based on build 93. The image can be downloaded via BitTorrent or directly from Blastwave mirrors in Santa Clara and Beijing.

OS Installation

I installed both SXCE and OpenSolaris 2008.05 in Parallels virtual machine. Note, that SXCE now also supports ZFS root, so I installed both systems as ZFS only.

Tools

The following tools are needed:

  • Download and install Sun Studio 11 compilers and tools . Do not worry about the language selection (Chinese-Simplified). Again, a simple registration is required, your SDN account can be used.
  • Download the latest ON developer tools (onbld) and install them.
  • OpenSolaris 2008.05: Install Mercurial, Java compiler (SUNj6dev for 32 bit and SUNWj6dvx for 64 bit), and gcc packages (gcc will also install header files):
    $ pfexec pkg install SUNWmercurial
    $ pfexec pkg install SUNWgcc
    $ pfexec pkg install SUNWj6dev
  • Set up you PATH, so output of
    echo $PATH | awk -F':' '{ for (i=1; i<=NF; i++)\\
    printf("%d\\t%s\\n", i, $i); }'

    will look like the following (thanks to Vlad for this tip):
    1 /sbin
    2 /usr/bin
    3 /usr/sbin
    4 /usr/ccs/bin
    5 /opt/onbld/bin
    6 /opt/onbld/bin/i386
    7 /opt/SUNWspro/bin
    8 /usr/sfw/bin
    9 /usr/sfw/sbin
  • Add /opt/SUNWspro/man and /opt/onbld/man to your MANPATH.

Prepare a Workspace

It is a good idea to create a separate ZFS file system for your workspace, for example:
# zfs create rpool/export/workspaces
# zfs set mountpoint="/export/workspaces"\\
rpool/export/workspaces

Get the Sources

How to obtain ON sources and closed-bins is described at the ON/Nevada (ONNV) project web page.

  • Switch to you directory for workspaces and get the ON sources from Mercurial repository:
    hg clone\\
    ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate
  • Download the closed-bins:
    wget\\
    http://dlc.sun.com/osol/on/downloads/nightly-bins/\\
    on-closed-bins-latest.i386.tar.bz2

    and unpack them inside the onnv-gate directory
    bzcat on-closed-bins-latest.i386.tar.bz2 | tar xf -

Build the ON Gate

The following links provide the necessary information about building the ON gate:

Once you read through the links above you know where to get the opensolaris.sh script. Edit inside it the following variables:
GATE=onnv-gate
CODEMGR_WS="/export/workspaces/$GATE"
STAFFER=your_login

Now you are ready to run the build:
$ nohup nightly ./opensolaris.sh &
and monitor it:
tail -f onnv-gate/log/nightly.log | grep ===

Friday Jul 04, 2008

OSDevCon 2008 in Prague

OpenSolaris Developer Conference 2008 held in Prague finished exactly a week ago. This was a three days event organized by people from German Unix Users Group (GUUG) and Czech OpenSolaris Users Group (CZOSUG). I would like thank to everyone involved in this event -- sponsors (Sun, Intel, GUUG, and Commerzbank), speakers , attendees and organizers . A special thanks belongs to Academic and Medical Conference Agency (AMCA), which was behind of all the logistics and without their involvement we would not be able to run this event.

The conference brought together more than 60 people from around the world and the agenda was busy -- the speakers delivered four tutorials, two keynotes and twelve presentations.

Martin Man announced yesterday where to find slides, videos and pictures. Below are also several pictures from me -- both from the conference as well as from a social event on June 26th night (a boat ride on the Vltava river).

I do not know yet if and eventually when OSDevCon 2009 will be organized but if yes then I definitely would like to participate again.












Friday Jun 27, 2008

OpenSolaris, Asus Eee PC and CZOSUG #26

I have an opportunity to use Asus Eee PC 4G Surf (the green one ;-) ) on which I managed to install OpenSolaris 2008.05 operating system. The installation went well, except a known bug with kb8042 driver. The workaround is quite easy, just start the kernel with -v parameter (the timing problem with initialization of the keyboard will go away). To make WiFi work I downloaded and installed a driver for Atheros WiFi card (an updated HAL is needed).

This machine is extremely cool because it's keyboard size is just about right for my fingers to be able to do some work while it is really lightweight (920 grams), so it is very convenient to carry it. Here are pictures of the Asus Eee PC running OpenSolaris and me using it at OSDevCon 2008 (thanks to Jim Grisanzio for taking this picture).

asus_eeepc_213x160.jpg IMG_5218

On May 28th I presented at CZOSUG meeting about OpenSolaris 2008.05 operating system, so my choice for a laptop to use for the presentation was quite obvious :-) .

Friday May 30, 2008

OpenSolaris in VirtualBox

I recently installed OpenSolaris 2008.05 in VirtualBox 1.6.0 both on Mac OS X and also on my workstation running Nevada, build 88 (which would be equal to SXCE build 88 but this build was skipped).

Virtual Machine Settings

Base Memory796 MB
Hard DiskNormal, 16GB
NetworkIntel PRO/1000 MT Desktop, NAT

Notes

VirtualBox installation was very easy on both platforms as well as installation of the OpenSolaris in the virtual machine. However, I met a few problems:

  • ICMP protocol is not supported by VirtualBox's NAT engine, so the initial network test using ping failed. This is actually well documented in VirtualBox's User Manual and other TCP/IP based protocols work fine.
  • My workstation is on NIS, while VirtualBox's NAT relies on DNS. So, I had to create /etc/resolv.conf file with nameserver entry.

NAT is the only networking option for Mac OS X, while Host Interface (virtual NIC) option is available for other platforms including Solaris. I tried the procedure described in VirtualBox's User Manual (only the manual steps led to successful creation of the virtual network interface) but so far I was not successful in setting this up. VirtualBox did not start the virtual machine -- I got the following error: "Failed to open VNIC "vnic0" in raw mode.". So, I must be doing something wrong and I still need to investigate this problem.

VirtualBox offers also great and easy to use command line interface -- VBoxManage -- which is very convenient for controlling the machine.

References

Virtual Box Error – A Domain Name Server (DNS) for NAT networking could not be determined
Using Crossbow to get a host interface network for VirtualBox

Thursday May 22, 2008

OpenSolaris Developer Conference aka OSDevCon 2008

Dirk Wetter from GUUG, one of the main organizers of OpenSolaris Developer Conference 2008 (OSDevCon 2008), announced that visitors registrations are now open! This is a great news, especially after long time of preparations for this event. Being one of the co-organizers (even not the most active one) provided me already with a lot of experience concerning "what does it mean to organize a community conference". Check the program and sign in :-) !

Tuesday Apr 29, 2008

OpenSolaris in Parallels VM on Mac OS X

Note, this entry was updated on November 24th, 2008. OpenSolaris 2008.11 RC2 was used for testing.

I recently tried several Release Candidates for the OpenSolaris (Indiana) release and as I learned more about installing and setting up the OpenSolaris in Parallels virtual machine I decided to consolidate my previous posts on this topic. I also plan to update this entry later if a new information appears.

System

I performed all my tests at following system configuration:

Virtual Machine

The virtual machine has the following basic parameters:

OS TypeSolaris
OS VersionSolaris 10
Main memory1024 MB
Video memory16 MB
1 x HDD, size24576 MB
1 x CD/DVD ROMImage file with OpenSolaris image
2 x Serial portEmulation / Use output file
Network adapterBridged Ethernet / Default Adapter
Options/BootingBoot Sequence is set to boot from CD-ROM at first

Installation

The installation itself went without any problems, I just followed the instructions displayed by the installer. When the system is rebooted after successful installation do not forget to change the Options/Booting/Boot Sequence to boot first from the hard disk.

Network Set Up

Parallels emulate Realtek 8029(AS) network adapter. A driver for this adapter can be found at vmtools.iso CD image located inside /Library/Parallels/Tools directory. Click on the CD icon at the bottom of window running the OpenSolaris virtual machine and connect this image.

The vmtools.iso gets automatically mounted and inside /media/PRTOOLS/Drivers/Network/RTL8029/SOLARIS directory is located device driver for the Realtek network adapter. Copy all the files to a local disk and run network.sh script ($ pfexec ./network.sh). Choose to get the IP address through DHCP. Once the script finishes then just reboot and the network should be up an running.

Native Resolution in Full Screen Mode

After the installation the default resolution is 1024 x 768 points. This is nice but native resolution of the 15 inches MacBook Pro laptop is 1440 x 900 pixels, so the next step is to change X settings to be able to use the native resolution in a full screen mode. Here are the required steps:

  • Log as a root and copy file /etc/X11/.xorg.conf to file /etc/X11/xorg.conf
  • Edit the /etc/X11/xorg.conf as the following:
    • In the section "Monitor" add rows:
      HorizSync 31.5 - 100.0
      VertRefresh 59.0 - 75.0
      Option "dpms"
      Modeline "1440x900" 108.84 1440 1472 1800 1912 900 918 927 946
    • In the section "Screen" add row: DefaultDepth 24
    • For each subsection "Display" you want to use in the section "Screen" add a new resolution "1440x900" at the begin in the Modes line. For example:
      Modes "1440x900" "1024x768" "800x600" "640x480"
    • Restart X server (reboot).

References

Sunday Feb 17, 2008

Open Solaris Developer Preview 2 in Parallels

I tried to install today OpenSolaris Developer Preview 2 in Parallels Desktop 3.0 virtual machine. The installation went without any problems and I was able to get the network up and running using the method I described at OpenSolaris Developer Preview / Indiana on MacBook entry. The only extra step needed was to reboot the machine and then the network started to work.

Tuesday Nov 20, 2007

OpenSolaris Introduction for Students from Vienna

Students of Technical University of Vienna visited Czech Republic and as part of their program they also visited Prague Engineering Center (PEC). We have prepared for them a series of presentations, starting with information about Sun and PEC and continuing with OpenSolaris, NetBeans, and Glassfish. I had the opportunity to present about Introduction to OpenSolaris. This event was very interesting for me because of the following reasons:

  • It was the first time when I presented together with people from other engineering groups in Prague.
  • We talked about important part of Sun's software portfolio and all products we discussed are open source.
  • The students had interesting questions -- not too much technical but mostly economical -- how Sun can make money from software when almost all our products are open sourced and people can start to use them for free. So, instead of answering questions about ZFS, DTrace, etc., I talked about Sun's strategy in this space. It proved to be very good to have a CEO who blogs and read what he writes about :-) .

Me presenting:

Geertjan presents about NetBeans:

About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today