Skip to content

Vagrant configuration of Windows VM for hassle-free fun with SQL Server 2017

Notifications You must be signed in to change notification settings

mloskot/vagrant-sqlserver-windows

Repository files navigation

Vagrant SQL Server 2017 RC2 on Microsoft Hyper-V Server 2012 R2

Vagrant configuration to provide users with virtual environment for hassle-free fun with SQL Server 2017.

Looking for SQL Server 2017 on Linux VM? Check https://github.com/mloskot/vagrant-sqlserver

Features

  • Hyper-V Server 2012 R2
  • SQL Server 2017
  • Pre-configured with
    • Vagrant default user: vagrant with password vagrant
    • Port forwarding from host 3433 to guest 1433 (default).
    • Default instance name MSSQLSERVER.
    • Database user sa with password Password123.
    • Database master.
    • Guest local account vagrant is member of sysadmin role; authenticated from inside the VM, without password.

Requirements

  • VirtualBox installed.
  • Vagrant installed.
  • Run vagrant plugin install vagrant-reload in command prompt (used to reboot after Hyper-V Server updates)
  • Downloaded SQLServer2017RC2-x64-ENU.iso (1.5GB, see below)

Installation

Download SQL Server 2017 ISO

  1. Download SQL Server 2017 installer for Windows.
  2. Run the installer and choose to download SQL Server 2017 full ISO.
  3. Copy the ISO next to this Vagrantfile.

Provision

NOTE: Provision runs several steps: installs KB2919355 update required by SQL Server, reboots, installs SQL Server. That is why the vagrant-reload is required.

  1. git clone this repository or download ZIP.
  2. cd vagrant-sqlserver-windows
  3. Copy the downloaded SQLServer2017RC2-x64-ENU.iso into the cloned repository (next to Vagrantfile).
  4. Follow the Usage section.

Usage

Vagrant VM

  • vagrant up to create and boot the guest virtual machine. First time run, this may take quite a while as the base box image is downloaded and provisioned, packages installed.

  • vagrant ssh to get direct access to the guest shell via SSH. You'll be connected as the vagrant user. You can get root access with sudo command.

  • vagrant halt to shutdown the guest machine.

  • vagrant destroy to wipe out the guest machine completely. You can re-create it and start over with vagrant up.

SQL Server

Using SSMS as SA or using sqlcmd client:

  • Connect to SQL Server instance from inside the guest VM
vagrant ssh
sqlcmd -Q "SELECT @@version;"     # as vagrant user, no password
sqlcmd -S localhost,3433 -U sa -P Password123 -Q "SELECT name FROM sys.databases;"
  • Connect to SQL Server instance from host
sqlcmd -S localhost,2433 -U SA -P Password123 -Q "SELECT name FROM sys.databases;"

Credits

About

Vagrant configuration of Windows VM for hassle-free fun with SQL Server 2017

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published