We will be setting up a Masonite development environment on Ubuntu. We’ll use Ubuntu because on ubuntu (or UNIX*) your development environment will match your production server.

Installing Python

Python is a widely used general-purpose, high level programming language. There are two major Python versions: Python 2 and Python 3. In this tutorial, we’ll use Python 3.7 because Masonite requires Python 3.4 and above. You can install any version greater than 3.4.

sudo apt update
sudo apt install python3.7

Installing Pip

pip is a package manager for Python. The main goal of pip is automated dependency management.

sudo apt install python3-pip

Installing Virtualenv

Virutalenv is a tool to create isolated Python environments. Use pip to install virtualenv and its dependencies:

pip3 install virtualenv

Run virtualenv in a bash. If you have nothing as errors, you are ready for the next steps.

Additional packages

We need python-dev which is the package that contains the header files for the Python C API for high performance. This package is part of the OpenSSL project’s implementation of the SSL and TLS cryptographic protocols for secure communication over the Internet.

sudo apt-get install python3.6-dev libssl-dev

Create a new folder and a virtual environment

mkdir helloworld
cd helloworld
virtualenv --python=python3.7 venv
source venv/bin/activate

Installing Masonite

pip install masonite

Creating new project

craft new helloworld . # Don't forget the dot at the end of this line.
craft serve

You can now visit http://localhost:8000 to view your new website!