|
At the crossroad of New media, Engineering, Research and Development
|
|
Archive for ‘osx Server’ Category
Nov
02
2011
Using iCloud to sync files just like dropboxIf you didn’t know, iCloud has a really neat feature that allows it to act just like dropbox. If you activate the “Document & Data” synching option in the iCloud pref panel, it allows you to sync any file using iCloud. This is contrary to what Apple is selling the service as being just for “Custom” Apps that have the iCloud feature (i.e.: keynote, numbers, etc.).
Feb
04
2011
Adding mcrypt support to builtin php5 on OSX Leopard….I got a request to add mcrypt support to our Leopard server today and here is a brief step-by-step installation instruction. This works well under the current 10.5.8 server installation. It should also work for 10.6 (snow leopard), but I have not tried it. Before you start here are the requirements:
Please note that this will add mcrypt support to php. This is NOT the same as compiling mcrypt. Okay, so now that we have all the requirements, you need to get a command line window opened and get a root shell (sudo -i). The rest of this document assumes you’re typing the commands in a root shell. There is one dependency that we need to clear before we actually get down and dirty and that is libmcrypt. Follow the instructions below to get this installed:
This is the latest version as of this writing (Feb.04.2011). NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:
The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/local/lib
At this point you should have a working installation of libmcrypt. This next command prints out the current version of your php engine. In my case under 10.5.8 it’s php 5.2.14.
Grab the appropriate php-5.2.XX.tar.bz2 file from php.net. I just grabbed the stock PHP 5.2.14, since I wanted a perfect match between my php engine and the extension. I transferred the file using sftp to the /SourceCache folder on the server. NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:
The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/lib/php/extensions/no-debug-non-zts-20060613
Now we need to modify our php.ini file and tell the php5 engine of the availability of this new module. To do this you need to copy php.ini.default to php.ini (in /etc directory). For details of why have a look at this article.
Edit the newly created/copied php.ini using your favourite editor. Add the following line to the appropriate location (read the comments in the file to find the location):
Still in the same file find the variable “extension_dir” and change it’s value to “/usr/lib/php/extensions/no-debug-non-zts-20060613″ path instead of “./”. Save the php.ini and use the following command to see if mcrypt extensions are available:
Done. Restart Apache service from the server manager (just for the sake of completeness). Feb
04
2011
Adding GD support to builtin php5 on OSX Leopard….I got a request to add GD support to our Leopard server today and here is a brief step-by-step installation instruction. This works well under the current 10.5.8 server installation. It should also work for 10.6 (snow leopard), but I have not tried it. Before you start here are the requirements:
Please note that this will add GD support to php. This is NOT the same as compiling the GD graphics library (libgd). Okay, so now that we have all the requirements, you need to get a command line window opened and get a root shell (sudo -i). The rest of this document assumes you’re typing the commands in a root shell. There is one dependency that we need to clear before we actually get down and dirty and that is libjpeg (known as jpegsrc). Follow the instructions below to get this installed:
This is the latest version as of this writing (Feb.04.2011). NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:
The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/local/lib
At this point you should have a working installation of libjpeg. Now we double check our php version.
Notice in the output that I have php 5.2.14 installed on the machine (again the latest update as of Feb.04.2011). Apple does not provide source code for this exact version of PHP. On top of that The numbering scheme that they use is weird. On my machine it is “apache_mod_php-44.6″, you can find yours using the following:
The thing you’re looking for (“apache_mod_php-44.6″) is under Configure Command. If you go to the following URL (http://www.opensource.apple.com/source/apache_mod_php/) in your browser (safari, firefox) you’ll soon discover these weird directory names with numbers that don’t match the php versions. Again, as of this writing (Feb.04.2011), I can’t find apache_mod_php-44.6 folder in the listing so I grabbed the nearest numbers apache_mod_php-44.2 which is php 5.2.8…….close enough. It seems to work. Follow the steps below to get the file and compile the GD portion of it. Remember we’re not recompiling the entire php, just the GD plugin portion. UPDATE: You CAN install the exact version of your PHP’s GD extension. Instead of grabbing the file from Apple, figure out the version of your PHP using “php -v” and grab the appropriate file from php.net instead. I just recompiled the GD portion of PHP 5.2.14, since I wanted a perfect match between my php engine and the extension. The instructions below (except curl which needs to be modified) work. NOTE: If you’re compiling on a G5 machine you’ll need to tell the compiler that you want to build/configure for a ppc64 target so instead of the below configure command you need to use this:
The last command will simulate the installation process. Make sure the stuff is getting installed in /usr/lib/php/extensions/no-debug-non-zts-20060613
Now we need to modify our php.ini file and tell the php5 engine of the availability of this new module. To do this you need to copy php.ini.default to php.ini (in /etc directory). For details of why have a look at this article.
Edit the newly created/copied php.ini using your favourite editor. Add the following line to the appropriate location (read the comments in the file to find the location):
Still in the same file find the variable “extension_dir” and change it’s value to “/usr/lib/php/extensions/no-debug-non-zts-20060613″ path instead of “./”. Save the php.ini and use the following command to see if GD extensions are available:
Done. Restart Apache service from the server manager (just for the sake of completeness). Jan
16
2011
Optimizing Snow Leopard for SSD drives….I just installed a new 128GB SSD drive in my older C2D 17″ macbook Pro and let me tell you….WOW….This thing is on fire. The system is extremely responsive and apps literally jump onto the screen. The machine now boots up to full desktop in roughly 17 seconds. Now that’s nice. I did do a bunch of changes to the way Snow Leopard is setup to optimize a couple of things that are normally tuned for HDD’s.
This should do it. Have fun with your new SSD drive. Sep
20
2010
say -v "Bad News" fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fuk fukSep
20
2010
Map any network drive to Mac OS X that auto mounts after system rebootHere is a quick recipe for making a network drive auto mount on your OSX machine. This works with pretty much any protocol supported by Finders “Connect to Server” option. Here is how you do it:
That’s it…..Enjoy Sep
02
2010
Reset iTunes 10 window control buttonsNot sure what’s happening lately in the Apple UI design department. Someone over there decided to reposition the window control buttons (you know x,-,+ aka. close,minimize,maximize) vertically in the latest itunes10 (see pics below). If you prefer the old (proper) way of having them ordered horizontally (see picture above), you can use the commands below:
If you need to reset it back, you can use the commands below:
Aug
26
2010
OSX Server: Could not setup Mach task special port 9
If you’re seeing this warning/error in your OSX Server log files, it is more than likely caused by cron running jobs for mailman subsystem. Even if the Mail process is disabled in Server Admin, OSX will try to run these cron jobs. The way around this (only do this if you’re NOT running mail server or mailman mailing list manager on your box) is to comment out all lines in /usr/lib/cron/tabs/_mailman file (insert a # character at the beginning of each line that doesn’t have it). This fixed the problem for me…..hopefully it will also work for you Aug
25
2010
Duplicating service settings under OSX Server…This mainly applies to how you deal with a backup DHCP server and it’s configuration, but might also be useful for backing up other service settings. One of the things that kinda bugs me about how some services are configured in OSX Server is the fact that the configurations are stored in the directory. For example, if you have a DHCP server servicing a subnet with a ton of reservations hardcoded in it, there is no way of editing and/or moving the information from the command line (ie: there is no single config file that contains the current configuration) to another server. That’s where the “serveradmin” commandline program comes to rescue. If you have two identical servers (ie: both running the same OSX server version), you can use serveradmin to export the settings from a specific service and then move the file to the new server and import it there. All using the CLI.
Aug
23
2010
MySQL Replication howto for Snow Leopard…We recently upgraded our servers from old XServe G5′s running Tiger to the latest greatest running Snow Leopard. In this small howto I will deal with the procedure I followed to setup mysql master-slave replication between two new servers. I start out with two (master, slave) empty DB’s, setup the replication and then import my data from a third server (my old G5 X-Serve). Of course like anything else I will try to show you how to get out of — what I like to call — Steve Jobs Hell Holes - First things first….the magic command that stops mysql server from command line, just in case you screw something up and need to restart (This should be used on your master and slave servers prior to them going live…..DO NOT USE THIS ON A LIVE SERVER):
This will stop the launch Daemon from continously launching mysql when trouble is brewing. This usually happens when you screw something up badly and the symptom is that the Server Manager Status for MySQL will say “Starting up“, but never changes to “Running“. - Next I want to blow away my DB files on the master and slave (remember these are NOT production servers yet…..I’m still rebuilding them. You DO NOT want to remove the DB’s on your production servers). You’ll need to find the path in the “Settings” tab of the server manager, under “Database Location“. I removed everything in that directory (rm -rf *) from the command line. AGAIN, I CAN NOT STRESS THIS ENOUGH, BE CAREFUL WHERE YOU ISSUE THESE COMMANDS. - I did this on both the master and the slave. - Now on the Master change the following in /etc/my.cnf (You should have this file, if you’ve got a my.cnf.default, copy it my.cnf).
- On the Master still, check the “Allow Network Connections” check box in Server Manager and set the root password (for mysql) by pressing the “Set MySQL Root Password…” button. Then press “Save” followed by “Start MySQL“. This will initialize mysql with the default tables and setup the root password. - Now on the Slave change the following in /etc/my.cnf (You should have this file, if you’ve got a my.cnf.default, copy it my.cnf).
- Back on the Master, you need to create a user (I call it repl) that has REPLICATION SLAVE privilege. Use the following two commands (make sure you replace mydomain.com and slavepass….LEAVE repl as the userid:
- Next we need to flush the tables and issue a read lock (yes, just because we can):
- Still on the master we find out the current binary log file name and position:
Note down the filename and the Position number. We will need them later. - Back on the Slave, go to Server Manager and set the root password (for mysql) by pressing the “Set MySQL Root Password…” button. Then press “Save” followed by “Start MySQL“. Connect to the DB as root and issue the following command:
This will setup the slave to talk to the Master and do it’s thing. While we are here, we might as well verify that the repl user can log into the master from the slave:
should prompt you for password and if you type in the ‘slavepass’ you assigned above, you should be able to get in. - Back on the master unlock the tables:
- Last but not least on the slave, turn on the slave mode:
Done…..Now you can go to your production server and suck it’s brains (ahemm…..DB’s) out and import it into your master. Your slave should follow and replicate whatever you import into the master Server. I used the following command (you mileage might/will vary):
Transfer “goodies.sql” text file from your production server to the master server (ssh/scp/ftp….whatever).
Aug
05
2010
Restarting into Mac OS X using the command line, when running Windows…Okay so this only works in Boot Camp 3.0+ which comes with Snow Leopard (10.6). If you ever find yourself in Windows and need to quickly — using command line — change your boot option to reboot into OSX (process known under OSX as blessing) you can use the following command: Aug
05
2010
Forcing 64-bit mode when booting OSX 10.6 (Snow Leopard)…You all probably know about the trick with holding down 6 and 4 keys on your keyboard to force OSX 10.6 to boot using the 64-bit kernel. What you might not know is that it’s temporary and the next time you reboot, you’re back to using the 32 bit kernel. Now I can’t guarantee that your machine will not catch fire and blow up (just kidding)…..but if you know what you’re doing and want to have 64-bit kernel goodness all the time you can do the following: Aug
05
2010
Where is php.ini under OSX 10.5 (Leopard)…I came across a issue and the solution required a bit of tweaking in php.ini. After looking around my Leopard Server I finally found php.ini.default under /etc directory. After making the changes and restarting apache, I got nothing, zip, zilch. Well after digging around the output of phpinfo Well, you learn something new everyday. I was always under the impression that you needed Apple Remote Desktop application to connect to a mac that was sharing it’s screen (or vncviewer app). Today I stumbled across another way of doing this without any of these apps……just using the build in “Screen Sharing” application. The easy way (and how I stumbled across this) was to open up Finder/Go/Connect to Server menu option (Apple-K) and type vnc://remote.server.dns.name.or.ip in the “server address” field. This is something that works nicely under Linux (gnome desktop) and I always wanted it in mac……well it was there all along….. And for the command-line junkies there is a even easier way. Open up terminal and type the following command to connect to the remote server: NICE Really cool video of Jim Reekes talking about his thought process in designing sounds for the mac, including the big fat C major chord which your mac plays every time you start it. Jim Reekes was a programmer at Apple Computer for 12 years. His work has significantly affected operating systems, most notably System 7 and QuickTime. He also is responsible for creating many of the system sounds for the Macintosh operating system. Some of the most famous creations during that time were the Mac startup sound and the system sound sosumi. Full 1 hour video can be seen on Youtube. Mar
05
2010
How to stream live HDV/DV to iphone…..In this guide I’ll show you how to stream live HDV/DV video to your iphone using a linux box (Ubuntu 9.10) with firewire input running vlc/ffmpeg and a Imac with OSX 10.6.2 running mediastreamsegmenter and apache2. Start out with the iPhone streaming media overview. Without understanding this document you’ll have a hard time getting things working. First things first, you need to have a working Ubuntu 9.10 machine. I’m using a small footprint 2.4Ghz Core2Duo machine with PCI firewire 400 card in it. For video input I’m using a Canon HV30 set to HDV mode (1080i/60) connected via firewire. Next you need to follow the instructions on this page (steps 0-5) to get a working ffmpeg with x264 and aac encoding. Without this working you’re not going anywhere….sorry. If you’re trying this on a different Ubuntu installation follow the other links to get a working ffmpeg setup. Then install vlc using “sudo apt-get install vlc“. I used vlc as my encoder frontend as I understand it better than ffmpeg. You can use just straight ffmpeg as well if you can figure out how to get it to encode the live HDV stream over firewire. You’ll also need dvgrab utility. Install it using “sudo apt-get install dvgrab“. Now we want to make sure the internal firewire module is working so type this command and see if you get a vlc window with the camera output in it (make sure you turn the camera ON and hook it up first). Next we need to create a media stream out of our linux box and ship it over UDP to the Imac. The vlc command below gets the job done. Remember you’re sudo’ing and need to provide the password after you enter the command. So now we can go over to the mac and see if we receive the video stream. For that just run VLC for OSX and open UDP network port on port 1234 (udp://). If things are working nicely you should see a 320×240 video from you HDV camera on the Imac. Now that we have the video on the mac, we need to use the “mediastreamsegmenter” command line tool to create HTML5 video stream out of it. mediastreamsegmenter listens on a UDP port for incoming transport stream chops it (by default) into 10 sec. “mini” transport stream files and writes these mini files to wherever you tell it. This location is important since it needs to be accessible to your webserver. Remember, at the end of the chain (day), the webserver is doing all the heavy lifting of delivering the mini transport stream files to your iphone. mediastreamsegmenter also produces a file of type .m3u8 Something you might not know is that apple ships standard OSX with apache builtin. All you have to do is use the following command to get it started. Now you should be able to open up your browser on your iphone/ipod touch and punch in http://192.168.1.97 (assuming the Imac is reachable from your phone) and see the streaming video (You might have to turn on “Plugins” feature under settings/safari on your device. Mine was turned off and drove me crazy until I figured it out). If Plugins is turned off, the index.html page will load, but no video. Hopefully there is enough meat here to get you guys started……btw. I hear the following command (or variations of) can be used on linux side (instead of vlc). I haven’t tried it and can’t confirm if it works. Some excellent information can be found on Carson McDonald’s blog: Feb
11
2010
iPhone Explorer turns your iPhone/iTouch into a USB stick…..One of the original reasons I bought my first ipod (first gen 5 Gig) was that I could hook it up to my mac and use it as a firewire drive. I could literally run around with this in my pocket and boot OSX off the ipod. Well that came to an end with the intro of iPhone/iTouch. Apple took the “disk mode” out. Well that was then, go grab a FREE copy of iPhone explorer and all that USB stick functionality can be your again. Oh, and did I say there is no need for Jail Break either Features:
Feb
05
2010
Movist…..will it be the next VLC for mac….The answer to that is maybe, we’ll see. But all that aside if you’re interested in a minimalistic video player that can handle more codecs than VLC and is generally faster then give Movist a try. The unique thing about the player is that it allows you to switch codec engines between ffmpeg and quicktime based on file extensions. Oh and did I say it’s FREE aswell
Jan
29
2010
._ resource fork files don’t work properly in OSX 10.6 Samba……Well the title is a bit misleading…..here are the details. I found out that if you have a NTFS native shared directory on your server, everything works fine as long as you’re using OSX 10.5 (Leopard) or below as a client. You can move files from Leopard and/or Tiger clients to the share and as long as you don’t mind the ._ files everything works. Well something new has been introduced in Snow Leopard that kinda breaks this. If you have a Snow Leopard client machine accessing a NTFS native shared directory (via smb), by default the shares are mounted with the new xattr (Extended Attribute) feature, instead of those “old” ._ files. This messes everything up if you’re in a mixed environment with 10.4, 10.5, and 10.6 clients all accessing files in a NTFS native smb share. Snow Leopards version of samba will read those old resource fork files, but files uploaded or modified by the Snow Leopard client will be unrecognizable by the older samba clients (10.5-) as far as the resource fork goes. This introduces some problems with programs that use the resource fork to store information. All this headache is related to the ‘NTFS Streams’ feature of SMB mounts, so if we disable that, everything goes back to normal. To do this you have to create a file named /etc/nsmb.conf on all your 10.6 clients with the following contents: Jan
29
2010
Hiding Files and Folders in OSX Finder…..If you ever have a need to simply hide extraneous files and/or folder entries in Finder you can use the following command: |