Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FrenjaminBanklin/170161b7e6f94659e5534c08dc782f0f to your computer and use it in GitHub Desktop.
Save FrenjaminBanklin/170161b7e6f94659e5534c08dc782f0f to your computer and use it in GitHub Desktop.

Installing Materia on Windows Server 2012

  • Created October 2017

  • Last Updated May 2018

Relaxing Security (optional?)

In the Server Manager, go to the Dashboard tab. It should be the default tab.

Click 'Configure this local server'

Click 'On' next to 'IE Enhanced Security Configuration' and turn it off - at least for administrators.

Click 'Private: On' next to 'Windows Firewall'. Click 'Turn Windows Firewall on or off'. Disable the private firewall.

Open Internet Explorer. Don't use recommended security settings.

PROLOGUE 1: Text Editor, 7-Zip

Just about any Materia file in Notepad will be condensed to a single line because Windows does not recognize Unix line returns.

Download Notepad++ (https://notepad-plus-plus.org/) or whatever other free text editor you prefer, just for the sake of being able to modify config files.

You will also need to be able to decompress .tgz files in order to use Materia. 7-Zip (https://www.7-zip.org/) is recommended.

PROLOGUE 2: Git Bash, OpenSSL

Installing the Git for Windows tools will give us the option to use Git Bash (a much better terminal than Command Prompt) and OpenSSL, which will allow us to generate SSL certificates.

Go to 'https://git-for-windows.github.io/'. Click 'Download' and run the installer.

Use all the default options, just keep clicking 'Next' until it installs.

Click 'Finish' once it's done.

STEP ONE: MySQL

Go to 'http://dev.mysql.com/downloads/windows/installer'.

Click 'Looking for previous GA versions?'.

Select the most recent version of 5.7 (currently 5.7.22).

Download the larger of the two (currently mysql-installer-community-5.7.22.1.msi).

  • Use the 'No thanks' option to get it without signing up for anything.

Run the installer.

Choose 'Custom' as setup type.

In the list, choose the following items from the list on the left to install by clicking the green arrow pointing right:

MySQL Servers -> MySQL Server -> MySQL Server (currently 5.7) -> MySQL Server - X64

Applications -> MySQL Workbench ->MySQL Workbench (currently 6.3) -> MySQL Workbench - X64

Applications -> MySQL Utilities -> MySQL Utilities (currently 1.6) -> MySQL Utilities - X64

Click 'Next'

The MySQL Installer will indicate that there are uninstalled requirements, but it will take care of these for you once you click 'Execute'.

Once the components are installed, clicking 'Next' should begin configuration of the MySQL server.

Select 'Standalone MySQL Server / Classic MySQL Replication' and click 'Next'

Leave everything alone on the first page, and click 'Next'.

In the Accounts and Roles page, set the root user password as desired. Remember this password.

Click 'Add User' and create a 'materia' user with the desired password. Default role of "DB Admin" is fine. Remember this password, you'll need to supply it to the Materia installation script later.

After creating the user, click 'Next'.

Click 'Next' again.

Click 'Next' again.

Click 'Execute'.

Once everything is done running, click 'Finish'.

Click 'Next'.

Click 'Finish'.

Open up the MySQL Workbench application.

Ignore the warning from MySQL Workbench that we're playing with forces beyond our control.

Click the only MySQL instance available and use the 'root' user password set earlier.

Click the 'Create a new schema in the connected server' button - looks like a stack of pancakes with a plus sign, fourth from the left.

In the Name box, enter 'materia' and click 'Apply'. Click 'Apply' in the new window that comes up. Click 'Finish.'

Close the workbench.

STEP THREE: Apache

Go to 'http://www.apachehaus.com/cgi-bin/download.plx' and download the latest Apache 2.4 package including OpenSSL (Apache 2.4.33 x64 as of writing)

Extract the 'Apache24' folder to the root of the C:/ drive (Result: C:/Apache24).

In the command prompt (not PowerShell), navigate to C:/Apache24/bin and run httpd -k install.

(May also have to run httpd -k start).

Verify that Apache is working by visiting localhost in your internet browser.

Go to 'https://github.com/nmaier/mod_xsendfile', click 'Clone or Download' then 'Download ZIP'.

Extract the contents of the file, then go to the newly extracted 'mod_xsendfile-master' folder.

Copy 'mod_xsendfile-master/bin/Apache24/Win64/mod_xsendfile.so' into 'C:/Apache24/modules'.

Open 'C:/Apache24/conf/httpd.conf' and add the following line under the last instance of 'LoadModule':

LoadModule xsendfile_module modules/mod_xsendfile.so.

Under that, add the following line: Define APACHE_LOG_DIR "/Apache24/logs".

Locate the line reading #LoadModule rewrite_module modules/mod_rewrite.so and remove the '#' at the beginning of the line.

Save those changes.

In Command Prompt, navigate to C:/Apache24/bin and run httpd -k restart.

Go to Control Panel->System and Security->System, and click 'Advanced System Settings' then 'Environment Variables'.

Under 'System variables' find 'Path', then click 'Edit...'

Append ;C:\Apache24\bin to the end of the 'Variable value' field and click 'OK'.

STEP FOUR: PHP

Go to 'http://windows.php.net/download/' and download the VC14 x64 Thread Safe .zip file for PHP 7.0.

Extract the .zip file's contents to C:/php.

Navigate to C:/php. Rename php.ini-production to php.ini, then open it in your editor.

Find the line containing 'extension_dir' and modify it to read extension_dir = "C:\php\ext", note the lack of a semicolon at the front.

Find the line containing 'session.save_path' and modify it to read C:\Temp

Find the line containing ';extension=php_fileinfo.dll' and remove the semicolon at the beginning of the line.

Find the line containing ';extension=php_gd2.dll' and remove the semicolon at the beginning of the line.

Find the line containing ';extension=php_mbstring.dll' and remove the semicolon at the beginning of the line.

Find the line containing ';extension=php_openssl.dll' and remove the semicolon at the beginning of the line.

Find the line containing ';extension=php_pdo_mysql.dll' and remove the semicolon at the beginning of the line.

Go back to Control Panel->System and Security->System, and click 'Advanced System Settings' then 'Environment Variables'.

Under 'System variables' find 'Path', then click 'Edit...'

Append ;C:\php to the end of the 'Variable value' field and click 'OK'.

Open 'C:/Apache24/conf/httpd.conf' again. Find the last LoadModule and add the following directly under it:

LoadModule php7_module "c:/php/php7apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

Find the area containing <IfModule dir_module>.

Modify DirectoryIndex index.html to DirectoryIndex index.html index.php

Save the file.

In Command Prompt, go back to C:/Apache24/bin and run httpd -k restart.

In order to test PHP, create the following index.php file in C:/Apache24/htdocs.

<?php
phpinfo();
?>

Now visit 'http://localhost/index.php' to make sure PHP is running.

STEP FOUR: SSL Certificates

In Git Bash, move to C:/ with cd c:/.

Run the commands mkdir ssl\private and mkdir ssl\certs.

Run the command openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout C:/ssl/private/materia-selfsigned.key -out C:/ssl/certs/materia-selfsigned.crt. Provide the requested information at each prompt. This will generate the certificates necessary to use SSL.

STEP FIVE: Materia

Go to 'https://github.com/ucfcdl/Materia/releases' and download the .tgz package containing the latest Materia release.

Extract this package to 'C:/materia'.

Open 'C:/Apache24/conf/httpd.conf' again.

Find a line reading '# Virtual Hosts'. Under this line, add a line reading 'Include conf/extra/materia-vhosts.conf'.

Create then open the file 'C:/Apache24/conf/extra/materia-vhosts.conf'.

Follow the guide written at 'https://github.com/ucfcdl/Materia/wiki/Apache-Virtual-Host-Configuration', substituting 'materia.YOUR_DOMAIN.edu' for a domain as desired (or localhost), '/var/www/materia' with 'C:/Materia', and '/etc/ssl/' with 'C:/ssl'.

In Git Bash, move into the directory containing Materia with cd C:/materia.

Run php oil r install to start the Materia installation helper.

When prompted to choose an environment, type production.

When prompted to run the configuration wizard, type y.

We're using Apache, so type true at the next prompt.

If you'd like to be able to install widgets through the web administration panel, type 'true' at the next prompt.

Type file at the next prompt to choose a cache driver, then press Enter to accept the default file location (or specify one if you want).

Type file at the next prompt to choose a session driver, then press Enter to accept the default file location (or specify one if you want).

Press Enter to accept the default PDO connection setting.

For the next two options, make sure your Database user name and password match what you defined earlier in the MySQL step. If you'd like to use the generated password, make sure to make the appropriate changes through the MySQL Workbench.

Choose an LTI identifier in the next option. This should probably match the basic URL for your instance of Materia.

Unless you know better, use the default values for the LTI username variable.

If you want Materia to appear as a navigation option in the Canvas side bar, type 'true' at the next prompt. If not, 'false'.

Set shared secret and consumer keys in the next two steps - make sure your LTI installations match these later.

If you'd like to restrict logins for your instance of Materia to the LTI only (no users can log in through SAML or the normal Materia login interface), type 'true' at the next prompt. If you'd like to allow normal logins, type 'false'.

The next five options offer default values for various salts and encryption keys - you can use specific values if you desire, otherwise press 'Enter' to accept the defaults.

When prompted to make paths writable, type y.

When prompted to clear server cache, type y.

When prompted to run migrations, type y.

When prompted to populate user roles, type y.

When prompted to populate default semesters, type y. - NOTE: your semester codes might be different than those used at UCF, in which case you'll have to handle generating those yourself.

When prompted to create default users, type y. This will print out a set of default users and the generated passwords for those users - keep track of these.

EPILOGUE

You should now have a fully functional copy of Materia.

Additional documentation is available at 'http://ucfcdl.github.io/Materia/'.

UPGRADING

Updating the version of Materia running on your server is as simple as downloading the latest release package and replacing the Materia directory with the new package, with one important exception: the production configuration.

To prepare, in Git Bash, move into the C directory with cd C:/.

Copy the Materia production configuration to a temporary location with cp -rf materia/fuel/app/config/production production.

Back up the current version of Materia by moving it to a different location with mv materia materia-backup or any other desired location.

Go to 'https://github.com/ucfcdl/Materia/releases' and download the .tgz package containing the latest Materia release.

Extract this package to 'C:/materia'.

Move the old production configuration back into place with mv production materia/fuel/app/config/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment