Sunday, 29 July 2012

Centos 6/RHEL install Deluge Bittorrent client from repo

Deluge installation from repo.

Deluge is a full-featured cross platform  BitTorrent client created in Python. It makes use of libtorrent and features multiple user-interfaces including: GTK+, web and console

Deluge features a rich plugin collection providing much of its  functionality and is made freely available at

http://deluge-torrent.org/ although compiling from source is probably not the easiest way for the average user to obtain it.

It has the facility to be used on separate machines in client/server mode also, which is useful.




Deluge and Preferences box

It will work with multiple Desktops including, but not restricted to, GNOME, KDE, XFCE, FLUXBOX and others.

It has a large array of features as below

Core/UI split allowing Deluge to run as a daemon
Connect remotely to the Deluge daemon
Web UI
Console UI
GTK+ UI
BitTorrent Protocol Encryption
Mainline DHT
Local Peer Discovery (aka LSD)
FAST protocol extension
╬╝Torrent Peer Exchange
UPnP and NAT-PMP
Proxy support
Web seed
Private Torrents
Global and per-torrent speed limits
Configurable bandwidth scheduler
Password protection
RSS (via Plugin)
Other  libtorrent feature

It has quite a number of dependencies, making it not such a great candidate for a quick compile and install from source, although you are welcome to try if you have a lot of spare time.

Fortunately, the guys at nux-dextop have seen fit to compile a nicely working rpm for Centos 6/RHEL,and this is how I'd recommend installing Deluge.

Make sure Epel repo is enabled also as GeoIP is needed from it

To obtain nux-dextop first install wget if not installed.

$sudo yum -y install wget                           

$wget http://li.nux.ro/download/nux/dextop/el6/i386/nux-dextop-release-0-1.el6.nux.noarch.rpm

or

$wget http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-1.el6.nux.noarch.rpm

for the repo pack       

$sudo rpm -Uvh nux-dextop-release-0-1.el6.nux.noarch.rpm

to install it.

$sudo vi /etc/yum.repos.d/nux-dextop.repo   

set 'enabled' to '0'

$sudo yum -y --enablerepo=nux-dextop install deluge

After installing a few python packages you are set to go  

To run it just type

$deluge

See Fluxbox key bindings for more. 

Autostart

To have it autostart when rebooting (in Fluxbox)

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

startfluxbox                                save it, then

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

/usr/bin/deluge &                        (with ampersand)

Just before the 'exec fluxbox' line         

If you check 'start in tray' in preferences it will autostart

already in your tray.

Other desktop users can check here

Set it up to open torrent files by default in your browser settings. Typically, when downloading a file in Firefox, just select the 'Open with Deluge' option which should appear. If you do download the torrent file then right click on it and do the same.

Go into preferences where you can set up port forwarding and adjust many other settings to ensure optimum performance of the program.

So this is the simple way to obtain Deluge thanks to the people at nux-dextop.



Thursday, 26 July 2012

Centos 6/RHEL install SMPlayer and codecs & Flash Browser Plugin


This post is on installing SM Player and codecs on Centos 6/RHEL.

SMPlayer is perhaps the most versatile and reliable media player for Linux Desktop. It plays DVD, TV, Radio, AVI and a wide range of other formats without any fuss. Install it as below with the codecs for the majority of video files you will find on the internet.

I've included a link at the bottom for the Firefox flash browser plugin also.

RPMForge.

First you need the RPMForge repo 

$ sudo rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

$ sudo vi /etc/yum.repos.d/rpmforge.repo  

and disable it by default or try set priority = 10

SM Player and Codecs.

$ sudo yum -y --enablerepo=rpmforge install smplayer compat-libstdc++-33 libdvdcss libdvdread libdvdplay libdvdnav lsdvd libquicktime flash-plugin mplayer mplayer-gui gstreamer-ffmpeg gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly

W32codecs


32bit

$ sudo wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-20061022-1.i386.rpm

$ sudo wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-extra-20061022-1.i386.rpm

64bit

$ sudo wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-20061022-1.x86_64.rpm

$ sudo wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-extra-20061022-1.x86_64.rpm

$ sudo rpm -Uvh *.rpm                     

FFmpeg and Mencoder


$ sudo yum -y --enablerepo=rpmforge install ffmpeg mencoder

See below for the Flash plugin. 

Flash Browser Plugin 32/64bit(Mozilla)

You can also install Totem, another popular player with a simple

$ sudo yum -y install totem

if you have Epel repo installed/enabled.

More repos




Wednesday, 25 July 2012

Centos 6/RHEL install Elinks Text Browser


Elinks is a popular text based browser for Linux which is easy to use and install. Its in many standard repos so just type

$sudo yum -y install elinks             to install it

$elinks                                 to run it

Or you can visit http://www.elinks.cz/ where they build it.

Its a multi collaborative effort and the goal of the project is to provide a feature-rich text mode browser with an open patches/features inclusion policy

It's an excellent little browser and you will find yourself using it regularly once you have tried it. It's main function is to work in a standard Linux console.

The first screen to render in the console on running Elinks is a url entry box. A simpler opening GUI would be difficult to conceive and it is immediately redolent of the old Google fascia only in Black and White. 

See it below, in  an Rxvt terminal emulator on the Desktop.




Elinks Text Web Browser in Rxvt terminal emulator

Often, you will know the url of a page of information you need, especially if you visit it regularly. You can just pop up a terminal window, type in elinks with the url and you are in business. Fast/touch typers will definitely like it.

It has a menu at the top similar to many of the day to day applications you may run on a normal desktop, but runs in text mode. Menu options are

File View Link Tools Setup Help 

with a number of sub menus beneath them.


Type minimallinux.blogspot.com into the url box and view the contents of this blog in text mode.




Elinks in Rxvt viewing minimallinux.blogspot.com

It is a breeze to negotiate the various options and renders pages accurately and quickly. It is much easier to use than the Lynx text browser which is also widely available, but slightly more complex.

If you are in a Linux console and need to look online for information, this is the ideal way to do it. So give it a try, install as above and run the program.

Run the program and type the url you require simultaneously and it will open up at the url, as below.So the command

#elinks http://www.hardcode.nl/archives_143/article_574-format-drive-using-fdisk-on-linux.htm           shows as below.




Elinks in a Linux console.

You can sign in to a Google account if you have one,just hit Esc for the menu, go to file and open a new tab, type in the url and up pops the sinisterly ubiquitous Google page. Arrow down to sign in and navigate to email address, which is highlighted in black, hit enter so it turns white and you can enter your email, repeat the procedure for the password.

You get a message about updating to chrome but nonetheless most of the site works in text mode. You can navigate around your account and make adjustments as necessary. I didn't, however, find out how to sign out of the Google account so if you do, feel free to post the details here.




Elinks in Rxvt downloading a Centos 6 iso

You can also use Elinks in the Desktop in a terminal emulator like rxvt which is often quicker, and handy for viewing text dominated information sites.

Being realistic, a text based browser is not going to replace or compete with a graphical web browser such as the ones you have become used to on a Desktop & many sites just aren't suited to them. They ARE harder to use and require considerable keyboard skills to get the most out of them, but unquestionably they are very useful in a console environment and you should install one as standard most of the time.

Elinks is a highly recommended text based Web Browser for the Linux console.

Tuesday, 24 July 2012

Centos 6/RHEL install Firefox22 & Adobe Flash Mozilla Plugin 32/64 bit

This tutorial is to manually install the Adobe Flash plugin for Mozilla Firefox on 32/64 bit on Centos 6/RHEL Desktop and similar rpm based distros. For older hardware see bottom of page

I find that the best way to install the Adobe Flash browser plugin is manually using the tar.gz file, as opposed to the various .rpms, yums and such like which are available which don't necessarily work all the time.

This method should work fine on 32bit and 64bit Centos/RHEL and similar rpm based distros 99% of the time, as well as many other distros. It is very simple to accomplish.

It should look like this when finished



Mozilla Firefox is a must have on a Centos 6/RHEL minimal Desktop installation because other browsers use its plugins directory,
so first install Firefox if not installed. You can install from the standard repo (older version) or use version 22 from the Remi repository and which has some extra useful features on it.

$ wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

$ sudo rpm -Uvh remi-release-6.rpm        

If this is a first time installation you will probably need
rehat-bookmarks also.

$ sudo yum -y --enablerepo=remi install firefox redhat-bookmarks

Once you have the flash plugin for Mozilla, you can enable it for other browsers as needed, usually using a symlink to the file.

Flash version 11.2 is the final release for Linux.

Now download the tar.gz version of flash player

 32bit plugin

 64bit plugin 

Both 32 and 64 bit are identical in format so the same instructions apply to both.

$ tar xvf install_flash_player_11_linux.i386.tar.gz 

or

$ tar xvf install_flash_player_11_linux.x86_64.tar.gz

This unpacks a /usr directory and a libflashplayer.so file, both of which need to be installed.

First, look for a suitable plugins directory with

$ whereis mozilla

You need to have one in /usr/lib/mozilla/plugins (or lib64)

If you haven't got one, create one

$ sudo mkdir /usr/lib/mozilla/plugins (or lib64)

Places one in the /usr/lib/mozilla folder (or lib64)

Copy the libflashplayer.so into the plugins directory.

32bit 

$ sudo cp libflashplayer.so /usr/lib/mozilla/plugins/libflashplayer.so

64bit

$ sudo cp libflashplayer.so /usr/lib64/mozilla/plugins/libflashplayer.so

That done, now copy the accompanying /usr folder over to /usr

$ sudo cp -r usr/* /usr

That is all you need to do to install the flash plugin for Mozilla Firefox.

Now open up Firefox and type 'about:plugins' into the address bar and it should show similar to the image above.(Reboot if needed).

If you have the Java plugin enabled also, as in this tutorial,
then it will look like the image below.


Firefox with Flash and Java Plugins.

The above works on the Centos 6 Live CD also.


Older Hardware

Flash Player 11 was compiled to use sse2 and may not work with older Intels (P4s, P3s) and 32 bit AMD systems. To check run

$ cat /proc/cpuinfo                       

and look for 'sse2' in the flags line. Just 'sse' indicates you have an older unit which means you should try Flash Player 10.

Download Flash Player 10 

Then follow the same procedure as above


Monday, 23 July 2012

Centos 6/RHEL install Flock Browser

Before installing make sure you have installed Mozilla Firefox from the repo and the essential Adobe Flash plugin for it.

Flock is a well known browser popular with many tech people for its multitude of features and powerful tools for web use. It is excellent if you use a lot of web accounts with the Accounts and Services toolbar proving to be especially useful. The most recent version I found was 2.6.1 as seen below with a search engine I like to use regularly.



Normally you can obtain it from flock.com  but at present it seems to be temporarily on hold, with promises of exciting new developments around the corner. For now you can download Flock 2.6.1 if you can't find it anywhere else.

This is only tested on Centos 6 32 bit.

When you have downloaded it to your home directory, decide where to put it, I use /usr/share.

$ cd /usr/share          to the install directory

$ su                     to root, then extract the files

# tar xjf /home/<user_name>/flock-2.6.1.en-US.linux-i686.tar.bz2

create a symlink in bin directory

# ln -s /usr/share/flock/flock-browser /usr/bin/flock-browser

# exit                     back to normal user

Now to run it just type

$ /usr/bin/flock-browser                       or

$ flock-browser

See Fluxbox key bindings for more if using it.

An import dialogue box shows if another browser is installed.


And the first run screen



Flock can be a very useful browser although a little resource heavier than some. Its definitely worth a look though and its pretty straightforward to install.

Sunday, 22 July 2012

Centos 6/RHEL install Midori & SeaMonkey Browsers

Before installing make sure you have installed Mozilla Firefox from the repo and the essential Adobe Flash plugin for it.

Midori is a fast webkit based browser with some great features such as 
  •  Full integration with GTK+2.
  •  Fast rendering with WebKit. 
  •  Tabs, windows and session management.
  •  Bookmarks are stored with XBEL. 
  •  Searchbox based on OpenSearch. 
It performs well in Centos/RHEL especially if using Fluxbox window manager. It is in beta, however, so there may be a few bugs but it is worth spending a few minutes checking it out.


SeaMonkey is a much loved Firefox alternative and is used as default browser in many distros. It includes IRC Chat, Mail, Newsgroup & Address book and Html editor. You can add it to your Centos\RHEL installation with a few simple commands.

 
Both the above are available from the nux-dextop repository, which has become an essential repo for Centos/RHEL

To obtain the repo first install wget if not already installed

$ sudo yum -y install wget                          

$ wget http://li.nux.ro/download/nux/dextop/el6/i386/nux-dextop-release-0-1.el6.nux.noarch.rpm 

or

$ wget http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-1.el6.nux.noarch.rpm
       
for the repo pack

$ sudo rpm -Uvh nux-dextop-release-0-1.el6.nux.noarch.rpm

to install it.

$ sudo vi /etc/yum.repos.d/nux-dextop.repo   

set 'enabled' to '0'

$ sudo yum -y --enablerepo=nux-dextop install midori seamonkey       
to install midori and/or seamonkey

You can run them with

$ /usr/bin/midori/seamonkey               

$midori

$ seamonkey

If you are using Fluxbox then place                               
                  
F9 : ExecCommand midori

In your /home/anton/.fluxbox/keys file 

And just hit F9 to run (or whatever key binding you assigned)

See Fluxbox key bindings for more.                           

There are other useful programs in the nux-dextop repo so even if you dont keep Midori or Seamonkey there will be something else worth using in there. Check out some other repos for Centos 6

Centos 6/RHEL install Swiftfox Browser

Before installing make sure you have installed Mozilla Firefox from the repo and the essential Adobe Flash plugin for it.

Swiftfox is a fast lightweight Firefox browser alternative which many feel is faster and more responsive than the original.

You can try it yourself by installing the tarball from the vendor

As far as I am aware it is not in the Centos/RHEL repo ,nor are deb files available to convert despite appearances on their web site at present, so go to

http://www.getswiftfox.com/tarballs.htm

and download the appropriate tarball to your home directory

Now move to a directory to install it, I use /usr/share

$ cd /usr/share                      extract the tarball

$ sudo tar xjf /home/<user-name>/swiftfox-3.6.13-prescott.tar.bz2

Create a symlink to /usr/bin

$ sudo ln -s /usr/share/swiftfox/swiftfox /usr/bin/swiftfox

$ /usr/bin/swiftfox                  to run it, or

$ swiftfox                               

If using Fluxbox you can place a line in the /home/user/.fluxbox/keys file

F10 : ExecCommand swiftfox             hit F10 to run it

See Fluxbox key bindings for more. 

and/or create a shortcut to the Desktop folder

$ cd Desktop

$ sudo ln -s /usr/bin/swiftfox

For the plugins, make sure you have Firefox and flash installed as at the link at the top of the page.

$ cd /usr/share/swiftfox/plugins                 then

$ sudo ln -s /usr/lib/mozilla/plugins/* .

making sure you include the trailing dot.

(Substitute both the Swiftfox and Mozilla paths if you have them installed elsewhere).


Swiftfox with plugins enabled.

Thats all there is to installing Swiftfox.




Thursday, 19 July 2012

Centos 6/RHEL Test for Empty Folder with Bash Script

For a simple little shell script which can test whether any directory on your system is empty or not, do the following.

$ vi empty.sh

And copy/paste the following script

# !/bin/bash
dir=$1

[ $# -eq 0 ] && { echo "Usage: $0 directory"; exit 2; }
[ ! -d "$dir" ] && { echo "$dir is not a directory."; exit 2; }

if find "$dir" -maxdepth 0 -empty | read;
then
 echo "$dir empty."
else
 echo "$dir not empty."
fi

Save the file

See Vim Editor for vi commands 

chmod it to run as an exec

$ chmod +x empty.sh

Now test it out

$ ./empty.sh /proc              returns

/proc not empty.      

$ ./empty.sh /usr/bin           returns

$ /usr/bin not empty.           or a longer example

$ ./empty.sh /usr/share/fluxbox/styles     returns


$ /usr/share/fluxbox/styles not empty.

Especially suitable for Servers as well as Desktops, it saves you browsing all the way round your system to see empty directories.

Obviously it is limited to just checking if a directory is empty or not, but shell scripting wizards can probably modify it to work with the shell if command.

A single command to find files only would be similar to

$ find "/tmp" -type f -exec echo Found file {} \;    

Or for all contents

$ [ "$(ls -A /path/to/directory)" ] && echo "Not Empty" || echo "Empty"

The same with an example would be

$ [ "$(ls -A /usr/bin)" ] && echo "Not Empty" || echo "Empty"


Wednesday, 18 July 2012

Centos 6/RHEL install VirtualBox, Guest OS and Guest Additions

VirtualBox is a well regarded virtualisation software used by many developers for testing code on multiple Operating Systems without having seperate machines or physical partitions. With VirtualBox or similar it's easy to backup the virtual disks created and install them on other machines, saving a lot of work.

If you haven't yet installed Centos 6 check out this tutorial which covers a minimal installation using Fluxbox, Thunar and Rxvt for a fast lightweight Desktop.

VirtualBox seems to be slightly less resource heavy than the VMWare equivalent, a factor to consider if you have limited hardware capabilities.

Install VirtualBox

Make sure you have required build packages installed 

$ sudo yum -y install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms

You will need to create
  • A Sun Virtual Box .repo file.
First open a terminal and type

$ sudo vi /etc/yum.repos.d/virtualbox.repo

to create a blank repo file 

Go to https://www.virtualbox.org/wiki/Linux_Downloads and scroll right down to the very bottom of the page, click on the appropriate link to open the repo file in your browser.

They are tucked away at the end and you have to look carefully for them below the following dialogue.

'Note that importing the key is not necessary for yum users (Oracle Linux/Fedora/RHEL/CentOS) when using one of the virtualbox.repo files from below as yum downloads and imports the public key automatically!'

(There are repo files available for RHEL, Fedora and openSuse there, as well as deb, rpm and .run files for other distros at the top of page)

Once open, copy/paste the contents into the blank repo file you just created in vi and save it.

See Vim Editor for vi commands 

Below is the repo file contents for Centos/RHEL which you can use if you cant find it at the link above.

[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

That done, now we do a yum search to check

$ yum search all virtualbox

you should get similar to below

VirtualBox-3.2.i686 : Oracle VM VirtualBox
VirtualBox-4.0.i686 : Oracle VM VirtualBox
VirtualBox-4.1.i686 : Oracle VM VirtualBox
VirtualBox-4.2.i686 : Oracle VM VirtualBox

VirtualBox-3.2.x86_64 : Oracle VM VirtualBox
VirtualBox-4.0.x86_64 : Oracle VM VirtualBox
VirtualBox-4.1.x86_64 : Oracle VM VirtualBox
VirtualBox-4.2.x86_64 : Oracle VM VirtualBox

If not, CHECK that you have given the file .repo extension.

If using VirtualBox for WebOS then you will need the 4.1 version.

Now we can install one of them

$ sudo yum -y install VirtualBox-4.1.i686      
$ sudo yum -y install VirtualBox-4.2.x86_64    

Add your user to vboxusers group 

$ sudo usermod -a -G vboxusers <username>    

Log out & back in to check it was added

$ groups 

anton vboxusers

Run it with                        
   
$ virtualbox 

If using Fluxbox, you can add an entry at the top of the

/home/user/.fluxbox/keys file 

Mod1 v : ExecCommand virtualbox         hit Alt+v to run it

$ cd Desktop                        and create a shortcut with

$ ln -s /usr/bin/virtualbox

See Fluxbox key bindings for more. 

Install a Guest Operating System
.
Now to install a Guest Operating System on VirtualBox

I chose Windows XP 64 bit as I have a key and it is useful for quite a few things still although of course you can use any that you have. So first we run Virtualbox.

$ virtualbox

Click on 'New' and run the New Virtual Machine Wizard

Before you install a guest OS you have to create a Virtual Disk and set a few parameters, the wizard walks you through.

1.Select VM name and type.
    2.Select Memory Size.
      3.Create New Hard Disc.
        4.Select VD Disc Format. 


        If you have qemu installed options should show, I chose VMDK.


          5.Select Fixed Disc Method.  (Faster)
            6.Select Location and Disc size.

            7.Summarize, click 'Create' and let it run as below.



            After the Virtual Disk is created , place your OS installation disc in the computer CD Drive.

            In the left column of VirtualBox, double click on your newly created and named OS Virtual drive and let it run, it will detect the disc and install the OS as below.






            Follow the installation procedure to completion as you would on a physical machine, then reboot into your new Virtual Operating System as below.



            Now you have a Guest OS in VirtualBox.

            Guest Additions

            Guest Additions adds many extra features to your guest operating system and is a must have for improved performance.

            To install it make sure your machine is running as in the last screenshot above, then click on 'Devices' in the top menu. Scroll down to 'Install Guest Additions' and click on it.

            This will bring up the dialogue box and you will go through a few screens as below.








            There will be others dependent on the OS, but it is all pretty self explanatory, at the end reboot the OS in VirtualBox.

            Now you have Guest Additions installed and you will have USB support, Mouse capture and other goodies. It will show up as a virtual drive within your guest OS as below.



            That's VirtualBox, a Guest OS and Guest Additions on Centos6


            Wednesday, 4 July 2012

            Centos 6/RHEL Lamp Stack installation

            This tutorial is to install a Lamp stack (Httpd/Apache Web Server, PHP and MySQL) on Centos 6/RHEL and prepare it for use. If you haven't yet installed it the Centos 6 minimal Desktop is a pretty capable and stable Linux disribution to use.

            Install Httpd

            First open a terminal and type

            $ sudo su                            

            # yum -y install httpd             

            To install the httpd server, and then start it with

            # /etc/init.d/httpd start          

            Browse to http://localhost to view the Apache2 test page.

            Also you should do

            # chkconfig --levels 235 httpd on

            To ensure it starts when you boot up your computer.

            Install Mysql

            # yum -y install mysql mysql-server

            To start it

            # /etc/init.d/mysqld start

            You should see the output

            "Initializing MySQL database:  Installing MySQL system tables...
            OK
            Filling help tables...
            OK"

            Now to set it up properly do

            # mysql_secure_installation  (with underscrolls)

            This will open up a dialogue so you can complete the following

            Set (Change) root password
            Remove anonymous users
            Disallow root login remotely
            Remove test database and access to it
            Reload privilege tables

            After which you should get the message

            All done! If you've completed all of the above steps, your MySQL
            installation should now be secure.

            Thanks for using MySQL!

            Test it by logging on with 

            # mysql -u root -p       or
            # sql -h localhost -u root -p

            Install PHP

            # yum -y install php php-mysql

            Which will install the needed packages


            Install PHP Centos 6

            Create a phpinfo page

            # gedit /var/www/html/info.php         (or use vi) and type

            <?php
            phpinfo();
            ?>                                    save the file 

            # /etc/init.d/httpd restart

            To restart the server and have it read the new php install

            Now browse to http://localhost/info.php


            Phpinfo Centos 6

            To view your php info file which gives you all kinds of info on the installation. There are a variety of extensions included in the standard php installation and you can find more by typing

            $ sudo yum search all php  

            Which will bring up a list of available php related packages.

            Write a new index php page.

            $ vi /var/www/html/index.php        

            Enter some test lines


            <center><h1>This is the new index php page</h1></center>

            Now when you go to localhost in the browser


            Httpd Localhost Php Centos 6
            The new page should be served by default instead of the html one

            The basic Lamp stack is now set up and ready to be used.

            More repos