We are installing our Yii2 framework thorugh Composer. So first we need to install composer on our Linux system.

In order to work composer Yii2 in our systems, some packages need to be installed first to support them.

So let's get started. Open your Terminal and start executing the following code.


Installation of prerequisites for Composer and Yii2 framework

Step 1 The curl installation

YII Installation in linux 1

Step 2 The php5-cli package installation

YII Installation in linux 2

Look at the above snapshot, it is asking for permission, press y and then "enter".

Step 3 The php5-mysql package installation

YII Installation in linux 3

Step 4 The php5-mycrypt package installation

YII Installation in linux 4

To activate it, we need to run the following command.

YII Installation in linux 5

Now these four packages will alwayse remain in your system and you don't need to install them every time while installating Yii framework.


Yii Installation

Let's install the composer globally in our system.

Step 1 The Composer installation

YII Installation in linux 6

Step 2 Installing Composer Globally

YII Installation in linux 7

Step 3 After composer installed, install composer asset plugin.

YII Installation in linux 8

Here, you may be asked for a Token, which indicates GitHub username and password. If you don't have one just create it. It is very easy to create and free to use.

This command allows you to manage asset plugins like css, js, etc which manages npm and bower dependencies.

Now we are ready to install basic and advanced templates.

Step 4 To install Basic template

YII Installation in linux 9

After the download is complete, you can rename it as you want. Our folder is named as basic.

Step 5 To install Advanced template

YII Installation in linux 10

Here we have named it as Advanced.

Step 6 Run it on the browser with the following URL,

http://localhost/Advanced/frontend/web/

YII Installation in linux 11

Look at the above snapshot, you have successfully downloaded your Yii2 framework in your system. Now start your application.