How to find Ubuntu Version

To find Ubuntu version, run


cat /etc/*issue

On Terminal.

find_ubuntu_version

Posted in ubuntu | Tagged | Leave a comment

Install PHP 5.5 on Ubuntu 12.x

To install PHP 5.5.x on Ubuntu, add PPA


sudo add-apt-repository ppa:ondrej/php5

To install PHP 5, run


sudo apt-get update
sudo apt-get install php php-cli

For updating existing version of PHP, run


apt-get update
apt-get dist-upgrade

PHP Version before upgrade


root@flashwebhost-desktop:~# php -v
PHP 5.3.10-1ubuntu3.11 with Suhosin-Patch (cli) (built: Apr 4 2014 01:27:23)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
root@flashwebhost-desktop:~#

After Upgrade


root@flashwebhost-desktop:~# php -v
PHP 5.5.10-1+deb.sury.org~precise+1 (cli) (built: Mar 27 2014 16:16:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with XCache v3.1.0, Copyright (c) 2005-2013, by mOo
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with XCache Optimizer v3.1.0, Copyright (c) 2005-2013, by mOo
with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo
with XCache Coverager v3.1.0, Copyright (c) 2005-2013, by mOo
root@flashwebhost-desktop:~#

XCache is exta, i installed it with

apt-get install php5-xcache

After PHP Upgrade.

Posted in PHP, ubuntu | Tagged , , | Leave a comment

Installing Ruby Gems from Gemfile

Gemlist list ruby gems needed for an application.

To install all gems required by an application, go to application folder and run

bundle install

If you have no bundle command available, install it with gem

gem install bundler

Installing dependency with bundle


[root@lin redmine]# bundle install
Please configure your config/database.yml first
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using multi_json (1.8.4)
Using activesupport (3.2.16)
Using builder (3.0.0)
Using activemodel (3.2.16)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.16)
Using mime-types (1.25.1)
Installing polyglot (0.3.4)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (3.2.16)
Using arel (3.0.3)
Using tzinfo (0.3.38)
Using activerecord (3.2.16)
Using activeresource (3.2.16)
Using bundler (1.5.3)
Using mini_portile (0.5.2)
Using nokogiri (1.6.1)
Using xpath (2.0.0)
Using capybara (2.1.0)
Using ffi (1.9.3)
Using childprocess (0.5.1)
Using coderay (1.1.0)
Using database_cleaner (1.2.0)
Using rack-ssl (1.3.3)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.16)
Using jquery-rails (2.0.3)
Using metaclass (0.0.2)
Using mocha (1.0.0)
Using net-ldap (0.3.1)
Using ruby-openid (2.3.0)
Using rack-openid (1.4.2)
Using rails (3.2.16)
Using rmagick (2.13.2)
Installing rubyzip (1.1.0)
Installing websocket (1.0.7)
Installing selenium-webdriver (2.39.0)
Installing shoulda-context (1.0.2)
Installing shoulda-matchers (1.4.1)
Installing shoulda (3.3.2)
Installing yard (0.8.7.3)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
[root@lin redmine]#

Posted in Ruby On Rails | Tagged , , , , | Leave a comment

Can’t install RMagick 2.13.2. Can’t find MagickWand.h.

When installing rmagick gem, i got following error


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes

Warning: Found a partial ImageMagick installation. Your operating system likely has some built-in ImageMagick libraries but not all of ImageMagick. This will most likely cause problems at both compile and runtime.
Found partial installation at: /usr/local
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.2. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.1.0/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/rmagick-2.13.2/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
[root@lin redmine]#

Searched for file MagickWand.h


[root@lin redmine]# find /usr -name MagickWand.h
/usr/local/src/ImageMagick-6.8.8-7/wand/MagickWand.h
/usr/local/include/ImageMagick-6/wand/MagickWand.h
[root@lin redmine]#

Problem is fixed by running

C_INCLUDE_PATH=/usr/local/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ gem install rmagick -v '2.13.2'


[root@lin pkgconfig]# C_INCLUDE_PATH=/usr/local/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ gem install rmagick -v '2.13.2'
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.2
Parsing documentation for rmagick-2.13.2
Installing ri documentation for rmagick-2.13.2
Done installing documentation for rmagick after 7 seconds
1 gem installed
[root@lin pkgconfig]#

Posted in Ruby On Rails | Tagged , | Leave a comment

Installing Python 2.7 on CentOS for Django Framework

Django Framework need python 2.7 to run. CentOS come with python 2.6.

To install python 2.7, run

wget -qO- http://people.redhat.com/bkabrda/scl_python27.repo >> /etc/yum.repos.d/scl.repo
yum install python27

Now enable python 2.7 by running

scl enable python27 bash

[root@lin ~]# python --version
Python 2.7.5
[root@lin ~]#

Installing Setuptool, pip and Django


cd /usr/local/src
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-2.1.tar.gz --no-check-certificate
cd /usr/local/src/setuptools-2.1
python ez_setup.py
easy_install pip
pip install -U django==1.5.4

Posted in Python | Leave a comment

Goodbye FireFox, Welcome Google Chrome

I was using Firefox for long. For extra security i used NoScriptFirefox extension. This will stop bad scripts from starting when you visit unknown or hacked web sites. I recommend anyone using firfox or google chrome use NoScript (NotScript for google chrome) as it will disable JavaScript by default, only trusted web sites can run JavaScript, Java, Flash etc.. For exta security, i used Sandboxie to run firefox.

sandboxie

Recently i have problem with Adobe Flash Player plugin in firefox, it stop responding at times. Chrome have built in flash player and keep it updated. With firefox, flash player is updated with sheduled task. I found update some times fail for flash plugin and Secunia PSI had to alert me.

I considered switching to Google Chrome several times. But i was using TextAloud with NeoSpeech Kate Voice as TTS. TextAloud Toolbar only worked with Firefox. Many asking for TextAloud Toolbar to work with Google Chrome. For some reason it never worked with Chrome.

Now i started using Chrome Speak extension with Google Chrome. Set it to use native voice. On windows set NeoSpeech Kate as default voice. That solved TTS problem with Google Chrome. Text Highlight feature of TextAloud is the only feature i miss from firefox + textaloud.

Google Chrome use more memory than firefox. It fills my task manager with chrome.exe process, i don’t like this. Advantage of Google Chrome is it have built in Sandbox and process run with log integrity.

As per Application Sandboxes: A pen-tester’s perspective, Google chrome have better security and sandboxing features.

chrome_sandbox

Google Chrome Vs Firefox Security

Google chrome have built in Sandboxing feature. That will prevent malwares infect your computer. Even if malware run in your browser, it get removed when you close the browser tab.

Sine google chrome run process in low integrity level, malware won’t be able to modify other process or files.

Google rewards security researchers for reporting security vulnerabilities. This will make Google Chrome more secure.

http://blog.chromium.org/2013/03/pwnium-3-and-pwn2own-results.html

Goodbye Firefox and TextAloud. Thank you for serving me for many years.

Posted in Chrome, firefox | Tagged , , , , | Leave a comment

Analyze Hard Disk space usage in Linux using Agedu

Agedu is a command line utility that enables you to not only hunt down large files that are taking up valuable space on your hard drive but those that have not been accessed in a while.

Installation

On Ubuntu (or Ubuntu-based distro), you can easily install Agedu with the command:

sudo apt-get agedu

However, the version in the repository may be out-dated.

You can download and install the latest version from program website – scroll down to the Download section towards the bottom of the page to locate the download link.

Download and Extract the contents of the tar.gz archive.

Open the terminal and navigate to the extracted folder. Type the following commands to compile/install:

./configure
make
sudo make install

After completing the installation, the first thing you need to do is build up an index of the contents of your drive. To index your home directory, type the following command in the Terminal.

agedu -s /home

Once the index is created, you can view the data that has been gathered in your web browser by typing

agedu -w

agedu-terminal

Right click the URL and copy the link. Open your web browser and paste the URL into the address bar.

Here you can navigate through a series of graphs that indicates not only which folders are taking up the most room, but by hovering the mouse over a bar you can see when they were last accessed.

agedu-report

In this way, you can easily identify folders that are taking up a lot of space but do not necessarily contains files that you need to access very often – such folders could be moved to an external hard drive.

Don’t forget to clean up after Agedu. It leaves behind a potentially large index file in whatever folders you scan. This can be removed by running the following command at the Terminal:

agedu -s /home -w -R

You can replace /home with whichever folder you need.

Posted in Linux | Tagged , , , , | Leave a comment

How to Check Broken Links of a Website using LinkChecker on Ubuntu

LinkChecker is a free, GPL licensed website validator and it checks links in web documents or full websites directly from your desktop. It works in Windows, Mac and Linux.

To install LinkChecker on Ubuntu download the following 2 files from the debian website.

linkchecker_8.4-1_i386.deb (for 64bit download linkchecker_8.4-1_amd64.deb)
linkchecker-gui_8.4-1_all.deb

Note: The current version as of this post is 8.4-1. You should get the newer version if it is available.

Install both the .deb files by double clicking on the downloaded .deb files.

To install LinkChecker from Ubuntu repository (Note: may not be the latest version), run the following command in terminal.

sudo apt-get install linkchecker linkchecker-gui

link-checker-8

All you need to do is to enter your website URL and press the Start button. It will then proceed to do the scanning. If you have a big website with plenty of content and links, it could take up to a few hours to finish the scanning.

Posted in Linux, ubuntu | Tagged , , , , , | Leave a comment

How to Automatically Take Screenshots in Ubuntu at Regular Interval

It is easy to take screenshots in Ubuntu by using the “Print Screen” button on your keyboard. If you want the system to take a screenshot automatically at a regular interval, here is a quick way.

The tool that we are going to use is scrot. Scrot is a command line utility that allows you to capture screenshot from the terminal.

You can install scrot by running the following command in terminal.

sudo apt-get install scrot

Capturing screenshots at regular interval

To use Scrot to capture screenshots automatically at regular interval, all you need to do is to run the following command in the terminal:

while true; do scrot -d int  'filename.jpg|png' -e 'mv $f /file/path/to/store/screenshots'; done

Here are a few parameters that you need to change:

int – the number of seconds before each screenshot is taken
filename – the filename of the screenshot. You can use variables like %Y, %m, %d, %H, %M, %S $w, $h to denote the year, month, day, hour, minute, seconds, width and height respectively.
jpg|png – take the screenshot in either jpg or png format. Include only one, but not both.
file/path/to/store/screenshots – the location where you want to move the screenshots to

For example, if you want it to take a screenshot at every 5 seconds and save it to the Pictures folder. This is the command to use:

while true; do scrot -d 5 '%Y-%m-%d-%H:%M:%S.png' -e 'mv $f ~/Pictures/'; done

Note: Press “Ctrl + Z” to end the process.

Note: Scrot will take about 1 -2 second to complete each cycle. You might want to adjust the interval to compensate for this lag

The above command will run the process forever until you stop it manually. If you want to get it to run for a certain count, say 100 loops, you can use the command below:

for i in {1..100}; do scrot -d 5 '%Y-%m-%d-%H:%M:%S.png' -e 'mv $f ~/Pictures/'; done

This will take 100 screenshots at an interval of 5 seconds.

Putting it in script

It is barely useful if you need to type the command everytime you want to run the process. The best way is to turn it into a script where you can run it anytime, everytime.

Open a text editor and paste the following commands:

#!/bin/bash

for i in {1..100}
do
scrot -d 5 '%Y-%m-%d-%H:%M:%S.png' -e 'mv $f ~/Pictures/';
done

Save the file as auto-screenshot.sh in your Home folder. Grant it executable permission:

chmod +x ~/auto-screenshot.sh

Now you can run the process by using the command in the terminal:

./auto-screenshot.sh

Automating the screen capturing process

If you want to schedule the screen capturing process to run at a certain time everyday, the fastest way is to set a cronjob.

Posted in Linux, ubuntu | Tagged , , , | 1 Comment

How to Recover / Re-Install Ubuntu GRUB using Boot-Repair

Boot Repair is the simple graphical tool used to repair, restore or reinstall the grub bootloader on Ubuntu.

When you install Windows after Ubuntu your Ubuntu will not boot anymore and its grub may be wiped out. To restore it follow the steps below.

You need to have Ubuntu Live CD or Live USB. Boot using your Ubuntu Live CD or Live USB, while booting choose Try Ubuntu.

Once booted connect to the internet and and run the following commands in terminal to install the boot repair.

1. Add boot-repair to the repository

sudo add-apt-repository ppa:yannubuntu/boot-repair

2. Update your repository

sudo apt-get update

3. Install boot-repair

sudo apt-get install -y boot-repair

After completing the installation run Boot-Repair from terminal by entering the following command.

boot-repair

It will scan the System for few seconds and will show you the options Recommended repair and Create a BootInfo summary. By clicking the Recommended Repair it will start repair the grub.

boot-repair

Once done click ok and restart your system, your grub should work now.

Posted in Debian Linux, Linux, ubuntu | Tagged , , , , , , , , , | Leave a comment