Ben's Blog

No description yet.

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that have been used in the blog.
  • Archives
    Archives Contains a list of blog posts that were created previously.
  • Login
    Login Login form

Mac OS X Dev (4) - Installing Bugzilla, MySQL and Bazaar (Yosemite 10.10)

Posted by on in Development, Software and Tools
  • Font size: Larger Smaller
  • 0 Comments

If you like a blog post with a happy ending then this blog post has one, but only just. This particular post is about me against Yosemite (10.10) when attempting to install Bugzilla. This time  I won, but barely and the victory wasn't pretty to see. All the same I won albeit with a complete lack of composure at the end. 

 With two big projects coming up I just had to get Bugzilla working, no matter what. So finally getting it to work was more out of desperation than  anything else. Although, because it took so long it did mean that I was not able to begin some other work, as planned. Anyway enough of the waffle here is the story, as it unfolded.

Inevitably, when you  first try this installation you shall fail, then you may succeed. It sounds like a prophetic line from a movie, however this is the real world and  this is how I felt during the installation process. Sometimes before you start a task you know it is going to be tough and when you view the  installation instructions seen in the screenshot below, your sense of foreboding is heightened. However, the process is further compounded by the installation of Yosemite, which I performed before hand.

002-002-001-000042.png

My starting point was the Mozilla wiki  located at  the following URL (https://wiki.mozilla.org/Bugzilla:Mac_OS_X_installation), which provides a comprehensive page on installing Bugzilla with MySQL.  The first thing to do is to go to the Bazaar (https://launchpad.net/bzr/+download) and download the Bazaar package. 

002-002-001-000043.png

Bazaar (www.bazaar.canonical.com), which is a "... version control system that helps you track project history over time ..." is used to download Bugzilla in an organised and up to date manner. 

When clicking on the Bazaar installer the usual blocker pops up and the installer  has to be unblocked manually to proceed by going to System Preferences -> Security & Privacy where the following message should be seen 

Bazaar-2.6.0-2.mpkg was blocked from opening because it is not from an identified developer.

 Click on Open Anyway button to unblock it. A series of dialogue boxes follow that keep you updated on the Baazar installation process, one of which is  shown below.

002-002-001-000043b.png

This  dialogue appears during the installation process to suggest that Bazaar is installed with Secure File Transport Protocol (SFTP) and Secure Shell (SSH) support. Good, we don't want any unwanted visitors popping in. Next, we install MySQL. Navigate to the MySQL website's downloadable area where, at  the bottom of the page, you should see the following Mac OS X installation options.

 002-002-001-000043c.png

I choose the DMG archive installation option and at the time of this installation the version of MySQL is 5.6.21, as can be seen in the screenshot above.

 002-002-001-000043d.png

I thought I can't be dealing with all that registration stuff right now and went straight for the "No, thanks, just start my download." option. As this was my second successive day of updating and installing software I really didn't have the patience to register and probably wait for a confirmation email. The series of dialogues encountered to install MySQL  are shown next.

002-002-001-000043e.png

 

002-002-001-000043f.png

Click on continue then  agree to the license agreement dialogue that follows.

002-002-001-000043g.png

 002-002-001-000043h.png

FAIL! Oh dear. At this point you may think and feel that all hope is lost. However, performing an Internet search suggested a solution. Following one such solution I typed the server start command in a command line window, otherwise known as a Terminal, as shown below:

$ sudo /usr/local/mysql/support-files/mysql.server start

To proceed, enter your password, or type Ctl-C to abort.

Starting MySQL

SUCCESS!

To determine the version of MySQL you are using type the following, on the command line.

$ sudo /usr/local/mysql/bin/mysql -v 

Server Version: 5.6.21 MySQL Community Server (GPL)

Although, the previous command starts the server instantly, the command is not persistent. When you decide to restart or reboot your machine you must remember to restart MySQL either via the System Preferences or again by using the command line, as described below. Also, don't forget to add the mysql directory (/usr/local/mysql/bin) to your shell path in your bash profile.

The next thing to do is set a unique MySQL root user password by typing the following:

$ sudo /usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere' 

Now there are two things left to do, fix the 2002 MySQL Socket Error, which was news to me  and AutoStarting MySQL on Reboot.

Fixing the 2002 MySQL Socket Error

This is to fix a client/server socket linking error between where MySQL places a socket and where Mac OS X thinks it should be. According to the people that know about such things MySQL puts the socket in /tmp and Mac OS X looks for it in /var/mysql. The fix, seen below, essentially creates a soft link between the two directories.

$ sudo mkdir /var/mysql

$ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

AutoStarting MySQL on Reboot

By this point you may be thinking of the comfort of a Microsoft Windows machine, but I like to pretend they have the same if not worse MySQL installation problems. To fix the MySQL failure during installation a solution posted on the forums suggest that you do the following.

Firstly, type

$ sudo nano /Library/LaunchDaemons/com.mysql.mysql.plist

Then, copy and paste the following code:

 

<!--?xml version="1.0" encoding="UTF-8"?-->

<plist version="1.0">

<dict>

< key >KeepAlive &lt/key>

<true>

<key > Label </key>

<string> com.mysql.mysqld </string>

<key> ProgramArguments </key>

<array>

<string> /usr/local/mysql/bin/mysqld_safe </string>

<string> --user=mysql </string>

</array>

</dict>

</plist>

Save it and then execute the following commands

$ sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysql.plist

$ sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist

$ sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist

Now MySQL should boot after a restart. I haven't restarted my Macbook yet so I cannot confirm if this fix actually works (I have now and it works - Ben). When MySQL is up and running the next thing to do, according to the guidelines, is enter the commands listed below to create a bugs database. I would like to change the bugs database to an issues database. However, for now I decided to just follow the guidelines without any modifications to avoid creating anymore complications to what turned out to be a trying instalment process.

CREATE DATABASE bugs;

GRANT ALL PRIVILEGES ON bugs.* TO bugs@'localhost' IDENTIFIED BY 'bugs';

After all hell broke loose, see below I dropped the bugs database and created a new one in the following way.

GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.* TO  bugs@localhost IDENTIFIED BY '$db_pass';

FLUSH PRIVILEGES;

This worked for me, so I proceed on to the final step of installing bugzilla, using Bazaar. 

Installing Bazaar

To install Bugzilla branch the Bugzilla source into a directory, using the command below.

$ bzr branch bzr://bzr.mozilla.org/bugzilla/trunk bugzilla-trunk

FAIL! Again! This didn't work for me as I got the following error.

bzr: ERROR: Couldn't import bzrlib and dependencies.

Please check the directory containing bzrlib is on your PYTHONPATH.

 

Traceback (most recent call last):

File "/usr/local/bin/bzr", line 74, in <module;gt;

import bzrlib

ImportError: No module named bzrlib

If I was performing this installation on LINUX I could have given up at this stage and waited for a more complete installation package. However, it seems that Mac OS X is very well supported and a fix to the latest problem, found on the Internet, suggests that the reason is due to bzr script looking for a python 2.x library, instead of the python2.6 library. Hence, the solution is given below.

$ sudo vi /usr/local/bin/bzr

then replace

#!/usr/bin/python

by

#!/usr/bin/python2.6

SUCCESS! Next I had to check whether the existing perl setup is compatible with Bugzilla by typing the following commands

$ cd bugzilla-trunk/

$ /usr/bin/perl chcksetup.pl

A summary of the results I got back can be shown in the screenshot below. 

a1sx2_Thumbnail1_002-002-001-000043i.png

So the next thing to do is to execute the command 

$ /usr/bin/perl install-module.pl --all 

To install the modules in /usr/local instead of lib, run install-module.pl as root with the --global option. (With hindsight I should have re-run the perl checksetup.pl command, because when everything is setup as expected the bugs databases should be setup. However, as they say hindsight is a wonderful thing).

Next, create a symbolic link in Apache's DocumentRoot 

$ cd /Library/WebServer/Documents 

$ sudo ln -s $HOME/bugzilla-trunk bugzilla 

Next, edit Apache's configuration file:

$ cd /etc/apache2 

$ sudo vim httpd.conf 

and add the line

Include /private/etc/apache2/extra/httpd-bugzilla.conf

I didn't really know where to add this line so I added it as the first line in the file. (Again, with hindsight  I would add this line after the last of the other Include statements, where it now resides).  The next thing to do is to create a httpd-bugzilla configuration file, http-bugzilla.conf, by doing the following.

$ cd /etc/apache2 

$ cd /etc/apache2/extra 

$ sudo vim httpd-bugzilla.conf

Add the contents of the &lt Directory&rt; section for whichever version of Bugzilla you are installing

The directory name should be /Library/WebServer/Documents/bugzilla

Include +FollowSymLinks in the Options directive

 After this point you are supposed to follow these last two instructions. 

  1. In "System Preferences" ⇒ "Sharing": enable the "Web Sharing" checkbox to start Apache.

  2. Visit http://localhost/bugzilla to complete configuration.

The web sharing option does not exist in Yosemite and you need to start apache manually using the following command  

$ sudo apachectl start

Likewise, to restart or stop teh server you can use the follwoing commands:

$ sudo apachectl stop

$ sudo apachectl restart

When I tried visiting http://localhost/bugzilla, it didn't work. First I got the following two errors, at one stage or the other.

  1. Safari could not connect to server ...

  2. A listing, rather than a render, of the perl script text

 

However, at this stage, while trying to fix these two problems, all hell broke loose and I lost all sense of composure and stopped documenting the steps I took, as there were so many of them. I spent about the next 6 hours browsing and fumbling around the Internet, until I finally ended up with the bugzlla configuration page at http://localhost/bugzilla, seen below. How I got this to finally work is a wonder, but I did somehow.

002-002-001-000043j.png

If you have questions you can for sure ask them, but there is no guarantee I will be able to help. The next thing I need to do so is setup an account if Bugzilla doesn't die on me. I wonder what would happen if I restart my machine .....

Last modified on
0
Tagged in: Mac OS X Yosemite