Creating an OS X El Capitan installer USB stick

Mac OS X 10.11.x El Capitan can be clean installed on a supported Mac using a USB stick

1) Find a USB stick, I used an 8GB one, run diskutil and note its volume name for the USB El_Capitan 

$ diskutil list
-
/dev/diskx (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *8.0 GB     disk9
   1:                        EFI EFI                     209.7 MB   disk9s1
   2:                  Apple_HFS El_Capitan              7.7 GB     disk9s...

 

2) Download El Capitan on a Mac with the Apple App Store (in your 'purchased' list)

3) Run the createinstaller command buried inside the package you downloaded as sudo with the volume name you identified. Make sure its correct as this will delete the contents of the drive!

$ sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/El_Capitan --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app
Password:
Ready to start.
To continue we need to erase the disk at /Volumes/El_Capitan.
If you wish to continue type (Y) then press return: Y
Erasing Disk: 0%... 10%... 20%... 30%...100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.

4) Boot the USB in the destination mac by holding down the Option (alt) key and selecting it

5) (Optional) Run Disk Utility from the Utilities menu and repartition the fixed disk before running the installer to get a completely vanilla OS X El Capitan installation

Note: Some steps require patience, best to have the power adapter connected. Just leave it running.

 

OS X Server 'service data' fills up drives

It is always desirable to swimming downsteam with Apple by trying to maintain the simplicity of OS X Server management and the manageability using the Server.app 

You can move the service data in the Server.app by navigating to Server, Settings, Service Data. But what gets moved is not all that clear.

Service Data technotes

There are few mentions of service data location on Apple's support system.

OS X Server: Upgrade and migration from Mavericks or Mountain Lion

OS X Server: "Custom" service data location after migration or upgrade

Lion Server: Store service data on a different disk

Mavericks Server Admin: Mail service architecture

Server.app Service Data Location 

My experimentation tells me that only certain data is updated so I advise extreme caution.

Read more: OS X Server 'service data' fills up drives

Adding PHP with mcrypt to OS X Server 5.0.15

I would always recommend swimming downsteam with Apple by trying to maintain the simplicity of OS X Server management. Theres a lot of good that comes from a Unix server you can buy and maintain from a high street shop.

Mcrypt for OS X Server PHP in El Capitan 10.11.2 and OS X Server 5.0.15

You can enable the default version of PHP in the Server app by selecting Wep Applications 'Enable PHP'. the trouble is, this optional php provided by apple is without mcrypt. The trick is to enable your own version of PHP with mcrypt without breaking OS X Server apps functionality.

 

OS X Server - Websites settings

If you enable this PHP and edit the info.php in the default directory to be able to see the configuration you will be able to see that PHP is running. Only trouble is, there is no mcrypt.

You can easily put a newer or different version of PHP onto your system without messing up the OS X Server app and its settings using the OS X package manager called Homebrew. To do it requires a little methodical work but its really pretty easy and doesnt require special skills apart from those you need to have to have a server anyway.

Homebrew PHP

To install Homebrew PHP you need Xcode and its command line tools.

$ xcode-select —install

Once completed you can Install Brew by following the instructions at http://brew.sh/ and then completing the installaiton from the command line.

$ brew doctor
$ brew update
$ brew tap homebrew/dupes
$ brew tap homebrew/versions

Now you can install a more appropriate version of PHP.

$ brew tap homebrew/homebrew-php
$ brew install php55-mcrypt

php.ini is now in a different place. Make any required changes here.

/usr/local/etc/php/5.5/php.ini

Telling OS X Server Apache to load a different PHP

Apple place the Apache config for OS X Server in /Library/Server/Web/Config/apache2 which is a different folder to the standard location in Mac OS X, and is also different to previous versions of Mac OS X Server. Apple also changed the webroot location in OS X Server. These changes happens once you install and run OS X Server.

$ cd /Library/Server/Web/Config/apache2

Load 'your' PHP via an optional conf directive

Apples own PHP is loaded by Server.app. If you need a different one make sure it is unchecked in Server.app like in the screenshot above and load it in a new conf file where it will be picked up by the optional conf directive. Once again, leave the LoadModule php5_module in this file alone - check its commented out as below. Dont try to add your custom php5_module path in this file as each time you save a change in Apples OS X Server app your modification will be lost.

$ vi httpd_server_app.conf
#LoadModule php5_module libexec/apache2/libphp5.so

Fortunately Apple include an 'IncludeOptional' directory where you can safely put any file ending in .conf

# Certain generated config files, such as migrated forward proxy configs from SnowLeopard 
IncludeOptional /Library/Server/Web/Config/apache2/other/*.conf 

Add a new file in the IncludeOptional directory - I called it php55-mcrypt.conf.

$ cd /Library/Server/Web/Config/apache2/other/
$ sudo vi php55-mcrypt.conf
#Below line loads our Homebrew installed php 5.5, if directive sets handlers for .php and .hmtl LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
<IfModule php5_module>
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps

        <IfModule dir_module>
                DirectoryIndex index.html index.php
        </IfModule>
</IfModule> 

Remember. The active Apache2 configuration is in a different directory once you install OS X Server. this file is not the one in /etc/apache2/other it is now in /Library/Server/Web/Config/apache2/other/

Test your configuration

Verify installation

Enable an info.php file and compare from the command line (are they the same version of php - really definitely the same?

$ php -v 
PHP 5.5.31 (cli) (built: Jan  10 2016) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

php info page image

Check mcrypt

Again check from the command line and in the browser using info.php. You should see it is enabled and see its own section in info.php

$ php -i |grep mcrypt
Additional .ini files parsed => /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled

mcrypt ini file setting

mcrypt enabled in php info

Reboot your mac and terst again to ensure your changes survive a restart. If not are you absolutely sure you are making edits to the right conf files - there may be several Apache installs on your filesystem. Check and retry.

 

 

 

 

 

Installing ClamAV on Ubuntu 14.04 Server

Command line install

$ sudo apt-get install clamav clamav-daemon
$ sudo freshclam

Command line run scan

$ clamscan -r /

Installing Android x86 via USB on an Intel Bay Trail based device

NB Mac OS X commands so these commands wont work on linux/windows.

insert the USB stick, then find the USB disk device (in my case /dev/disk7 - yours WILL be different) Make sure it is not mounted then copy the img file to it. Once correctly copied the USB boots on your device. If you get errors you copied the wrong file (the iso not the img) or you didnt write the copy correctly.

$ diskutil list
/dev/disk7
$ diskutil unmountDisk /dev/disk7
sudo dd if=/pathtofoldder/android_x86-6.0.1_r3-20151225.img of=/dev/rdisk7 bs=1m
diskutil eject /dev/disk7
 
Then I booted the USB by hitting Escape during the boot sequence of the device and choosing the USB
Then I followed the install instructions on the project webpage but I created two new partitions - one for EFI and one for Andoid, and formatted Android as EXT4 as I dont need any other OS on this device.

Much is working well including most of my apps restored via setup. Congratulations all for this great work.

Remove .DS_Store files from Mac OS X

Enter the following UNIX command:

$sudo find /thedirectoryyouwanttostartfrom -name ".DS_Store" -depth -exec rm {} \; 

Or add it to the task scheduler 'cron'

$sudo crontab -e 

This opens vi, press the letter I once to enter Insert mode and enter the following

30 3 * * * root find /thedirectoryyouwanttostartfrom -name ".DS_Store" -depth -exec rm {} \; 

Save by hitting Esc and then !wq (write, quit and 'I mean it')