Skip to content
Neil M edited this page Jan 16, 2017 · 21 revisions

This page documents the steps required and some gotchas for getting the code up and running on Linux.

(The instructions are currently specific to Ubuntu 16.04 and only tested there, but should be easily transferrable to other distros).

Prerequisites

Install .NET Core

If you don't have it already, follow the instructions at: https://www.microsoft.com/net/core#linuxredhat to install .NET Core.

On Ubuntu I installed the following:

sudo apt install dotnet-dev-1.0.0-preview2-1-003177

If when running the code, you get errors similar to the following:

The specified framework 'Microsoft.NETCore.App', version '1.0.3' was not found.

Then try installing the version it is requesting, e.g.:

sudo apt install dotnet-sharedframework-microsoft.netcore.app-1.0.3

Get a SQL Server database

The options are to point at a SQL Server database in Azure, or to install SQL Server for Linux locally.

Installing SQL Server locally

See the instructions at: https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-ubuntu

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
sudo apt update
sudo apt install -y mssql-server
sudo /opt/mssql/bin/sqlservr-setup

Also get the SQL Server command line tools.

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt update 
sudo apt install mssql-tools unixodbc-dev-utf16

Get VSCode

We can of course use any text editor for working with the code, but VS Code has good support for C# projects, as well as an extension for working with MS SQL.

Get the code

Fork the AllReady repo on Github and clone it locally:

git clone https://github.com/<youraccount>/AllReady

Build the code

Navigate into the top-level directory and do a restore:

cd AllReady
dotnet restore 

Then navigate into the AllReadyApp.Core and build.

cd AllReadyApp/AllReadyApp.Core
dotnet build

Now build the webapp:

cd ../Web-App/AllReady
dotnet build 

Setup the DB

The connection string to the database needs to be tweaked in order to point at our SQL Server database.

Note that SQL Server on Linux doesn't have integrated security, so you will need to create and specify a user to login to the DB with.

If you set up SQL Server for Linux, run the sqlcmd program and create a login and a user and give that user CREATE DATABASE permissions:

/opt/mssql-tools/bin/sqlcmd-13.0.1.0 -U SA -P 's4p4ss!'
1> create login AllReadyAdmin with password = 'p4ssw0rd!';
2> go
1> create user AllReadyAdmin for login AllReadyAdmin;
2> go
1> grant create database to AllReadyAdmin;
2> go

In config.json, update the Data/DefaultConnection/ConnectionString and Data/HangfileConnection/ConnectionString settings to something like:

"ConnectionString": "Server=localhost;Database=AllReady;User ID=AllReadyAdmin;Password=p4ssw0rd!;MultipleActiveResultsets=true;"

Now we can run the database migrations:

dotnet ef database update

Running the app

Now run the app with:

ASPNETCORE_ENVIRONMENT=Development dotnet run

Setting the environment variable ASPNETCORE_ENVIRONMENT=Development gives us more useful error messages in the app for diagnosis during development.

Troubleshooting

Central Standard Time issue

If you are getting errors such as:

The time zone ID 'Central Standard Time' was not found on the local computer.

then try running a find and replace on the code, with Central Standard Time being replaced to GMT. This is just a temporary fix until the main repo is updated to resolve this issue.

Clone this wiki locally