Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, January 19, 2017

Install MS SQL Server on Debian Jessie (through Docker)

Recently Microsoft released some previews of the Linux version of SQL Server.

At present the supported Linux distributions are only Red Hat Enterprise Linux 7.2, Ubuntu 16.04 and SUSE Linux Enterprise Server v12 SP2.

Installing it in other distributions (I'm using Debian Jessie) can be successful, but surely more difficult.

An alternative in these cases is using a Docker container.

Microsoft provides a Docker image for the server part, so running the server is as simple as typing the following command:
docker run -e 'ACCEPT_EULA=Y' \
    -e 'SA_PASSWORD=<yourstrong Passw0rd>' \
    -p 1433:1433 -v <host directory>:/var/opt/mssql \
    -d microsoft/mssql-server-linux
More difficult is the installation of SQL Server Tools, needed for connecting and querying the server. In this case Microsoft doesn't provide a Docker image, so you can only install them on the supported platforms.

Fortunately we can build a docker image by ourself.

Using the following Dockerfile:
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y curl apt-transport-https debconf-utils apt-utils
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/msprod.list
RUN echo mssql-tools mssql-tools/accept_eula boolean Y|debconf-set-selections
RUN echo msodbcsql msodbcsql/accept_eula boolean true|debconf-set-selections
RUN apt-get update && ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev-utf16
RUN ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd 
RUN ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp
RUN locale-gen en_US en_US.UTF-8
RUN locale-gen it_IT it_IT.UTF-8
RUN dpkg-reconfigure locales
Build the docker image:
docker build -t mssql-tools:latest .
And run it typing:
docker run -it mssql-tools:latest /bin/bash
Now in this container you can user the MS SQL Tools for connecting to the running server:
sqlcmd -S <ms sql server container IP> -U SA -P '<yourstrong Passw0rd>'
For finding the IP of the container running the SQL Server, you can type the following command on your host:
docker inspect mssql-server|grep IPAddress

Thursday, July 26, 2007

Exim4 relaying on mail.191.it

I'm NOT a sysman...but sometimes it happens.

This post is mainly for my reminder, but I hope it could be useful to other people.

The problem: I have an internal SMTP server (Exim4 on Debian) that must relay to an external smarthost (mail.191.it).

Configure Exim4 as usual, for example typing:

# dpkg-reconfigure exim4-config

For delivering mails to mail.191.it, your SMTP server have to act as SMTP AUTH client.

You have to create /etc/exim4/passwd.client file, and put inside it your connection infos in the following format:

target.mail.server:login:password

Simple, isn'it? But not sufficient...

mail.191.it (and, I think, many other smarthosts) doesn't support TLS encryption, so you have to enable AUTH PLAIN.

Create (if you don't have yet) a /etc/exim4/conf.d/main/000_localmacros file, and write in it:

AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=yes

Update the configuration:

# update-exim4.conf

...and restart Exim4:

# /etc/init.d/exim4 restart

Of course I'm using the splitted configuration schema. If you are using the non-splitted one, you need to modify the /etc/exim4/update-exim4.conf.conf or /etc/exim4/exim4.conf.template files.

...remember...I'm NOT a sysman...