Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Vagrantfile for SQL Server on Linux with WideWorldImporters sample database and tSQLt framework included
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "forwarded_port", guest:1433, host:1433
config.vm.provider :libvirt do |libvirt|
libvirt.memory = "4096"
end
config.vm.provision "shell",
inline: <<-SHELL
yum -y update
curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo > /etc/yum.repos.d/mssql-server.repo
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
curl https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/WideWorldImporters-Full.bak > /vagrant/DbBackup/WideWorldImporters-Full.bak
yum install -y epel-release
yum install -y tcping
export ACCEPT_EULA=y
yum install -y mssql-server mssql-tools unixODBC-devel
export SA_PASSWORD='Vagrant2017'
/opt/mssql/bin/mssql-conf setup accept-eula
while ! tcping localhost 1433;do sleep 1; done
/opt/mssql-tools/bin/sqlcmd -Usa -PVagrant2017 -i /vagrant/Restore-DB.sql
/opt/mssql-tools/bin/sqlcmd -Usa -PVagrant2017 -dWideWorldImporters -i /vagrant/tSQLt/SetClrEnabled.sql
/opt/mssql-tools/bin/sqlcmd -Usa -PVagrant2017 -dWideWorldImporters -i /vagrant/tSQLt/tSQLt.class.sql
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment