View Kushal Bhakta Joshi's profile on LinkedIn

profile for Kushal Bhakta Joshi at Stack Overflow, Q&A for professional and enthusiast programmers

Things to do after installing Ubuntu 16.04 LTS Xenial Xerus as a PHP Developer

Update the installed applications
First update the repo list and the installed applications in your system
sudo apt-get update
sudo apt-get upgrade

Setup Linux, Apache, MySQL, PHP (LAMP) stack
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Setup Lynx Browser
sudo apt-get install lynx

Setup SSH Access for Remote Connection
First install openssh server to enable ssh connection
sudo apt-get install openssh-server

The default port of ssh is 22. So in case you have firewall enabled in your system, you need to allow the 22 port in your firewall.
sudo ufw allow 22

If you want to use your own custom port for ssh connection, you can change it by editing /etc/ssh/sshd_config
sudo nano /etc/ssh/sshd_config

Search for Port 22 in the content and replace the 22 with your custom port

Setup Composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

Setup Git
sudo apt-get install git

Setup Node.js
There are different ways to install node. The best way I have found so far is using node.js version manager (nvm). Due to the nature of projects, different versions of node.js are required for development. So, this nvm is the best tool to manage the different versions of node.js. Moreover, you can select specific version of node.js from the version list for development.
sudo apt-get install build-essential libssl-dev

Once the prerequisite packages are installed, you can pull down the nvm installation script from the project's GitHub page. The version number may be different, but in general, you can download it with curl.
cd ~/Downloads
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
sh install_nvm.sh

It will install the software into a subdirectory of your home directory at ~/.nvm. It will also add the necessary lines to your ~/.profile to use the file.

To gain access to the nvm functionality, you can source the ~/.profile file so that your current session knows about the changes
source ~/.profile

Now that you have nvm installed, you can install isolated Node.js versions.

nvm ls-remote
This finds out the versions of Node.js that are available for installation
      v6.8.0
      v6.8.1
      v6.9.0

As you can see, the latest version at the time of this writing is v6.9.0, install the version using
nvm install 6.9.0

Usually, nvm will switch to use the most recently installed version. You can explicitly tell nvm to use the recent or backdated version you have downloaded.

nvm ls
This will output following list. I have just assumed the list.
     v0.12.14
     v5.12.0
     v6.0.0
 ->  v6.9.0

Currently, 6.9.0 is selected as you have just installed the version. nvm use 6.0.0
Now using node v6.9.0

nvm ls
     v0.12.14
     v5.12.0
 ->  v6.0.0
     v6.9.0

Now 6.0.0 is selected.

You can reference the versions using aliases. Suppose you want to alias 6.9.0 as a default.

nvm alias default 6.0.0
This version will be automatically selected when a new session starts.

Now you can use npm as per your need.

Setup Bower
npm install bower -g

Install PHPStorm
sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
wget http://download-cf.jetbrains.com/webide/PhpStorm-2016.2.1.tar.gz
tar -xvf PhpStorm-2016.2.1.tar.gz
cd PhpStorm-2016.2.1/bin/
./phpstorm.sh

Category: