Install Yii 2 via composer
1. Install composer from here https://getcomposer.org/doc/
Add its path in environment in windows or move to /bin/composer in Ubuntu to make it run globally.
2. Run the following commands
composer global require "fxp/composer-asset-plugin:1.
0.0-beta3" composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
yii-application is the name of the dir where you want to install the application. Its an advanced app. you can specify yii2-app-basic to create basic app.
3. Initialize directory structure
cd to yii-application dir and run.
select 0 as dev environment. This command creates the basic structure of the directories.
4. Connect DB
Create a new database and adjust the components.db configuration in common/config/main-local.php accordingly.
Apply migrations with console command yii migrate.
Set document roots of your web server:
for frontend /path/to/yii-application/
for backend /path/to/yii-application/