Merge pull request #4064 from chillu/pulls/osx-install-docs

Improved install docs (Vagrant, Homebrew, MAMP)
This commit is contained in:
Sean Harvey 2015-04-20 10:14:16 +12:00
commit 78e01c07ac
5 changed files with 181 additions and 225 deletions

View File

@ -1,75 +1,49 @@
# Mac OSX # Mac OSX with MAMP
This topic covers setting up your Mac as a Web Server and installing SilverStripe. This topic covers setting up your Mac as a web server and installing SilverStripe.
While OSX Comes bundled with PHP and Apache (Thanks Apple!) Its not quite ideal for SilverStripe so for setting up a OSX comes bundled with PHP and Apache, but you're stuck with the versions it ships with.
webserver on OSX we suggest using [MAMP](http://www.mamp.info/en/index.php) or using [MacPorts](http://www.macports.org/) It is also a bit harder to install additional PHP modules required by SilverStripe.
to manage your packages. [MAMP](http://www.mamp.info/en/) is a simple way to get a complete webserver
environment going on your OSX machine, without removing or altering any system-level configuration.
If you want to use the default OSX PHP version then you will need to recompile your own versions of PHP with GD. Providing instructions Check out the [MAC OSX with Homebrew](other_installation_options/Mac_OSX_Homebrew)
for how to recompile PHP is beyond the scope of our documentation but try an online search. for an alternative, more configurable installation process.
## Installing MAMP ## Requirements
If you have decided to install using MacPorts you can skip this section. Please check the [system requirements](http://www.mamp.info/en/documentation/) for MAMP,
you'll need a fairly new version of OSX to run it.
Once you have downloaded and Installed MAMP start the Application and Make sure everything is running by clicking the ## MAMP Installation
MAMP icon. Under `Preferences -> PHP` make sure Version 5 is Selected.
Open up `/Applications/MAMP/conf/PHP5/php.ini` and make the following configuration changes: * [Download MAMP](http://www.mamp.info/en/)
* Install and start MAMP
* Check out your new web server environment on `http://localhost:8888`
memory_limit = 64M ## SilverStripe Installation
Once you make that change open the MAMP App Again by clicking on the MAMP Icon and click Stop Servers then Start [Composer](http://getcomposer.org) is a dependancy manager for PHP, and the preferred way to
Servers - this is so our changes to the php.ini take effect. install SilverStripe. It ensures that you get the correct set of files for your project.
Composer uses your MAMP PHP executable to run and also requires [git](http://git-scm.com)
to automatically download the required files from GitHub and other repositories.
## Installing SilverStripe In order to install Composer, we need to let the system know where to find the PHP executable.
Open or create the `~/.bash_profile` file in your home folder, then add the following line:
`export PATH=/Applications/MAMP/bin/php/php5.5.22/bin:$PATH`
You'll need to adjust the PHP version number (`php5.5.22`). The currently running PHP version is shown on `http://localhost:8888/MAMP/index.php?page=phpinfo`.
Run `source ~/.bash_profile` for the changes to take effect. You can verify that the correct executable
is used by running `which php`. It should show the path to MAMP from above.
### Composer Now you're ready to install Composer: Run `curl -sS https://getcomposer.org/installer | php`.
[Composer (a dependancy manager for PHP)](http://getcomposer.org) is the preferred way to install SilverStripe and ensure you get the correct set of files for your project. We recommend that you make the `composer` executable available globally,
which requires moving the file to a different folder. Run `mv composer.phar /usr/local/bin/composer`.
More detailed installation instructions are available on [getcomposer.org](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
You can verify the installation by typing the `composer` command, which should show you a command overview.
Composer uses your MAMP PHP executable to run and also requires [git](http://git-scm.com) (so it can automatically download the required files from GitHub). Finally, we're ready to install SilverStripe through composer:
`composer create-project silverstripe/installer /Applications/MAMP/htdocs/silverstripe/`.
After finishing, the installation wizard should be available at `http://localhost:8888/silverstripe`.
The MAMP default database credentials are user `root` and password `root`.
#### Install composer using MAMP We have a separate in-depth tutorial for [Composer Installation and Usage](composer).
1. First create an alias for our bash profile, using your preferred terminal text editor (nano, vim, etc) open `~/.bash_profile`.
2. Add the following line (adjusting the version number of PHP to your installation of MAMP): `alias phpmamp='/Applications/MAMP/bin/php/php5.4.10/bin/php'`.
3. The run `. ~/.bash_profile` to reload the bash profile and make it accessible.
4. This will create an alias, `phpmamp`, allowing you to use the MAMP installation of PHP. Please take note of the PHP version, in this case 5.4.10, as with different versions of MAMP this may be different. Check your installation and see what version you have, and replace the number accordingly (this was written with MAMP version 2.1.2).
5. With that setup, we are ready to install `composer`. This is a two step process if we would like this to be installed globally (only do the first step if you would like `composer` installed to the local working directory only).
- First, run the following command in the terminal: `curl -sS https://getcomposer.org/installer | phpmamp`
We are using `phpmamp` so that we correctly use the MAMP installation of PHP from above.
- Second, if you want to make composer available globally, we need to move the file to '/usr/local/bin/composer'. To do this, run the following command:
`sudo mv composer.phar /usr/local/bin/composer`
Terminal will ask you for your root password, after entering it and pressing the 'return' (or enter) key, you'll have a working global installation of composer on your mac that uses MAMP.
6. You can verify your installation worked by typing the following command:
`composer`
It'll show you the current version and a list of commands you can use.
7. Run the following command to get a fresh copy of SilverStripe via composer:
`composer create-project silverstripe/installer /Applications/MAMP/htdocs/silverstripe/`
8. You can now [use composer](http://doc.silverstripe.org/framework/en/getting_started/composer/) to manage future SilverStripe updates and adding modules with a few easy commands.
### Package Download
[Download](http://silverstripe.org/software/download/) the latest SilverStripe installer package. Copy the tar.gz or zip file to the 'Document Root' for MAMP - By Default its `/Applications/MAMP/htdocs`.
Don't know what your Document Root is? Open MAMP Click `Preferences -> Apache`.
Extract the tar.gz file to a folder, e.g. `silverstripe/` (you always move the tar.gz file first and not the other way
around as SilverStripe uses a '.htaccess' file which is hidden from OSX so if you move SilverStripe the .htaccess file
won't come along.
### Run the installation wizard
Once you have a copy of the required code (by either of the above methods), open your web browser and go to `http://localhost:8888/silverstripe/`. Enter your database details - by default with MAMP its user `root` and password `root` and select your account details. Click "Check Details".
Once everything is sorted hit "Install!" and Voila, you have SilverStripe installed

View File

@ -0,0 +1,118 @@
# Mac OSX with Homebrew
This topic covers setting up your Mac as a web server and installing SilverStripe.
OSX comes bundled with PHP, but you're stuck with the version and modules it ships with.
If you run projects on different PHP versions, or care about additional PHP module support
and other dependencies such as MariaDB, we recommend an installation through [Homebrew](http://brew.sh/).
Check out the [MAC OSX with MAMP](../Mac_OSX) for an alternative installation process
which packages up the whole environment into a convenient application.
## Requirements
Since we're compiling PHP, some build tooling is required.
Run the following command to install Xcode Command Line Tools.
xcode-select --install
Now you can install Homebrew itself:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
## Install PHP
First we're telling Homebrew about some new repositories to get the PHP installation from:
brew tap homebrew/dupes
brew tap homebrew/php
We're installing PHP 5.5 here, with the required `mcrypt` module:
brew install php55 php55-mcrypt
There's a [Homebrew Troubleshooting](https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Troubleshooting.md) guide if Homebrew doesn't work out as expected (run `brew update` and `brew doctor`).
Have a look at the [brew-php-switcher](https://github.com/philcook/brew-php-switcher)
project to install multiple PHP versions in parallel and switch between them easily.
## Install the Database (MariaDB/MySQL)
brew install mariadb
unset TMPDIR
mysql_install_db --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start
'/usr/local/opt/mariadb/bin/mysql_secure_installation'
To start the database server on boot, run the following:
ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents
You can also use `mysql.server start` and `mysql.server stop` on demand.
## Configure PHP and Apache
We're not installing Apache, since OSX already ships with a perfectly fine installation of it.
Edit the existing configuration at `/etc/apache2/httpd.conf`,
and uncomment/add the following lines to activate the required modules:
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
Change the `DocumentRoot` setting to your user folder (replacing `<user>` with your OSX user name):
DocumentRoot "/Users/<user>/Sites"
Now find the section starting with `<Directory "/Library/WebServer/Documents">` and change it as follows,
again replacing `<user>` with your OSX user name:
<Directory "/Users/<user>/Sites">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
We also recommend running the web server process with your own user on a development environment,
since it makes permissions easier to handle when running commands both
from the command line and through the web server. Find and adjust the following options,
replacing the `<user>` placeholder:
User <user>
Group staff
Now start the web server:
sudo apachectl start
Every configuration change requires a restart:
sudo apachectl restart
You can also load this webserver on boot:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
After starting the webserver, you should see a simple "Forbidden" page generated by Apache
when accessing `http://localhost`.
## SilverStripe Installation
[Composer](http://getcomposer.org) is a dependancy manager for PHP, and the preferred way to
install SilverStripe. It ensures that you get the correct set of files for your project.
Composer uses the PHP executable we've just installed. It also needs [git](http://git-scm.com)
to automatically download the required files from GitHub and other repositories.
Run `curl -sS https://getcomposer.org/installer | php` to install the `composer` executable.
We recommend that you make the executable available globally,
which requires moving the file to a different folder. Run `mv composer.phar /usr/local/bin/composer`.
More detailed installation instructions are available on [getcomposer.org](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
You can verify the installation by typing the `composer` command, which should show you a command overview.
Finally, we're ready to install SilverStripe through composer:
`composer create-project silverstripe/installer /Users/<user>/Sites/silverstripe/`.
After finishing, the installation wizard should be available at `http://localhost/silverstripe`.
The Homebrew MariaDB default database credentials are user `root` and password `root`.
We have a separate in-depth tutorial for [Composer Installation and Usage](composer).

View File

@ -1,152 +0,0 @@
# Install SilverStripe manually on Windows using IIS 6
<div class="warning" markdown="1">Note: These instructions may not work, as they're no longer maintained.</div>
How to prepare Windows Server 2003 for SilverStripe using IIS 6 and FastCGI.
This guide will work for the following operating systems:
* Windows Server 2003
* Windows Server 2003 R2
Database install and configuration is not covered here, it is assumed you will do this yourself.
PHP comes with MySQL support out of the box, but you will need to install the [SQL Server Driver for PHP](http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05)
from Microsoft if you want to use SQL Server.
## Preparation
Open **Windows Update** and make sure everything is updated, including optional updates. It is important that all .NET Framework updates including service packs are installed.
## Install IIS
- Open **Control Panel** > **Add/Remove Programs**
- Click **Add/Remove Windows Components** on the left hand bar
- Check **Application Server** and then click **Next** to install it
## Install FastCGI for IIS
- Download and install this package: http://www.iis.net/download/fastcgi
- Open **inetmgr.exe**
- Right click **Web Sites** and go to **Properties**
- Click the **Home Directory** tab
- Click **Configuration...** then **Add**
- In the **Add/Edit Extension Mapping** dialog, click **Browse...** and navigate to fcgiext.dll which is located in %windir%\system32\inetsrv
- In the **Extension** text box, enter **.php**
- Under **Verbs** in the **Limit to** text box, enter **GET,HEAD,POST**
- Ensure that the **Script engine** and **Verify that file exists** boxes are checked then click **OK**
- Open fcgiext.ini located in %windir%\system32\inetsrv. In the [Types] section of the file, add **php=PHP**
- Create a new section called **[PHP]** at the bottom of the file, like this:
[PHP]
ExePath=c:\php5\php-cgi.exe
Finally, run these commands in **Command Prompt**
cd %windir%\system32\inetsrv
cscript fcgiconfig.js -set -section:"PHP" -InstanceMaxRequests:10000
cscript fcgiconfig.js -set -section:"PHP" -EnvironmentVars:PHP_FCGI_MAX_REQUESTS:10000
cscript fcgiconfig.js -set -section:"PHP" -ActivityTimeout:300
## Install PHP
- [Download PHP](http://windows.php.net/download) (**Zip** link underneath the **VC9 x86 Non Thread Safe** section)
- [Download WinCache](http://www.iis.net/download/WinCacheForPHP) (**WinCache 1.1 for PHP 5.3**)
- Extract the PHP zip contents to **c:\php5**
- Run the WinCache self-extractor and extract to **c:\php5\ext**. A file called **php_wincache.dll** should now reside in **c:\php5\ext**
- Rename **php.ini-development** to **php.ini** in **c:\php5**
- Open **php.ini**, located in **c:\php5** with **Notepad** or another editor like **Notepad++**
- Search for **date.timezone**, uncomment it by removing the semicolon and set a timezone from here: http://php.net/manual/en/timezones.php
- Search for **fastcgi.impersonate**, uncomment it by removing the semicolon and set it like this: **fastcgi.impersonate = 1**
- Search for **cgi.fix_pathinfo**, uncomment it by removing the semicolon and set it like this: **cgi.fix_pathinfo = 1**
- Search for **cgi.force_redirect**, uncomment it by removing the semicolon and set it like this: **cgi.force_redirect = 0**
- Search for **fastcgi.logging**, uncomment it by removing the semicolon and set it like this: **fastcgi.logging = 0**
- Search for **extension_dir** and make sure it looks like this: **extension_dir = "ext"** (use proper double quotation characters here)
- Find the "Dynamic Extensions" part of the file, and replace all extension entries with the following:
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_enchant.dll
;extension=php_exif.dll
;extension=php_fileinfo.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_imap.dll
;extension=php_intl.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_oci8_11g.dll
;extension=php_openssl.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite3.dll
;extension=php_sqlite.dll
extension=php_tidy.dll
extension=php_wincache.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
This is a minimal set of loaded extensions which will get you started.
If want to use **SQL Server** as a database, you will need to install the [SQL Server Driver for PHP](http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05) and add an extension entry for it to the list above.
## Test PHP
- Open **Command Prompt** and type the following:
c:\php5\php.exe -v
You should see some output showing the PHP version. If you get something else, or nothing at all, then there are missing updates for your copy of Windows Server 2003. Open **Windows Update** and make sure you've updated everything including optional updates.
## Install SilverStripe
- [Download SilverStripe](http://silverstripe.org/downloads)
- Extract the download contents to **C:\Inetpub\wwwroot\silverstripe**
- Open **inetmgr.exe**
- Right click **Web Sites** and go to **New** > **Web Site**
- Fill in all appropriate details. If you enter **(All Unassigned)** for the IP address field, make sure the port is something other than **80**, as this will conflict with "Default Web Site" in IIS. When asked for path, enter **C:\Inetpub\wwwroot\silverstripe**
- Browse to **http://localhost:8888** or to the IP address you just assigned in your browser.
An installation screen should appear. There may be some permission problems, which you should be able to correct by assigning the **Users** group write permissions by right clicking files / folders in Windows Explorer and going to **Properties** then the **Security** tab.
When ready, hit **Install SilverStripe**.
SilverStripe should now be installed and you should have a basic site with three pages.
However, URLs will not look "nice", like this: http://localhost/index.php/about-us. In order to fix this problem, we need to install a third-party URL rewriting tool, as IIS 6 does not support this natively.
Proceed to **Install IIRF** below to enable nice URLs.
## Install IIRF
At the moment, all URLs will have index.php in them. This is because IIS does not support URL rewriting. To make this work, we need to install IIRF which is a third-party plugin for IIS.
- [Download IIRF](http://iirf.codeplex.com/releases/view/36814) and install it
- Create a new file called iirf.ini in C:\inetpub\wwwroot\silverstripe with this content
RewriteEngine On
MaxMatchCount 10
IterationLimit 5
# URLs with query strings
# Don't catch successful file references
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\?(.+)$ /framework/main.php?url=$1&$2
# URLs without query strings
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /framework/main.php?url=$1
Friendly URLs should now be working when you browse to your site.
Remember that IIRF works on a per-virtual host basis. This means for each site you want IIRF to work for, you need to add a new entry to **Web Sites** in **inetmgr.exe**.
Thanks to **kcd** for the rules: [http://www.silverstripe.org/installing-silverstripe/show/10488#post294415](http://www.silverstripe.org/installing-silverstripe/show/10488#post294415)

View File

@ -1,19 +1,16 @@
# Installation # Installation
These instructions show you how to install SilverStripe on any web server. These instructions show you how to install SilverStripe on any web server.
The best way to install from the source code is to use [Composer](../composer).
Check out our operating system specific guides for [Linux](linux_unix), Check out our operating system specific guides for [Linux](linux_unix),
[Windows Server](windows) and [Mac OSX](mac_osx). [Windows Server](windows) and [Mac OSX](mac_osx).
## Installation Steps ## Installation Steps
* [Download](http://silverstripe.org/download) the installer package * Make sure the webserver has MySQL and PHP support (check our [server requirements](../server_requirements)).
* Make sure the webserver has MySQL and PHP support. See [Server Requirements](../server_requirements) for more information. * Either [download the installer package](http://silverstripe.org/download), or [install through Composer](../composer).
* Unpack the installer somewhere into your web-root. Usually the www folder or similar. Most downloads from SilverStripe * If using with the installer download, extract it into your webroot.
are compressed tarballs. To extract these files you can either do them natively (Unix) or with 7-Zip (Windows) * Visit your domain or IP address in your web browser.
* Visit your sites domain or IP address in your web browser. * You will be presented with an installation wizard asking for database and login credentials.
* You will be presented with a form where you enter your MySQL login details and are asked to give your site a 'project
name' and the default login details. Follow the questions and select the *install* button at the bottom of the page.
* After a couple of minutes, your site will be set up. Visit your site and enjoy! * After a couple of minutes, your site will be set up. Visit your site and enjoy!
## Issues? ## Issues?

View File

@ -37,8 +37,27 @@ For more flexibility, you can set up either of the following web servers, and us
Mac OS X comes with a built-in webserver, but there are a number of other options: Mac OS X comes with a built-in webserver, but there are a number of other options:
* [Install using MAMP](installation/mac_osx) * [Install using MAMP](installation/mac_osx)
* Install using the built-in webserver (no docs yet) * [Install using Homebrew](installation/other_installation_options/mac_osx_homebrew)
* Install using MacPorts (no docs yet)
### Virtual Machines through Vagrant
[Vagrant](https://www.vagrantup.com/) creates portable development environments
which can be hosted on Linux, Windows and Mac OS X. The virtual machine
usually runs a flavour of Linux. As a self-contained pre-configured environment,
getting up an running with Vagrant tends to be easier than creating a complete
development environment from scratch on your own machine.
* [silverstripe-australia/vagrant-environment](https://github.com/silverstripe-australia/vagrant-environment)
* [BetterBrief/vagrant-skeleton](https://github.com/BetterBrief/vagrant-skeleton)
Note: These instructions are supported by the community.
## Virtual Machines through Bitnami
[Bitnami](https://bitnami.com) is an online service that makes it easy to get
apps running on cloud providers like Amazon Web Services as well as local
virtualised environments. Bitnami has a [SilverStripe Virtual Machine](https://bitnami.com/stack/silverstripe/virtual-machine)
ready for download or installation on a cloud platform.
## Troubleshooting ## Troubleshooting