# Init the wordpress working environment for dev by the way used docker: * One of the most important techniques before working with wordpress is creating localhost on your computer. * The wprdpress source code is the one that the web source is written in php and myspl which means it will need a web server with support for php language translator to be able to run the web and to do that you need to Create a host that supports php and mysql. But because you are just learning wp, we will do it on localhost. * localhost is a software to support creating a web server right on your computer and it is just the environment to run your WP web and no one can see except the same users who are on the LAN. --- ### 1. install docker with the command: * docker is a virtual server supporting the web as it really is (web ---> virtual server [docker]) * step 1: First, add the GPG key for the official Docker repository to the system: > curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - * step 2: Add Docker repositories to APT sources: > sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" * step 3: Next, update the package database with Docker packages from the newly added repo: > sudo apt-get update * step 4: Make sure you are installing from the Docker repo instead of the default Ubuntu 16.04 repo: > apt-cache policy docker-ce * finally : > sudo apt-get install -y docker-ce * Check if it has an office: > sudo systemctl status docker * Output should same this: > output ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2016-05-01 06:53:52 CDT; 1 weeks 3 days ago Docs: https://docs.docker.com Main PID: 749 (docker) --- ### 2. install docker compose with the command: > sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose > sudo chmod +x /usr/local/bin/docker-compose > docker-compose --version > Output should same this: > output docker-compose version 1.18.0, build 8dd22a9 * #### The most used statements during dev-wp: `docker-compose up -d` (init running localhost) `docker-compose down` (stoping localhost) `docker ps -a` (check status [exit or up]) `docker stop "CONTAINER ID"`(stop at contaner id) `docker start "CONTAINER ID"`(run) --- ### 3. Initializing the web server: * access https://bitbucket.org/namtech/docker-mysql/src/master/ Clone this source and follow intructions * ##### Quick Start - Clone `.env.sample` to `.env` in the same directory and update configuration for project. - Start docker container: `docker-compose up -d` - Access to phpMyAdmin with http://localhost:8080 --- ### 4. Setup wordpress with the sample source: * Access https://bitbucket.org/namtech/wordpress-kit/src/master/src/wp-content/ Clone this source and delete file (.git ) (Source-sample) * Used visual code to open your source and perform the following steps: * #### you have two cases to setup: the rebo of project have existed or none exist. Firstly you need clone this source to your computer then copy file (.git) at this source past to the sample source, replace the file has been deleted above. step 1: Perform the follow of RREADmd: - Clone `.env.sample` to `.env` in the same directory and update configuration for project. - Please make sure MySQL service is running. - Access MySQL and create database if does not exist. - Start docker container: `docker-compose up -d` - Access to home page with http://localhost:ports example http://localhost:80 step 2: access into src/wp-content/theme => create a new theme , example th: ![](https://i.imgur.com/ffqBqWA.png)