Categories
Apple Gadgets & Tech Mac Mini OS X Server

Setting Up a Mac Mini Snow Leopard Server Without a Display

The Mac Mini has always been a great little workgroup or home server. The low power consumption combined with the form factor have convinced me to pick up my second mac mini since 2005. The first one was a PowerPC based 1st gen Mini and served as a primary desktop for many many years. This new Mac Mini Server with a 2.66GHz Intel Core 2 Duo and 1TB HD will be used as file, database, web and media server.

I’m not going to get into setting up all those things right now. I’m going to get into how to go thru the basic setup of the Mac Mini with Snow Leopard Server if you don’t have a display to connect it to. Unfortunately, Apple doesn’t ship the Mac Mini Server with an HDMI adapter so I had to dig around on getting the Mini setup. The instructions that come with the Mini aren’t very helpful.

What you need:

  • Mac Mini Server – called “minisrv” from here on.
  • Another Mac that will be used as your desktop/admin machine – called “mac1” from here on. A PC with Windows may be ok but I haven’t tested that config.
  • An (wired) ethernet switch, a WiFi Router that has room to plug in at least 2 ethernet connections or an ethernet hub
  1. Install the “Admin Tools” cd that came with the minisrv.
  2. Ensure that you have DHCP enabled on your network so minisrv can get an IP address.
  3. Make sure both computers are connected to the switch, router or hub. mac1 doesn’t have to be connected via ethernet if you’re connecting both machines to a WiFi router, though, minisrv should be connected using ethernet.
  4. If you can’t go wired, you should disable any sort of encryption or passwords on your WifI and also ensure that the SSID broadcast is turned on.

  5. Turn the Mac Mini on and about a minute or two after you hear the chime, you should SSH into the box. Now this will be tricky. You need to know what the IP address of the Mac Mini is. On mac1, go to Applications -> Server and launch “Server Admin”. You should see an IP address listed there. Unless you have multiple Mac servers running, this IP will be the one you should ssh into.
  6. Launch Terminal
  7. ssh from mac1 to minisrv
    mac1# ssh root@
    The password to use here is the first eight digits of minisrv’s serial number.
  8. Type the following into your terminal:

    localhost:~ root# cd /Library/Preferences
    localhost:~ root# echo -n enabled > com.apple.ScreenSharing.launchd
  9. Go to Finder -> Connect to Server and click on Browse. You should see minisrv showing in the list on the left. Click on it and then click on “Share Screen”.
  10. Go ahead and follow the directions to finish setting up your new Mac Mini Server.
Categories
Apple Database iMac MacBook MySQL OS X

MySQL 64bit, Perl 32bit and OS X Leopard

This is a little tip on how to get Perl(32bit) working with a 64bit version of MySQL on OS X Leopard.

I was working on a small project today that required MySQL 5.067 and I opted to do it in Perl 5.10. You may remember a post that I put up in August describing how to compile MySQL 64 bit for OS X Leopard. Well, since then I also compiled and installed Perl 5.10 (not replacing Apple’s system install of Perl). I wanted to take advantage of some of the Perl 6 features that have been backported to Perl 5.10 (the first Perl release in two years).

Back to today’s project, I decided to use the awesome Class::DBI Perl module to do my little project. I wrote all my code and began to run it in the perl debugger and realized that I need to install the DBD::mysql module. During the installation process for DBD::mysql, the Perl module is compiled using the mysql libraries and header files. Compilation wasn’t a problem. It’s when we got to the ‘make test’ step that all hell broke loose.

To cut a very long story short, I kept getting the error below:


# Failed test 'use DBD::mysql;'
# at t/00base.t line 21.
# Tried to use 'DBD::mysql'.
# Error: Can't find 'boot_DBD__mysql' symbol in /Users/pankaj/.cpanplus/5.10.0/build/DBD-mysql-4.010/blib/arch/auto/DBD/mysql/mysql.bundle

I dug around a bit and decided to run the installation manually. The problem here has to do with compiler flags that were used for mysql. MySQL was compiled as a 64 bit Leopard binary. However, Perl 5.10 was compiled as a 32bit binary because many Perl modules don’t support 64 bit out of the box.

To solve the problem, I had to recompile the mysql client libraries:


--($:~/src/mysql-5.0.67)-- export ARCHFLAGS="-arch i386"
--($:~/src/mysql-5.0.67)-- CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql.32 --without-server --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-shared
--($:~/src/mysql-5.0.67)-- make
--($:~/src/mysql-5.0.67)-- make test
--($:~/src/mysql-5.0.67)-- sudo make install

Once the mysql client libs were done compiling and installed into /usr/local/mysql.32, I changed my PATH to ensure that the newly compiled mysql libraries and binaries were picked up before anything else.


export PATH=/usr/local/mysql.32/bin:${PATH}

Once that was done, I went back to my DBD::mysql source directory and built it using the following commands:


--($:~/src/DBD-mysql-4.010)-- perl Makefile.PL --libs="-L/usr/local/mysql.32/lib/mysql -lmysqlclient -lz -lm" --cflags="-I/usr/local/mysql.32/include/mysql"
--($:~/src/DBD-mysql-4.010)-- make
--($:~/src/DBD-mysql-4.010)-- make test
--($:~/src/DBD-mysql-4.010)-- sudo make install

This time, make test ran beautifully with a few minor exceptions because I didn’t actually give it a mysql db to connect to.

The mysql 32bit client can easily connect to the 64 bit server. Perl, Class:DBI are now very happy and the application is running as planned.
[ad#post]

Categories
Apple MySQL Open Source OS X

Running MySQL on OS X Leopard

I’ve recently gotten back into some development and needed to run MySQL on my Leopard computers. The easy way out was downloading and running MAMP (a great pre-built package of Apache and MySQL). Unfortunately, I hated starting the Apache and MySQL daemons manually.

I created OS X launchctl scripts to start Apache and MySQL but I hated the fact that I was maintaining two installations of Apache (the one that comes with OS X and the MAMP one). I wanted one simple installation of everything that would start automatically. Also, occasionally, weird things would happen with permissions and I’d have to shut everything down and restart again.

It’s been some time since I compiled my own software so I was looking forward to compiling MySQL from scratch. The first thing I found was this great post on Hivelogic about compiling MySQL. I’m not going to regurgitate what’s in the post but I’m going to highlight the configure flags for Leopard. Most times, when compiling applications, getting all the flags right is the only way to ensure your specific OS and architecture are properly supported in the compilation process and it’s the only way to squeeze out the best performance.


CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --enable-shared

Make sure you change your root (data base administrator password) by running:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h localhost password 'new-password'

Don’t forget to secure your server as indicated on HiveLogic.

My plist file for automatically launching MySQL under MAMP is here. Feel free to compare it to the post at HiveLogic or change it to suit your needs. If you have any suggestions on how to improve it, please let me know.

Categories
Apple iPhone Jailbreak OS X

iPhone 1.1.3 Jailbreak Released

A splinter dev team released iBrickr for Windows and Apple OS X to jailbreak Apple iPhones with firmware 1.1.13. This jailbreak will only work on phones that have been upgraded from firmware 1.02 to 1.1.1 or 1.1.2 and then to 1.1.3. This jailbreak will NOT work on OTB (Outta The Box) 1.1.3 iPhones. As with all jailbreaks and other hacks, you could very easily end up with a nice $400 paperweight, so be very careful if you decide that you absolutely must jailbreak your iPhone.

Be warned that this jailbreak DOES NOT allow unlocking of 1.1.3 iPhones. There is currently no unlock for the 1.1.3. It’s possible that IPSF will work but so far, there hasn’t been any confirmation. If you need any unlocked iPhone stay with 1.1.1.

Get info and download iBrickr for Apple OS X here and you can download iBrickr for Windows here.

Categories
Apple iTunes MacBook OS X

Apple MacBook Hard Drive Goes Kplunk!

After downloading from iTunes and watching episode 3 of the second season of Sleeper Cell: American Terror, my MacBook completely froze up and wouldn’t respond to anything. I don’t think it was some terrorist plot to thwart my viewing of Sleeper Cell but I was forced to power off the machine and since then I haven’t gotten the machine to boot up. The MacBook displays the blinking folder with a question mark in it. This means, the MacBook doesn’t recognize that a hard drive is present.

I called Apple support in the US and they are pretty sure the hard drive is dead. I’ve sent an email to Apple in New Delhi with my case number and I’m waiting to hear back from them about salvaging any data on the drive, if possible, a replacement drive, and OS X 10.4 installation disks since I don’t have my install disks with me in New Delhi. I hope to hear back from them ASAP as I need to finish the second season of Sleeper Cell 🙂

Update Juney 28th, 2006: I went to Apple Care Delhi on Monday and had the MacBook tested. The drive was not being detected in Target mode or or with the Disk Utility so a new drive was ordered and delivered on Wednesday. I had to call Apple in the US to request OS X Tiger replacement disks which were also delivered on Wednesday. Apple was also very quick about re-enabling my iTunes account to download any of the music and shows that were not backed up. Overall, a real pain and lost a lot of data but the MacBook is up and running again.