Building MySQL on OpenSolaris (from a source distribution)

One of the things that I've been wanting to do is build MySQL.  I checked out this blog from Neel and the instructions posted on the MySQL site and it looked fairly straightforward.  After going through the steps, I can say that it proved to be quite simple.  Note that I built the latest rc candidate of MySQL on OpenSolaris using Sun's compilers.  Here are the steps for people who are interested.

    1. Install OpenSolaris.  I already have OpenSolaris 2008.05 running within VirtualBox on my laptop.  If you need the ISO image, it can be downloaded from here.
    2. Install Sun compilers by issuing the following command: pfexec pkg install ss-dev.  The tools are installed in /opt/SunStudioExpress.
    3. Prepare the user environment for MySQL by issuing the following commands:
      • groupadd mysql
      • useradd -g mysql mysql
    4. Become the mysql user with su mysql.
    5. Download the latest MySQL source from dev.mysql.com. I downloaded the compressed GNU TAR archive (tar.gz) version 5.1.29-rc from here.
    6. Extract the MySQL source code from the archive with the commands below.  The source code will be extracted to mysql-5.1.29-rc.
      • gunzip mysql-5.1.29-rc.tar.gz
      • tar xvf mysql-5.1.29-rc.tar
    7. Set the following environment variables:
      • export CC=/opt/SunStudioExpress/bin/cc
      • export CXX=/opt/SunStudioExpress/bin/CC
      • export CFLAGS="-xO3" #Change this to have your compiler variables
      • export CXXFLAGS="-xO3"
      • export PATH=$CC:$CXX:/usr/sfw/bin:/usr/ccs/bin:$PATH
    8. Create a sym link from gmake to make with cd /usr/sfw/bin ; ln -s gmake make
    9. cd to the source code directiory. In my case mysql-5.1.29-rc.
    10. Execute the following command at the prompt: ./configure --prefix=/usr/local/mysql
      • The configure command allows you to control the configuration of the MySQL source distribution.  A full listing of the options to configure can be found here.  Prefix simply installs architecture-independent files in the location specified by prefix (everything is installed under /usr/local/mysql rather than the default of /usr/local).
    11. Execute the following command at the prompt: make
    12. Execute the following command at the prompt: make install

     At this point, under /usr/local/mysql/bin, you will see the mysql_install_db script, which will allow you to install MySQL.  After that, you can run mysqld_safe to start mysql. 


    Comments:

    Related post: http://blogs.sun.com/amitsaha/entry/mysql_6_0_alpha_on2

    Posted by Amit on November 10, 2008 at 01:00 PM PST #

    Post a Comment:
    • HTML Syntax: NOT allowed
    About

    Jennifer Glore

    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