Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

How to Install Magento with Apache on Ubuntu 24.04

How to Install Magento with Apache on Ubuntu 24.04

Setting up Magento on your Ubuntu 24.04 server with Apache allows you to create a powerful e-commerce platform tailored to your business needs. This guide walks you through each step, from initial preparations to troubleshooting common issues, ensuring you can deploy Magento efficiently and securely. Before you begin, ensure your server meets the minimum requirements for Magento, including sufficient RAM, CPU, and disk space. Also, having root or sudo access is essential to install and configure the necessary components.

What You’ll Need

  • Ubuntu 24.04 server (fresh install recommended)
  • Root or sudo privileges
  • Domain name pointing to your server’s IP (optional but recommended)
  • Basic knowledge of Linux command line
  • At least 8GB RAM, 4 CPU cores, and 50GB disk space (recommended for production)
  • SSL certificate (optional but recommended for security)

Step-by-Step

  1. Update your system packages
  2. sudo apt update && sudo apt upgrade -y
  3. Install Apache web server
  4. sudo apt install apache2 -y
  5. Install MySQL server and create a database for Magento
  6. sudo apt install mysql-server -y
    sudo mysql_secure_installation

    Follow the prompts to secure your MySQL installation. Then, log in to MySQL and create a database and user for Magento:

    sudo mysql -u root -p
    CREATE DATABASE magento;
    CREATE USER 'magento_user'@'localhost' IDENTIFIED BY 'your_secure_password';
    GRANT ALL PRIVILEGES ON magento.* TO 'magento_user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
  7. Install PHP and required extensions
  8. sudo apt install php php-cli php-common php-curl php-mysql php-xml php-mbstring php-intl php-zip php-soap php-bcmath php-gd -y
  9. Configure PHP settings for Magento
  10. sudo nano /etc/php/8.2/apache2/php.ini

    Adjust the following settings to recommended values:

    • memory_limit = 2G
    • max_execution_time = 1800
    • zlib.output_compression = On
    • file_uploads = On
    • upload_max_filesize = 50M
    • post_max_size = 50M
  11. Download Magento
  12. Visit the official Magento website to download the latest version or use wget:

    wget https://magento.com/tech-resources/download -O magento.zip
  13. Extract Magento files to your web directory
  14. sudo apt install unzip -y
    sudo mkdir -p /var/www/html/magento
    sudo unzip magento.zip -d /var/www/html/magento
  15. Set permissions for Magento directories
  16. sudo chown -R www-data:www-data /var/www/html/magento
    sudo chmod -R 755 /var/www/html/magento
  17. Create an Apache virtual host configuration
  18. sudo nano /etc/apache2/sites-available/magento.conf

    Insert the following configuration, replacing yourdomain.com with your actual domain or server IP:

    <VirtualHost *:80>
        ServerName yourdomain.com
        DocumentRoot /var/www/html/magento
        <Directory /var/www/html/magento>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/magento_error.log
        CustomLog ${APACHE_LOG_DIR}/magento_access.log combined
    </VirtualHost>
  19. Enable the site and rewrite module
  20. sudo a2ensite magento.conf
    sudo a2enmod rewrite
    sudo systemctl restart apache2
  21. Run Magento setup through the web installer
  22. Open your browser and navigate to Related

    How to Install Magento with Apache on Ubuntu 24.04
Scroll to top