Saturday, May 05, 2007

Installing MySQL on Solaris 10 Virtual Machine

Now that I am happy with my Solaris 10 virtual machine running on my Mac Book, I can proceed with installing (compiling) MySQL on it. However as you can expect, the default Solaris 10 installation doesn't install cc compiler by default. We can confirm that if the following error message is displayed when running we run cc on Solaris 10 console:
bash-3.00# cc
/usr/ucb/cc: language optional software package not installed

What this means is that we need to install Sun Studio 11 from Sun site. Before downloading you need to be logged in. The download file studio11-sol-x86.tar.bz2 is about 332.6MB.

Once you have it installed, check the checksum and then proceed with decompressing the Sun Studio 11 bz2 file. Note I used the very verbose and keep option. You may or may not want to use them.
bzip2 -d -v -v -k studio11-sol-x86.tar.bz2
time tar -xvf studio11-sol-x86.tar > studio11-install.log
# 4m53s

Among other files, it will put an InstallGuide_Solaris.pdf file which you should read before installing. On Solaris you can use gpdf to launch the file.

One thing to note when installing Sun Studio 11 is that you will need to set your PATH environment variable. By default the PATH variable will be set as following:
echo $PATH

Since Sun Studio 11 will be installed in /opt/SUNWspro/bin we will need to add this to the PATH variable. To set the PATH variable, put the following line in your ~/.bashrc
export PATH=$PATH:/opt/SUNWspro/bin

Once the above has been placed, you will need to "dot" the file.
. ~/.bashrc

Now your PATH should be setup appropriately. Similarly you will need to setup MANPATH to include /opt/SUNWspro/man.

Once the Sun Studio will be installed, we will be able to access the documentation from /opt/SUNWspro/docs/index.html.

Before continuing, we should have ample swap space defined. You can add swap space by following the procedure below. On your Solaris 10 virtual machine, make sure you don't create the new swap file at / or you may get an error relating to no more space left on device. Since I created the virtual file system at /export/home through Parallels, I have prefixed my swap file location with /export/home.
mkdir /export/home/swap
mkfile 2048m /export/home/swap/2gswap
ls -l /export/home/swap/2gswap

When I tried to specify the new swap space, I got the following error. This is related to me setting a small swap size using Parallels. To correct this, I will need to set swap space higher through Parallels and then try again.

swap -a /export/home/swap/2gswap
# size is invalid

I tried again with 900M swap and it worked fine.

Now we can either run the installer in GUI or command-line mode. I haven't yet used the GUI installer to install Sun Studio 11 so I am going to do that just out of curiosity.

To launch the GUI installer, navigate to where you decompressed the Sunstudio11 files and run

To launch in command line mode:
./installer -nodisplay

Once the installer launches, click next to go to and accept the agreement. On the next screen make sure only English is selected. Keep the default selections selected for installation.

For the Sun Studio 11 software install directory, make sure it is /opt or you may need to modify your PATH and MANPATH variables accordingly.

Next you can review the installation and once you confirm the installation will begin.

Once the installation is complete, you will be able to see the log files created during install at
cd /var/sadm/install/logs

Some interesting information is available in /opt/SUNWspro/READMEs/email_template.txt.

At this point you should be able to run the IDE by executing

You should check to make sure that which cc doesn't return /usr/ucb/cc. If it does then do the following:
cd /usr/ucb
rm cc
ln -s /opt/SUNWspro/bin/cc cc

I will continue in the next post.


Anonymous said...

Checkout /usr/sfw/bin/gcc. The dev environment is installed by default.

Anonymous said...

The limit for the swap file is 2GiB. This works:

# mkfile 2047m /root/2gswap
# swap -a /root/2gswap
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c4d0s1 102,193 8 4194288 3335120
/root/2gswap - 8 4192248 4192248