Thursday, November 28, 2013

MySQL Installation - Solaris 10

#vi .bash_profile
export PATH=$PATH:/usr/sfw/bin/:/opt/sfw/bin/:/opt/sfw/squid/$:/root/moshell:/usr/dt/bin:/opt/CTXSmf/bin:/opt/CTXSmf/sbin:/usr/apache2/bin:/etc/sfw/mysql

#pkginfo | grep -i mysql

system      SUNWmysqlr                       mysql - MySQL Database Management System (root component)
system      SUNWmysqlt                       mysql - MySQL Database Management System (test component)
system      SUNWmysqlu                       mysql - MySQL Database Management System (usr component)

We require two packages to be intalled to run our server.

1. SUMWmysqlr   The server component
2. SUMWmysqlu   The user component

We one more optional component 3. SUMWmysqlt - Which is for test purpose, and we wont cover that.

Install the mysql packages

#pkgadd -d SUNWmysqlr
#pkgadd -d SUNWmysqlu
#pkgadd -d SUNWmysqlt

To Check if the package is installed
# pkginfo -x | grep mysql
SUNWmysqlr                        mysql - MySQL Database Management System (root component)
SUNWmysqlt                        mysql - MySQL Database Management System (test component)
SUNWmysqlu                        mysql - MySQL Database Management System (usr component)

To know about the installed package
# pkginfo -l SUNWmysqlr
   PKGINST:  SUNWmysqlr
      NAME:  mysql - MySQL Database Management System (root component)
  CATEGORY:  system
      ARCH:  i386
   VERSION:  11.10.0,REV=2005.
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  mysql - MySQL Database Management System (root component) 4.0.31
    PSTAMP:  sfw10-patch-x20080616093045
  INSTDATE:  Jul 10 2011 10:50
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:        7 installed pathnames
                   3 shared pathnames
                   5 directories
                   1 executables
                  16 blocks used (approx)

To View the contents of the package
# pkgchk -v SUNWmysqlr

README.solaris.mysql  is important document here, make sure we go through it.

Now we initialize the Database.
# /usr/sfw/bin/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
110814 12:41:06 /usr/sfw/sbin/mysqld: Shutdown Complete

To start mysqld at boot time you have to copy /etc/sfw/mysql/mysql.server -  to the right place for your system.

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:

#/usr/sfw/bin/mysqladmin -u root -h solaris-1 password 'daewoo'

See the manual for more instructions. You can start the MySQL daemon with:
#/usr/sfw/sbin/mysqld_safe &

You can test the MySQL daemon with the tests in the 'mysql-test' directory:
#cd /usr/sfw/mysql/mysql-test; ./mysql-test-run

Please report any problems with the /usr/sfw/bin/mysqlbug script!

The latest information about MySQL is available on the web at - Support MySQL by buying support/licenses at

Next Step is to Populate
#installf SUNWmysqlr /var/mysql d 770 root mysql

We will be running the mysql service under user mysql. For that we will create the user mysql
#groupadd mysql
#useradd -g mysql mysql

Note : There is no need to set up password for mysql.  Since we wont log-in with mysql. we just need it to run
the process under mysql account.
#chgrp -R mysql /var/mysql/
#chmod -R 770 /var/mysql/

Next Step is to copy config file to /etc/my.cnf we will copy from the
#cp /usr/sfw/share/mysql/my-medium.cnf /etc/my.cnf

When starting the mysqld (daemon), it reads the my.cnf in the /etc

We will copy the configuration file from /usr/sfw/mysql/  There are various kind of configuration files
we have


Based on your requirement you could copy the file as /etc/my.cnf

MyISAM Storage engine creates following major data files in the mysql data directory normally /var/lib/mysql (exact you could find in the /etc/my.cnf)

File Extension     Purpose
.frm         table definition
.MYD         table data
.MYI         table indices

InnoDB Storage Engines create the following files for data storage.
.frm             Table structure
ibdata1        Default Data file.

Configure Mysql to start on reboot automatically

We have link the mysql.server to various runlevel start up scripts

ln /etc/sfw/mysql/mysql.server /etc/rc3.d/S99mysql
ln /etc/sfw/mysql/mysql.server /etc/rc0.d/K00mysql
ln /etc/sfw/mysql/mysql.server /etc/rc1.d/K00mysql
ln /etc/sfw/mysql/mysql.server /etc/rc2.d/K00mysql

To Start the SQL Server
#mysql.server start

Then Check the TCP port 3306 is LISTENING

#netstat -an | grep LISTEN

Tuesday, November 26, 2013

How to improve disk I/O performances with VMware Workstation

Even on a 2 GB RAM workstation (as mine) VMware virtual machines can run slowly. Too slowly sometimes.
This can depend on a large amount of factors but we can reduce the number to 4 critical issues:
  1. Antivirus real-time protection
    You probably run VMware Workstation on your everyday working computer, and you probably want to stay secure running an antivirus software. The most useful feature of any AV is the real-time protection, catching and monitoring I/O accesses of every process for suspicious activities.
    This feature can greatly impact on your VMs performances and should be fine-tuned for virtualization.
    So be sure to create an exclusion filter on your real-time protection settings for .vmdk (VMware virtual disk) and .vmem (VMware virtual memory) files. In this way countinous I/O operations on your virtual machines will not be hit by antivirus checking.
    Note: if you plan to run liveCD operating systems (like Knoppix) inside your VMs or simply often use CD images for installing new software, I highly recommend to exclude .iso files too from AV checking.
  2. HostOS disk fragmentation
    A really performance hitter for virtual machines is a fragmented host OS disk. VMs virtual disks are very large (4 GBs at minimum on the average) and are created by default as non preallocated. In other words your virtual disk grow as you install more software on the guest OS till reaching your defined disk limit.
    If you use only one physical disk for everyday work and VMs storing, you probably will use space around a growing virtual disk, obliging your host OS to fragment virtual machines more and more.
    So be sure to:
    • Create a dedicated partition for virtual machines only
    • Create guest OSes virtual disks with Allocate all disk space now option
    • Schedule a daily De-fragmentation for your virtual machines directories (maybe at launch time or during the night)
  3. Memory trimming
    Workstation checks which part of the guest OS virtual memory is not used and allocates it back to the host OS. This permits to have more concurrent virtual machines running but everytime the guest OS asks back for its memory it suffers a performance degradation. So, if you have enough free RAM for all planned concurrent VMs, be sure to disable memory trimming for guest OSes adding the following line to the virtual machine configuration (.vmx) file:
    Note: Memory trimming can be disabled through GUI since Workstation 6.0.
  4. Page sharing (quoted from VMware documentation)
    VMware uses a page sharing technique to allow guest memory pages with identical contents to be stored as a single copy-on-write page. Page sharing decreases host memory usage, but consumes system resources, potentially including I/O bandwidth. You may want to avoid this overhead for guests for which host memory is plentiful and I/O latency is important. To disable page sharing, add the following line to the virtual machine configuration (.vmx) file:
    sched.mem.pshare.enable=FALSE option
These suggestions will work well for every VMware Workstation 5.x and Player 1.x since both share same engine.

Tuesday, November 12, 2013

Virtualbox Shared Folder access from Guest Machine

Virtualbox's Install Guest Additional (VBoxGuestAdditions.iso)

#svcadm restart volfs

#pkgadd -G -d ./VBoxSolarisAdditions.pkg

#mount -F vboxfs -r installers /mnt (note: c:\installers)

vi /etc/vfstab
installers          -         /mnt        vboxfs     -      yes       -
Solaris10 - /mrkips_vista vboxfs - ye

#pkgrm SUNWvboxguest


VirtualBox Manager Command

Sometimes you will find the problem "The selected virtual machine is inaccessible" and obviously you can't access VMs you've created. In my case I just deleted all the VMs directly from the C: Drive.
When I open the virtual box all the virtual machine grey out and inaccessible.
In my case I just no longer needed for those VMs. So delete all the files under C:\Users\zawhtet\.VirtualBox


You want to unregister the VMs from the Command Prompt,

First List the VMs to check the status

C:\Program Files\Oracle\VirtualBox\VBoxManage.exe list vms
"precise64" {3613de48-6295-4a91-81fd-36e936beda4b}
"" {2568227e-e73d-4056-978e-9ae8596493d9}
"" {0fb42965-61cb-4388-89c4-de572d4ea7fc}
"" {c65b1456-5771-4617-a6fb-869dffebeddd}
"" {9709d3d5-ce4d-42b9-ad5e-07726823fd02}

 One of those VMs flagged as inaccessible is my lost VM! Time to fix VBoxManage's wagon, by unregistering the VM as inaccessible, then re-registering it with the correct name:
  1. Open the configuration file for your lost VM. Mine was saved to C:\Users\zawhtet\VirtualBox VMsrails-vm-v2\rails-vm-v2.vbox
  2. Find and copy the value of the uuid attribute of the Machine node. Mine was 9709d3d5-ce4d-42b9-ad5e-07726823fd02 
  3. In a command prompt (or Cygwin terminal), unregister the VM with the unregistervm command, using the [uuid] value from step 2: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe unregistervm 9709d3d5-ce4d-42b9-ad5e-07726823fd02 
  4. Now register the VM using the registervm command, with the path to the VM configuration file:
    C:\Program Files\Oracle\VirtualBox\VBoxManage.exe registervm C:\Users\zawhtet\VirtualBox VMsrails-vm-v2\rails-vm-v2.vbox