\usepackage{listings}
\usepackage[scaled=0.9]{DejaVuSansMono}  % or another monospaced font
\renewcommand{\ttdefault}{pcr}           % 'pcr' = Courier
\lstset{
  basicstyle=\ttfamily\small,
  columns=fullflexible,
  keepspaces=true,
  breaklines=true,
  breakatwhitespace=true,
  showstringspaces=false,
  frame=none,
  backgroundcolor=\color{white}
}