Skip to content

Instantly share code, notes, and snippets.

@anotherspot
Last active January 1, 2016 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anotherspot/8064736 to your computer and use it in GitHub Desktop.
Save anotherspot/8064736 to your computer and use it in GitHub Desktop.
Munkiserver installation on OS X 10.9 Mavericks with Server 3.1
Based on https://gist.github.com/wbs75/6562498#file-munkiserver-mtnlion-setup-md
#### Pre-requisites:
OS X 10.9.1 | Server 3.0.1 | Xcode 5.0.2
#### Xcode Commandline Tools:
01) Install Xcode CommandLineTool if Xcode full is not installed
$ sudo xcode-select --install
02) Check to see if Xcode is providing correct path to tools
$ sudo xcode-select --print-path
03) If path is not /Applications/Xcode.app/Contents/Developer
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
#### Homebrew Setup:
01) Install HomeBrew:
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
02) Install Brew Packages:
You can place ">/dev/null" at the end of each command to minimise output
$ brew install bash-completion
$ brew install git
$ brew tap homebrew/dupes
$ brew install pkg-config
$ brew install xar
$ brew install autoconf
$ brew install automake
$ brew install apple-gcc42
$ brew install imagemagick
$ brew install libyaml
$ brew install readline
$ brew install libksba
$ brew install openssl
03) Add Homebrew & Bash Completion to your shell $PATH:
$ echo -e '\nexport PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"' >> ~/.bash_profile
$ echo -e '\nsource `brew --prefix`/Library/Contributions/brew_bash_completion.sh' >> ~/.bash_profile
$ source ~/.bash_profile
04) Cleanup & Test:
$ brew cleanup
$ brew doctor
#### Munki Setup:
01) Install latest Munkitools (0.9.2.1.863)
#### Munkiserver Setup:
01) Install RVM:
$ \curl -L https://get.rvm.io | bash -s stable
$ source ~/.rvm/scripts/rvm
$ type rvm | head -n 1
02) Install Ruby:
$ rvm install 1.9.3-p484
$ rvm use 1.9.3-p484 --default
$ source ~/.bash_profile
$ source ~/.rvm/scripts/rvm
03) Install Bundler:
$ gem install bundler
04) get munkiserver:
$ cd /usr/local
$ git clone https://github.com/jnraine/munkiserver.git
05) Tweak munkiserver:
$ sudo nano /usr/local/munkiserver/config/environments/production.rb
# change Following (line 39ish) and save:
' config.serve_static_assets = true '
$ sudo nano /usr/local/munkiserver/.rvmrc
' rvm --create ruby-1.9.3-p484@munkiserver '
06) Install munkiserver gems
$ cd /usr/local/munkiserver
$ bundle install
#### Setup Passenger:
01) Install Passenger:
$ gem install passenger
$ passenger-install-apache2-module
$ cd
02) Copy save it for web config. It should look some like this:
LoadModule passenger_module /Users/sysadmin/.rvm/gems/ruby-1.9.3-p484@munkiserver/gems/passenger-4.0.29/buildout/apache2/mod_passenger.so
PassengerRoot /Users/sysadmin/.rvm/gems/ruby-1.9.3-p484@munkiserver/gems/passenger-4.0.29
PassengerDefaultRuby /Users/sysadmin/.rvm/wrappers/ruby-1.9.3-p484@munkiserver/ruby
#### Install Xsendfile
01) Download [mod_xsendfile](https://tn123.org/mod_xsendfile/mod_xsendfile.c#hash(sha256:8e8c21ef39bbe86464d3831fd30cc4c51633f6e2e002204509e55fc7c8df9cf9)
02) Compile and install
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
$ cd /path/to/Download
$ sudo apxs -cia mod_xsendfile.c
#### Edit httpd.conf
01) Create Alias if you want use sub-directory.
$ cd
$ sudo ln -s /usr/local/munkiserver/ /Library/Server/Web/Data/Sites/MunkiServer
02) Open Server.app and create new site and name it "server.munkiserver.com". For sub-directory name it "munkiserver"
03) Open up you favorite text editor and edit .conf found at
' /Library/Server/Web/Config/apache2/sites/0000_any_80_munkiserver.conf '
04) Make adjustments .conf to match your enviorment
<VirtualHost *:80>
ServerAdmin sysadmin@chevalier.nsw.edu.au
DocumentRoot "/usr/local/munkiserver/public"
DirectoryIndex index.html index.php /xcode/ /wiki/ default.html
CustomLog "/var/log/apache2/access_log" combinedvhost
ErrorLog "/var/log/apache2/error_log"
<IfModule mod_ssl.c>
SSLEngine Off
SSLCipherSuite "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"
SSLProtocol -ALL +SSLv3 +TLSv1
SSLProxyEngine On
SSLProxyProtocol -ALL +SSLv3 +TLSv1
</IfModule>
<Directory "/usr/local/munkiserver/public">
Options -Indexes -ExecCGI -Includes -MultiViews
AllowOverride None
<IfModule mod_dav.c>
DAV Off
</IfModule>
<IfDefine !WEBSERVICE_ON>
Deny from all
ErrorDocument 403 /customerror/websitesoff403.html
</IfDefine>
</Directory>
</VirtualHost>
LoadModule xsendfile_module /usr/libexec/apache2/mod_xsendfile.so
RequestHeader Set X-Sendfile-Type X-Sendfile
XSendFile on
XSendFilePath /usr/local/munkiserver/packages
LoadModule passenger_module /Users/sysadmin/.rvm/gems/ruby-1.9.3-p484@munkiserver/gems/passenger-4.0.29/buildout/apache2/mod_passenger.so
PassengerRoot /Users/sysadmin/.rvm/gems/ruby-1.9.3-p484@munkiserver/gems/passenger-4.0.29
PassengerDefaultRuby /Users/sysadmin/.rvm/wrappers/ruby-1.9.3-p484@munkiserver/ruby
05) save it
#### Start munkiserver!!!!:
01) Turn on Websites from OS X Server
02) Create database & compile munkiserver
$ cd /usr/local/munkiserver
$ cp config/database.yml.example config/database.yml
$ rake db:migrate RAILS_ENV=production
$ rake bootstrap:all RAILS_ENV=production
# Enter Network Host Name with port (Example: server.munkiserver.com)
$ rake assets:precompile
$ passenger start
03 Restart apache
$ sudo apachectl graceful
04) Test
Open browser to Host Network Name:
Example: <http://server.Network-Host-Name.com:80>
#### MySQL Setup (Not done here) :
01) Download [MySQL Community Server](http://dev.mysql.com/downloads/mysql/)
02) Install all 3: mysql5.6.xxx.pkg, MySQLstartupitem.pkg & MySQLPrefPane
03) Start MySQL Server:
$ sudo /usr/local/mysql/support-files/mysql.server start
04) Add mysql directory to your shell $PATH:
$ echo -e '\nexport PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile
$ source ~/.bash_profile
$ source ~/.rvm/scripts/rvm
05) Set the MySQL root password:
$ /usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'
061) Fix the 2002 socket error first -
$ sudo mkdir /var/mysql
$ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
07) Restart apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment