How do I install Ruby or Python for Windows servers and instances?

Table of Contents

Background

You are running a RightScale Windows Server or cloud instance and would like to install Ruby or Python into the system for general use.

Answer

Of course, you can always use the traditional method of manually downloading an installer via a web browser and manually installing it on a Windows server. However, a better way is to automate the installation process by using a Powershell script to accomplish the same task. You could either add one of the following Powershell RightScripts as a boot script on a Windows ServerTemplate or run it manually as an operational or any script.

Ruby Install Powershell script

# Set up the download URL for ruby
$download_url = "http://rubyforge.org/frs/download.php/72170/rubyinstaller-1.9.2-p0.exe"
# Extract the name of the EXE from the URL
$installer_dest = "$env:temp\"+$download_url.Split('/')[-1]
# Download file using the .NET WebClient object
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($download_url, $installer_dest)
# Execute the silent installer
Invoke-Expression "$installer_dest /silent"
# Remove the original installation file from the file system
Remove-Item $installer_dest -recurse