Sunday, November 25, 2012

Important Linux Resources - I keep adding to this

This is a list of very good resources for linux:

1. The Master Book - Contains nearly everything regarding Red Hat and Debian based Linux

More will be added with time

Utilizing your Bash Shell with VIM

Bash shell has a score of features. Mostly they go unused. It has some very nice features that let you save time and be more productive, allowing you to maneuver intricately and imaginatively.

The Best One is:

$ set -o vi

This sets vi as a command line editor in the Bash environment. Press the escape key and you are in the vim mode. You can use all the vim single line commands to edit the command line. Press the 'v' key while in vim mode and you can edit the command straight in a full fledged VIM editor. Isn't it great!


To search a command:
Press esc and then press '/' i.e. slash, and  type some characters to search. To repeat the search in forward and backward directions, guess what.... the 'n' and 'N' keys do the same job here too. Use 'n' for backward searches and 'N' for the opposite direction.

$ /<partial cmd name>

This sequence searches the command history (bottom up) and produces the most recently used cmd matching the <partial cmd name>. Really a good feature. Now when you have the old command line, you can edit it using the features of vim.

Saturday, November 24, 2012

Important yum commands and information you should know

As a linux beginner Yum has irritated me a lot. It hardly works without issues. However some hard work can save you a lot of time in the future.

There are three important things about yum
1. Yum repositories (in the repo directory /etc/yum.repos.d/) e.g fedora.repo
(you can add fedora DVD as a repository when you don't have internet connection to exploit online repositories)
2. Yum proxy settings (refer here)
3. Yum options and capabilities - install packages and rmp file, update, remove, groupinstall, listing the packages, package dependencies etc

Yum finds its packages and their information in the repositories listed in each file in the /etc/yum.repos.d/ directory. There are some very good repositories but the most vital are the two redhat repositories - one is for free software (that comes set default in your system) that hardly meets your appetite, and the other one is a non-free repository. You should add this non-free repository.

Adding a new repository. You have to add a new .repo file in the repositories directory. You can look at the format of this files which is quite simple. To add the non-free repository just copy these files to the /etc/yum.repos.d/ directory:
repos.tar (download this tar file and untar it - add all the files to the repo directory)
Note: When sometimes Yum is not able to download some repository metadata etc.. then try changing the link type from https to http in the repo file of that repository. The links are given in the baseurl and mirrorlist parameter in the repo file.

Yum Commands (most are self-explanatory)
# yum install <package-name> //installs the package but asks you for confirmation - package name could also be a local rpm file.
or
# yum -y install <package-name> //installs the package straightaway
-y will not ask you anything and straight away install the package.
# yum update <package-name>
# yum remove <package-name>
# yum reinstall <package-name>

#yum clean all //cleans up all the yum files left over from previous installations
# yum list available // lists the available package names and descriptions
# yum list installed //lists the installed packages
# yum search <partial package name>
# yum search all <partial package name> // better search results

Group install
# yum grouplist
# yum groupinstall <group-name>
# yum groupremove <group-name>
# yum groupupdate <group-name>
# yum groupinfo <group-name>

Others
# yum deplist <package-name>
# yum info <package-name>
# yum install yumex //gui for yum (idon't use it)
# yum provides <filename> //all packages providing the file (try absolute path)
# rpm -qf <filename> //prints the package to which the files like /bin/bash belong)

Proxy settings in Fedora Bash for yum, wget, curl and any bash program sensibly designed

(Applicable to all the fedora releases ...,Fedora 14, 15, 16 , 17, ...)

Hey, this is a simple setting but has very important role to play in YUM and other internet based software used in the terminal.

If you are behind a proxy (with or without authentication) then this proxy setting in the /etc/bashrc file will help you

$ tail /etc/bashrc
    unset i
    unset pathmunge
fi
# vim:ts=4:sw=4
export http_proxy=http://username:password@172.31.1.6:8080/
export ftp_proxy=http://username:password@172.31.1.6:8080/
export https_proxy=http://username:password@172.31.1.6:8080/


The last three lines set the proxy server address and sends username password to the server for automated authentication. Append the three lines at the end of the /etc/bashrc file. You will need root permission for editing the file.

Once done, viola! Use every internet based bash program easily.

Friday, November 23, 2012

Atheros A8162 Ethernet Driver Installation - on DELL Inspiron 5420

Steps to install Atheros A8162 Ethernet Driver on a Fedora/Ubuntu system
($ signifies prompt)
(# is root prompt)(use sudo instead on Ubuntu)
Step1. Download the driver from orbit-lab.
http://www.orbit-lab.org/kernel/compat-wireless-2.6/2012/05/compat-wireless-2012-05-10-p.tar.bz2
(i tried their latest version 2011-11-20 but it never worked. Wasted a lot of time)
Step2. Extract the file with
$ tar --bzip -xvf compat-wireless-2012-05-10-p.tar.bz2
Step3.
$ cd compat-wireless-2012-05-10-p
Step4.
$ scripts/driver-select alx
$ make
# make install
# modprobe alx

no need to restart. you can restart to be on a safe side.

References: Useful post 1

Adding Fedora DVD as a repository in YUM (a useful hack for people with no internet connection)

Hi there,

This a very useful hack for installing packages in Fedora (all versions) when you don't have net available.

Required: Fedora DVD iso file

Step 1: Download the Fedora DVD iso file - whichever is appropriate for your system (32 bit or 64 bit).
OR
Create an ISO from the DVD if you have one :
# dd if=/dev/cdrom of=fedora17.iso obs=8192K

Step2:
Create a directory to mount the iso
# mkdir -p /mnt/fedora17
Now mount the iso file to the directory
# mount -ro loop fedora17.iso /mnt/fedora17

Step3: (Optional)
If you want to mount the ISO automatically the next time then do the following

# vi /etc/fstab
edit this file by adding the following line at the end
/path-to-the-iso/fedora17.iso /mnt/fedora17 iso9660 ro,loop 0 0

Step4:
edit /etc/yum.repos.d/fedora.repo

Comment any line starting with 'baseurl' or 'mirrorlist' by prefixing #

add this line:
baseurl=file:///mnt/fedora17

Step5:
Now everything is done. If yum is not able to update some repository like update then goto /etc/yum.repos.d/ directory and append all the .repo files except fedora.repo to file.repo.bkp
Do it as follows
# mv fedora-update.repo fedora-update.repo.bkp

Step6: Happy updating and installing software without internet!!!

Please revert back for any errors, questions and suggestions!