Ubuntu and development environment setup - Gizra/KnowledgeBase GitHub Wiki

This article provides steps for configuring ubuntu so it will be ready for developing. The codes provided below are to be used inside the Terminal.

Installing git

sudo apt-get install git
sudo apt-get install git-cola

Installing php server

sudo apt-get install mysql-server mysql-client
sudo apt-get install apache2

## Not needed for ubuntu 16
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
sudo service apache2 restart

## For ubuntu 16
sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

sudo apt-get install php7.0 php5.6 php7.0-mysql php7.0-gd php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0

Once everything is installed you can switch from php5.6 to php7.0 in this way:

sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
or from php7.0 to php5.6:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart 
**End ubuntu 16**

sudo apt-get install phpmyadmin
sudo ln -s /etc/phpmyadmin/apache.conf /etc/phpmyadmin/conf.d/phpmyadmin.conf
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

sudo /etc/init.d/apache2 reload

Install jdk for Phpstorm

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
For hebrew language:
sudo apt-get install openjdk-7-jdk icedtea-7-plugin

PHPstorm

Download from here.

After installing PHPstorm use these settings.

After go to file -> import settings and reload the file.

Install Drush 8 using Composer

First install Composer globally.

$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer
$ export PATH="$HOME/.composer/vendor/bin:$PATH"
$ source ~/.bash_profile

Now that you have Composer working, you can install Drush from the latest HEAD:

$ composer global require drush/drush:dev-master

Or for version 7:

$ composer global require drush/drush:7.*

For Ubuntu:

Create .bash_profile file ($ touch ~/.bash_profile), and copy export PATH="$HOME/.composer/vendor/bin:$PATH" to the file.

Now open $ gedit ~/.bashrc and source (import) the .bashrc file (source ~/.bash_profile).

Creating a php mail server

** For ubuntu16 please install first the pear**
sudo apt install php-pear

sudo pear install mail
sudo pear install Net_SMTP
sudo pear install Auth_SASL
sudo pear install mail_mime
sudo apt-get install postfix

SSH key

ssh-keygen -t rsa

For more reference see https://help.github.com/articles/generating-ssh-keys.

[http://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration](Git global user registration)

Clean URL

sudo a2enmod rewrite
sudo gedit /etc/apache2/apache2.conf

Add in the end of the file

<Directory /var/www/*>
  AllowOverride All
</Directory>
AccessFileName .htaccess

Might also need to update the defaule site to /var/www:

sudo gedit /etc/apache2/sites-available/000-default.conf

Change DocumentRoot from /var/www/html to /var/www.

Then restart apache server:

sudo service apache2 restart

Install compass for SASS

  • If package is missing rubygems Download using this instructions
sudo apt-get install ruby-full build-essential
sudo apt-get install rubygems
sudo gem install sass
sudo gem install compass

Install npm && bower && jekyll

  • If package is missing nodejs Download using this instructions
sudo gem install bundler
sudo apt-get install npm
sudo gem install jekyll
sudo apt-get install nodejs-legacy
sudo npm install -g generator-jekyllrb
sudo npm install -g bower
sudo npm install -g grunt-cli

If Getting Error during bundle install due to ruby version not matching

** run to install ruby required dependancies **
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

** install rbenv and then ruby-build **
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

**install ruby **
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v

**reinstall bundler**
gem install bundler

**rehash rbenv**
rbenv rehash

Install npm && bower && jekyll if you get this error:

Could not find blankslate-2.1.2.4 in any of the sources (Bundler::GemNotFound) do this

rbenv install 1.9.3-p194
rbenv rehash # for paranoia's sake
rbenv global 1.9.3-p194
gem env # to check that everything was pointing at 1.9 and not the system
gem install --no-ri --no-rdoc bundler
rbenv rehash # necessary to load up the bundle executable
bundle --path=vendor/bundle

Install Xdebug

https://github.com/Gizra/KnowledgeBase/wiki/Install-xdebug

⚠️ **GitHub.com Fallback** ⚠️