Thursday, 29 November 2012

Centos 6/RHEL install Speedcrunch and Gcalctool Calculators

Anyone following the MIT Introduction to Computer Science and Programming course, with lectures from the superlatively knowledgeable Professor Eric Grimson will know that it is not so much an introduction, more of a repeated duckstooling into the deepest waters of abstract mathematics, incremented by doses of extreme maths for prodigies and geniuses, topped off with a subtle course of extra curricular Iterative and Recursive Algorithms, Objects, nested recursive multi-dimensioned Tuples and much more. 

It is heavily maths orientated so realistically is aimed at high level and dedicated coders with potentially burgeoning careers in certain areas of web engineering, as you would probably expect from an institution which traditionally mentors students from within the top 1% of the worlds intellectual talent. 

An interesting course which demonstrates crossing the line between just being an average Python programmer and being one in absolute control, Professor Grimsons mastery of the subject matter is palpable. As I have inferred, despite the name it is not entry level and it is followed by many experienced programmers.

Those who drop out may nonetheless be interested in Speedcrunch and Gcalctool, both decent calculators for Centos 6/RHEL.

Speedcrunch Centos 6
Featuring sin, cos, tan, asin, acos and atan keys, views for Math book, Constants, Variables and Functions & including a full screen mode for when small just wont do, Speedcrunch is a very useful tool. Results are displayable as Binary, Octal, Hexadecimal and Decimal with Decimal being available in three formats, General, Scientific and Engineering & 50 decimal digits.

The symbols used are computer keyboard friendly, for example the divide and multiply keys are identical to your keyboard for easy input and it has a handy exponent key. It is cross platform on Linux, Windows and Mac so users of the latter two happening upon this post can obtain it at the link above, whilst Linux users can use the rpms which I prepared, further down the page.

It's handy if you are using the minimal Fluxbox version as I do and don't have access to Gnome desktop accessories.

Although I believe it is now in the Epel repo I converted the supplied deb files to rpms with Alien and it runs fine on Centos 6, so get them below if you have any problems with the repo.


Speedcrunch 64 bit_el6_rpm

Install it with

$ sudo rpm -Uvh <file_name>

Run it with

$ speedcrunch

Gcalctool, now renamed simply 'Calculator' is another fine calc built by the people at Sun and available in the Epel repo. It has multiple modes and below is an example in the Scientific mode.
It has a formidable array of features including a Programmers mode, user editable constants and functions & accuracy levels configurable up to 9 significant figures/places so it is extremely versatile.


Gcalctool Centos 6
If you have the epel repo enabled just issue

$ sudo yum -y install gcalctool               to get it.

Run it with

$ gcalctool

These are the two calculators which I use for various tasks and they cover the large majority of needs up to mid range mathematics, although professional mathematicians will no doubt use more powerful devices.


Fluxbox users see Fluxbox key bindings for more information.

More repos.




Tuesday, 27 November 2012

Centos 6/RHEL Fluxbox Key Bindings & Autostart Programs


Fluxbox key bindings.

Fluxbox key bindings make life easier on your Centos 6 box as you can assign your programs to be opened with just a keystroke, namely the F1 - F12 keys and Mod1 (Alt) or Mod4 (Microsoft logo) + a letter.

If you haven't yet installed Fluxbox then as long as you have Epel repo its straighforward, so fetch it with


# rpm –-import http://mirrors.coreix.net/fedora-epel/RPM-GPG-KEY-EPEL-6

# rpm -Uvh http://mirrors.coreix.net/fedora-epel/6/i386/epel-release-6-7.noarch.rpm

(Alter the above for 64bit)

$ sudo yum -y --enablerepo=epel install fluxbox thunar thunar-volman rxvt

Above for Fluxbox Window Manager, Thunar File Manager and Rxvt Terminal Emulator.

Set up your shortcuts in Fluxbox as below.

Hit Alt+F2 to run Thunar or your chosen file manager, check the 'show hidden files' box from the 'view' menu and browse to the .fluxbox directory which is normally hidden.

Open the 'keys' file with vi and add at the top 'F1 : ExecCommand thunar' (or your file manager) then copy/paste it 10-12 times.

Change the other F1 entries to F2 etc and change the program it runs, for eg F2 : ExecCommand rxvt
F6 : ExecCommand beaver
F9 : ExecCommand google-chrome
F10 : ExecCommand firefox

That's fine to start with, save the file, close off file manager and restart fluxbox to register the shortcuts (right click and select restart, change styles here also - try zinek_darkblue).

More fluxbox options available at /usr/share/fluxbox + info at http://fluxbox.org/ 

Fluxbox is highly customisable and the F1 - F12 shortcut keys open your most used programs very quickly. (Alt+F2 to run others or create shortcut/symlinks in the Desktop folder as below).

$ cd Desktop 

$ sudo ln -s /usr/bin/<prog_name>

More keyboard shortcuts.

You will likely run out of keys for your programs using just F1 - F12, so you can add more by using the Mod1(Alt) & Mod4(Microsoft logo) keys, for example Mod1 g : ExecCommand gimp, (Alt + g) to run Gimp, or another example Mod4 g : ExecCommand gimp, (MicroSoft logo + g) again to run Gimp.

Mod1 and Mod4 keys + letters gives another 52 shortcuts.

More information on this can be found at
 http://fluxbox.sourceforge.net/docbook/en/html/fluxbox-man.html

Fluxbox Autostart Programs

To have a program start automatically at bootup.

$ sudo vi /etc/X11/xinit/xinitrc              add the  line

startfluxbox                                 save it, then

$ vi /home/<user_name>/.fluxbox/startup        add the line

/usr/bin/<prog_name> &                     (with ampersand) 

just before the 'exec fluxbox' line 


More repos


Centos 6/RHEL install Dillo Browser


Dillo is a fast lightweight browser based on FLTK (fast light tool kit). Written in C and C++, it is known for its small footprint and lightening fast rendering of web pages. It has a novel bug meter for detecting bugs and contributions from new developers are encouraged. Although there is deliberately no support for images and scripts it is nonetheless a useful addition if you are looking for a featherweight browser without going the text based route.

To install Dillo on your Centos 6/RHEL box, first make sure you have kernels and compile tools sorted as in this tutorial.

Download FLTK      (need 1.3.0 +)
Download Dillo     (latest recommended)

Both to your home directory, get dependencies first, you need
openssl and an --enable-ssl flag on configuring.

$ sudo yum -y install openssl openssl-devel

$ sudo su

First build the FLTK source files

# cd /usr/src

# tar xvf /home/<user_name>/fltk-1.3.0-source.tar.gz

# cd fltk-1.3.0

# ./configure

# make && make install

# cd              and remove the install files

# rm -rf /usr/src/

Now install Dillo

# tar xvf /home/<user_name>/dillo-3.0.2.tar.bz2

# cd dillo-3.0.2

# ./configure --enable-ssl

# make && make install

# cd              and remove the install files

# rm -rf /usr/src/dillo-3.0.2

# exit           

Run it with 

$ dillo

See Fluxbox key bindings for more information.


Dillo's page rendering is sometimes strange due to lack of image and script support but if you can live with that it is a very fast and useful browser.

Monday, 26 November 2012

Centos 6/RHEL Zip a file/folder

Like the USB format commands, I sometimes forget the Zip file/folder commands so here it is to remind me.

First install Zip if not already there.

$ sudo yum -y install zip 

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * Webmin: webmin.mirror.somersettechsolutions.co.uk
 * base: mirror.bytemark.co.uk
 * epel: mirror.bytemark.co.uk
 * extras: mirror.bytemark.co.uk
 * updates: mirror.bytemark.co.uk
Setting up Install Process
Package zip-3.0-1.el6.i686 already installed and latest version

The syntax to zip up a folder is

$ zip -r <zip_package_name.zip> <folder_to_be_zipped>

$ zip -9 -r <zip_package_name.zip> <folder_to_be_zipped>

$ zip <zip_file_name.zip> <file_to_be_zipped>

$ zip -9 <zip_file_name.zip> <file_to_be_zipped>

-9 is to invoke the maximum compression value, you can leave it off for the default compression.

So as an example, to zip up an xvid .avi file should the need arise.

$ zip -r factory.zip factory.avi  (avi files wont compress)

  adding: factory.avi (deflated 1%)

So we have a look inside with Xarchiver, there it is.


To zip up a test folder containing various compressible files and using default and maximum compression.

$ zip -r test1.zip test_folder

$ zip -9 -r test2.zip test_folder

Although it often does not seem that the compression makes all that much difference, those are the usual commands.

To unzip the folder or file just

$ unzip <zip_file/folder_name>

Zip folders in Linux are usable cross platform.

$ zip -h for more options and flags.

That's it, simple zipping and unzipping.





Monday, 19 November 2012

Centos 6/RHEL using Repoquery and Yum commands

You can use the repoquery command to list packages, it will work with installed packages as well packages not yet installed.

Install yum-utils            

$ sudo yum -y install yum-utils

Example syntax below

$ repoquery -q -l <package_name>
$ repoquery -q -l --plugins <package_name>
$ repoquery -i <package_name>

For example

$ repoquery -q -l mysql-libs


/etc/ld.so.conf.d/mysql-i386.conf
/etc/my.cnf
/usr/lib/mysql
/usr/lib/mysql/libmysqlclient.so.16
/usr/lib/mysql/libmysqlclient.so.16.0.0
/usr/lib/mysql/libmysqlclient_r.so.16
/usr/lib/mysql/libmysqlclient_r.so.16.0.0
/usr/share/doc/mysql-libs-5.1.66
/usr/share/doc/mysql-libs-5.1.66/COPYING
/usr/share/doc/mysql-libs-5.1.66/README.mysql-license
/usr/share/mysql
/usr/share/mysql/charsets
/usr/share/mysql/charsets/Index.xml
/usr/share/mysql/charsets/README

Or for more information

$ repoquery -i mysql-libs

Name        : mysql-libs
Version     : 5.1.69
Release     : 1.el6_4
Architecture: i686
Size        : 4126608
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Group       : Applications/Databases
URL         : http://www.mysql.com
Repository  : updates
Summary     : The shared libraries required for MySQL clients
Source      : mysql-5.1.69-1.el6_4.src.rpm
Description :
The mysql-libs package provides the essential shared libraries for any
MySQL client program or interface. You will need to install this package
to use any other MySQL package or any clients that need to connect to a
MySQL server.
 

Use it in conjunction with the yum list updates command 

$ yum list updates
$ yum list updates openssh
$ sudo yum -y update openssh 

Shows output (among other)


[root@Centos anton]# Running Transaction Test
                    1/6 
  Updating   : openssh-server-5.3p1-81.el6_3.i686                        2/6 
  Updating   : openssh-clients-5.3p1-81.el6_3.i686                          3/6 
  Cleanup    : openssh-clients-5.3p1-81.el6.i686                            4/6 
  Cleanup    : openssh-server-5.3p1-81.el6.i686                             5/6 
  Cleanup    : openssh-5.3p1-81.el6.i686                                    6/6 
  Verifying  : openssh-server-5.3p1-81.el6_3.i686                           1/6 
  Verifying  : openssh-5.3p1-81.el6_3.i686                                  2/6 
  Verifying  : openssh-clients-5.3p1-81.el6_3.i686                          3/6 
  Verifying  : openssh-clients-5.3p1-81.el6.i686                            4/6 
  Verifying  : openssh-5.3p1-81.el6.i686                                    5/6 
  Verifying  : openssh-server-5.3p1-81.el6.i686                             6/6 

Updated:
  openssh.i686 0:5.3p1-81.el6_3                                                 
Dependency Updated:
  openssh-clients.i686 0:5.3p1-81.el6_3   openssh-server.i686 0:5.3p1-81.el6_3  

Complete!
[root@Centos anton]# 

Exclude Packages

You can permanently exclude packages you do not wish to be updated with yum update, just add an entry into yum.conf

$ sudo vi /etc/yum.conf

and append the following in the 'main' section

exclude=kernel*php*        to exclude kernel and php packages

Disable the exclude if necessary by using

$ sudo yum -y --disableexcludes=main install php

$ sudo yum -y --disableexcludes=all update

$ sudo yum -y --disableexcludes=repoid install php

Other commands

$ yum info <package_name> $ yum repolist
$ yum list available
$ yum list available | grep gimp

Shows output             


gimp-data-extras.noarch                  2.0.2-3.1.el6                   base   
gimp-devel.i686                          2:2.6.9-4.el6_3.3               updates
gimp-devel-tools.i686                    2:2.6.9-4.el6_3.3               updates
gimp-help.noarch                         2.4.2-5.1.el6                   base   
gimp-help-browser.i686                   2:2.6.9-4.el6_3.3               updates
gimpfx-foundry.noarch                    2.6.1-3.el6                     epel   

More repoquery commands

More repos