Introduction:
Ruby is commonly used for web development, particularly with Ruby on Rails, but its versatility makes it suitable for a wide range of applications, from automation scripts to system administration.
Step 1:Download Ruby Installer
- Go to the official Ruby website’s download page: Ruby Installer for Windows.
- On the download page, you’ll find a section for Ruby+Devkit which includes the Ruby interpreter along with the development kit. This is necessary for building certain gems and extensions.
- Choose the appropriate version of Ruby for your Windows Server (typically the x64 version unless your system is 32-bit). Download the .exe file (e.g., rubyinstaller-3.x.x-x-x64.exe).
Step 2:Run the Installer
- Once the installer is downloaded, run the .exe file.
- When the installation wizard appears, click Next.
- On the Choose Components screen, ensure that you select both:
1)Ruby (the Ruby programming language)
2)Development Kit (needed for compiling gems that require native extensions, like rails). - Install to a directory: It is recommended to install Ruby to a directory with no spaces in the path (e.g., C:\Ruby or C:\Ruby30).
- Click Next and then Install.
Step 3:Add Ruby to the System PATH
- During the installation process, make sure to check the option that says “Add Ruby to PATH”. This ensures that Ruby can be run from the command line.
- If you missed this step during installation, you can manually add Ruby to your system’s PATH:
1)Open Control Panel > System > Advanced system settings.
2)Click Environment Variables.
3)In the System variables section, find the Path variable and click Edit.
4)Add the Ruby installation directory to the Path (e.g., C:\Ruby\bin).
Step 4:Verify Ruby Installation
- Open Command Prompt or PowerShell.
- Type the following command to check if Ruby is installed correctly:
ruby -v - You should see something like:
ruby 3.x.x (202x-xx-xx) [x64-mingw32] - This confirms that Ruby is installed and working.
Conclusion:
At this point, Ruby should be successfully installed on your Windows Server, and you can begin using it for development. You can install gems, run Ruby scripts, or start using Rails if you’re building web applications.