Skip to main content

installing masonite on ubuntu 24

Installing the Masonite framework on Ubuntu 24.04 involves setting up Python dependencies, creating a virtual environment, and installing the framework using pip. 

Prerequisites
Before installing, ensure your Ubuntu system is updated and has the necessary development tools, Python, and pip installed. 

bash
sudo apt update
sudo apt install python3-dev python3-pip libssl-dev build-essential python3-venv

Installation Steps
  1. Create a Project Directory
    Navigate to the directory where you want to store your project:
    bash
    mkdir ~/myapp
    cd ~/myapp
    
  2. Set Up a Virtual Environment (Recommended)
    Create and activate a virtual environment to avoid conflicts with system-wide packages:
    bash
    python3 -m venv venv
    source venv/bin/activate
    
  3. Install Masonite
    Install the core Masonite framework:
    bash
    pip install masonite
    
  4. Create a New Project
    Initialize a new Masonite project in the current directory:
    bash
    craft new
    # or to specify a name
    # project start my_project
    
  5. Install Project Dependencies
    Install the dependencies listed in your project's requirements.txt file:
    bash
    pip install -r requirements.txt
    # Alternatively, if you used 'project start'
    # project install
    
  6. Run the Server
    Start the development server to confirm installation:
    bash
    python craft serve
    
    Access your application at http://localhost:8000/. 

Troubleshooting
  • Command craft not found: If the craft command is not recognized, ensure you are in the virtual environment. Alternatively, try running it with python craft serve.
  • Permission Errors: If you did not use a virtual environment, use the --user flag: pip install masonite --user