DEV Community

vkuberan@gmail.com
vkuberan@gmail.com

Posted on • Edited on

2

Docker Ubuntu LAMP Setup on Windows

MY LAMP SETUP

  1. Pull Ubuntu

     docker pull ubuntu:latest
    
  2. Pull Mariadb

     docker pull mariadb:latest
    
  3. Create the shared network

     docker network create --driver=bridge lampstack
    
  4. Create MariaDB Container

     docker run -itd -p 33063:3306 --name=lampmysql \
     --network=lampstack \
     --env MARIADB_USER=root \
     --env MARIADB_PASSWORD=google \
     --env MARIADB_ROOT_PASSWORD=google \
     mariadb:latest
    
  5. Create Ubuntu Container

    Replace "./htdocs" with your working directory path.

    docker run -itd -p 8080:80 \
    --user root \
    --name=lampstack \
    --network=lampstack \
    -v ./htdocs:/var/www/html/ \
    ubuntu:22.04 /bin/bash
    
  6. Get in to the Ubuntu Container

    docker attach lampstack
    
  7. Install all necessary Apache/PHP packages

    Refer 1: Ubuntu - Install LAMP Stack

    Execute the following commands one by one.

    Update Ubuntu

    apt-get update
    apt-get upgrade
    

    Install necessary tools along with apache

    apt-get install iputils-ping \
    vim \
    systemctl \
    apache2 \ 
    apache2-utils \
    

    Enable apache server

    systemctl enable apache2
    systemctl start apache2 
    systemctl status apache2
    

    Install mariadb client and PHP

    apt-get install mariadb-client \
    php \
    libapache2-mod-php \
    php-mysql \
    php-curl \
    php-gd \
    php-mbstring \
    php-xml \
    php-soap \
    php-intl \
    php-zip
    

    Enable rewrite and Restart apache server

    a2enmod rewrite
    systemctl restart apache2
    
  8. Rewrite Mode

    If you want seo like links, You need to do some additional work

    Refer 1: Ubuntu - Enable Mod Rewrite

    Refer 2: Ubuntu - Enable Mod Rewrite

    cd /etc/apache2/sites-available/
    vi default.conf or vi 000-default.conf
    

    Add following section to the one of the above mentioned file after CustomLog.

    <Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
    

    Enable mod rewrite and restart apache

    a2enmod rewrite 
    systemctl apache2 restart
    

Additional configuration

  1. Install phpMyAdmin

    docker pull phpmyadmin/phpmyadmin
    
  2. Create container for phpMyAdmin

    docker run -itd -p 2599:80 --name=lampphpmyadmin \
    -e PMA_ARBITRARY=1 \
    --network=lampstack \
    phpmyadmin/phpmyadmin
    

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (2)

Collapse
 
jeromesch profile image
jeromesch

you should try to put all that stuff in a dockercomposefile :)
makes it easier and you only have to write it once!

Collapse
 
vkuberan_88 profile image
vkuberan@gmail.com

Thanks for your reply. This is just for manual setup.

Here is my docker-compose setup
dev.to/vkuberan_88/docker-compose-...

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay