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
- Hyper-V Server 2012 R2
- SQL Server 2017
- Pre-configured with
- Vagrant default user:
vagrantwith passwordvagrant - Port forwarding from host
3433to guest1433(default). - Default instance name
MSSQLSERVER. - Database user
sawith passwordPassword123. - Database
master. - Guest local account
vagrantis member of sysadmin role; authenticated from inside the VM, without password.
- Vagrant default user:
- VirtualBox installed.
- Vagrant installed.
- Run
vagrant plugin install vagrant-reloadin command prompt (used to reboot after Hyper-V Server updates) - Downloaded
SQLServer2017RC2-x64-ENU.iso(1.5GB, see below)
- Download SQL Server 2017 installer for Windows.
- Run the installer and choose to download SQL Server 2017 full ISO.
- Copy the ISO next to this Vagrantfile.
NOTE: Provision runs several steps: installs KB2919355
update required by SQL Server, reboots, installs SQL Server.
That is why the vagrant-reload is required.
git clonethis repository or download ZIP.cd vagrant-sqlserver-windows- Copy the downloaded
SQLServer2017RC2-x64-ENU.isointo the cloned repository (next toVagrantfile). - Follow the Usage section.
-
vagrant upto 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 sshto get direct access to the guest shell via SSH. You'll be connected as the vagrant user. You can get root access withsudocommand. -
vagrant haltto shutdown the guest machine. -
vagrant destroyto wipe out the guest machine completely. You can re-create it and start over withvagrant up.
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;"
- Marc Abramowitz for his Microsoft Hyper-V Server 2012 R2 Vagrant image.