Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Tuesday, 2 February 2016

Create your own "offline" repository for apt-get

It's a nightmare, if you do not have connected to internet for your Debian/Ubuntu machine. I use to struggle to install dependent packages after first installation of my Debian. Untill I connect to internet I cannot install packages and untill I install relevant packages I am no way on internet.
I have found an alternative, where I get offline debian package collection in one of my directory and I will do #apt-get install from there. Let me list how to do that in 3 steps.

Step 1: Collect all available DEB files:
1. Your Debian/Ubuntu distribution DVD might have come with deb installer distribution. Check your cdrom, for .../pool/main/ directory, and if it has deb files, then 'hola', copy them into your local directory.
2. You will definitely get download deb packages from cyber cafe and get them in thumb-drive and copy them to your local machine.
3. Check "/var/cache/apt/archives" in a Debian/Ubuntu machine, (may be your friend's), which has all the packages pre-installed. If it is not cleared/deleted, you will get them all in one place.

So, by now I have deb files copied in my local machine and I kept them in /opt/deb-packages/ location.

Step 2: Create a list:
Goto /opt/deb-packages/ directory and run below command,

#dpkg-scanpackages .  /dev/null  |  gzip -9c > Packages.gz

This shall take some time, give yourself a break.

Step 3: Now, add sources list:
Open sources.list file from /etc/apt
#gedit  /etc/apt/sources.list

and, add below line at the bottom of file,
deb  file:/opt/deb-packages/  ./

That's it. You are ready to install your packages.

Run, #apt-get  update
and let it update all list.

Enjoy running #apt-get install <your-package-name>
and see your package getting installed offline.

Wednesday, 8 August 2012

Essential Commands in Ubuntu [2]


Hi friends, let's discuss some extra works which will help you learn more about Ubuntu Terminal.

Let's Start with a Text Editor:
I will discuss two text editors here, where one is common/general text editor in all Linux flavors, VI editor and another is sophisticated very popular Ubuntu text editor GEdit
Let's take practical example and discuss. 
Scenario is, let me create a text file My_File.txt at work location /home/kiran/. Choose any location in your system. So, open your Terminal first,
VI Editor:
The VI Editor is famous for its lite weight. The higher version of VI is VIM, with good visuals. 
In Terminal, I have navigated to cd /home/kiran/. Type vi My_File.txt and press enter, the VI editor opens My_File.txt in Terminal.
There are 2 modes in VI, one is command mode and another is text mode. 
In command mode, the characters you type are considered as commands, and in counter part, in text mode, what ever you type will be considered as plain text and will be updated into text file. 
On start-up VI will be in command mode. Remember, to execute any command in VI, like insert, save text, delete line, delete character, quit and many more, you should be in command mode of operation.
Once started, you are in command mode, to start inserting character press i from keyboard. The VI turns to text mode and accepts your characters. Type some texts. 
Once you are finished, now to do any operation you should go back to command mode. So to go back to command mode from text mode, press ESC from keyboard. Now VI in command mode of operation. To save and quit what ever you have entered, press ESC key and type :wq 
If you want to force quit (by discarding changes) press ESC BI key and type :q! from your keyboard. 
Notice colon (:) before the commands. Check some of the most popular VI commands in here, and to know more about VI check here.
GEdit:
GEdit is my favorite text editor in Ubuntu. It is a UTF-8 compatible text editor for GNOME desktop. It is very simple yet powerful tool for editing source codes, HTML, Scripts, all most all text editing operations. One of the most powerful feature of GEdit has Syntax Highlighting for various program code and text markup formats, means, as you write a keyword of any programming language, its syntax will be recognized automatically and highlighted with separate color !. Another beautiful feature about GEdit is, you can open multiple files in different tabs. So to simply start, type gedit My_File.txt and press enter, a new GEditor window will be opened. If the file My_File.txt already exist, it will be opened for editing and if doesn't exist it will be created and opened for editing. Type anything, to save press save button or use Ctrl+s keys from keyboard, and close the file.
Which editor is better to use? Answer is left to you. Some prefer VI and others, GEdit. Well, there are advantages if you learn VI commands, if at all you are made to work on non-Ubuntu Linux, then don't search for a text editor there, remember VI is available in all Linux flavors, just start using it.

Administrator Login
Let's see how to login as root in Ubuntu. root is an Administrator in Linux, which has got control over all the operations (for time being, remember, if any work is been denied the permission for you as Normal user, it means you have to execute that operation as root user).
So to login as root user in Ubuntu Terminal, type sudo su and press enter. Terminal asks password to login as root, enter administrator password which you gave during Ubuntu installation. Are you noticing, the password you type are Not Visible (but in actual terminal is receiving the password), just go on and once you finish, hit enter. If success, you will enter into Terminal as root user. Notice the change in prompt with # from previous prompt $, which indicates the operation you carry out next will be done as root.
Note: Next in this blog, or may be any where, wherever you find $ followed by a command, then it means you need not have root login to execute that command. When you notice # it means you should have root permission to execute that command presiding it. However # and $ are NOT a part of your command you type.
[*] Well, the word su stands for Super User, i.e. the root in Linux. The word sudo has special task to do with Ubuntu. The sudo is a command that allows user to run another command or program with security privileges of Super User. As I said, there are operations in Terminal which you cannot carryout as normal user, which needs root privileges to execute. The sudo is that command which gives you a temporary permission as root to execute some of the operations. As in case sudo su, 'sudo' allows you to execute su command (which has privilege of root) by giving you temporary permission as root.
[*] The sudo is abbreviation for Substitute User and DO the operation; some people also say it Super User and DO.
[*] Let me tell you a simple technique, you need not worry about what command or operation uses 'sudo' prefix before execution, you just try executing the commands as normal user. If command gives you any error, try putting sudo prefix at the beginning of that command. If still command doesn't execute, login as root and try it; this time you should be successful.
[*] In special cases, if you fail to execute the command even as root, remember, either the command has no meaning here in Ubuntu (means the command may be proprietary program of different Linux flavor) or There may not be proper dependency libraries installed in machine to execute that command (we will learn how to fix this issue in later sections).
[*] Once you type exit, when you loggedin as root, Terminal will exit you first from root and then again you have to type exit to close Terminal
[*] It is true, Linux commands are derived from Unix platform. But there are some proprietary commands applicable to particular flavors of Linux, like Ubuntu has its own commands which may not work in RedHat, similarly Redhat may use some proprietary libraries and packages which may not be applicable to Debian based computer operating systems.

Probably below contents, library installation or packages I am discussing here are mainly applicable to only Ubuntu and some other Debian based systems. I assume that you have Internet working in your Ubuntu system. I will post some of the methods to connect Internet in Ubuntu in next post. You should atleast have a standard external modem connected to your USB Port, a mobile used as Modem will also fine. Broadband will surely do great - just connect and surf. Believe me if you thinking about Telephone dial-up connection, till today with all kind of experiments I myself couldn't succeed; If you found any solution please let me know!

What's 'apt-get' gets?
[*] Once you have connected (working) Internet in your machine, it's very easy to install and update your libraries in Ubuntu. The command sudo apt-get does this operation for you.
[*] Linux, it mainly gives a control over source code of an application, so user could compile the source and use its executable when necessary. To compile such source codes you must have Libraries installed in your machine (obviously). 
[*] Not only for compilation process but also many of the work in Linux intern looks for their dependency libraries. To say it in simple way, you type a command on Terminal and press enter to execute it, but, that command should be known to Ubuntu and must have some meanings; that information will be held by shell library. So, cd, mkdir, sudo, pwd etc. all shell commands are set of library files which have got meaningful definition to execute their tasks. 
[*] Once the library file is missing in your machine, or the library you have installed is in different path which Terminal doesn't know, then that particular command will result into 'command not found error'. 
[*] Since Ubuntu belongs to Debian family, it uses Debian Package Managers. Package Managers are again set of Libraries (or an application you can say) which helps to manage other packages or software's in Linux. 
[*] Ubuntu seeks Debian file formats for installation. Debian files are set of formatted libraries which ends with file extension .deb. These deb files are usually called executable installers in Ubuntu, same like Setup.exe files in Windows. In RedHat and Fedora Linux, it is .rpm files which are most famous in Linux, where rpm stands for RedHat Package Manager. You cannot install rpm files in Ubuntu directly, because Debian platforms don't recognize rpm files as native standard packages. However there is a 3rd party application called alien which helps in installing rpm files in Debian based systems.
[*] One more important information to be remember is, each Library in Linux intern may or may not depend on other Libraries or files which, in overall, we call Dependencies. It is very important to know dependencies of a Library, because Linux needs all dependencies must have present installed in your machine before you install any other package or your own library; otherwise it will not allow you to install them. If library-A depends on library-B, then it is important that B must be installed and ready in your machine before you install library-A. One library may depend on several other libraries, which all you need to take care. If you downloaded any deb file, right click on it and see its properties, you will find what other libraries it depends on.
[*] Remember, each library in linux has its own release version number. Some library may depend on particular version of another dependency, which also you need to take care. Some times it also happens like Lib-A depends on Lib-B and Lib-B intern depends on Lib-A, in this case it's a dead-lock position, which one to install first? Solving dependencies is a major issue if you are trying to download deb files from one machine and carry it to your home machine for installation; bcoz deb files doesn't hold account for it's dependencies, it assumes you have dependencies already installed in your system.

You worried a little right? need not. There is a easy solution, as easy as simple command execution. The command sudo apt-get will take all your installation as well as your dependencies burden and works smoothly for you.
[*] The apt-get is a powerful command used with Ubuntu's Advanced Packaging Tool performing a supreme functions like installing new packages, upgrading existing packages, removing unnecessary packages, updating package list index and even at extreme upgrading entire Ubuntu system itself. The main advantage of apt-get is its ease of use at terminal with simple internet connected in system. The apt-get connects to internet and looks for the packages mentioned in its argument for download and installs automatically at appropriate location. The apt-get automatically takes care about all dependencies of package you are installing. If package A you are installing, depends on package B, the apt-get automatically looks for package B, installs it in prior to installation of A, makes all process smooth for A's installation and then looks for A and installs it. 
So, where does apt-get looks for any package? Should I search manually and provide any web location while issuing this command? The answer is, apt-get looks internally into 'a file' which has list of web address locations for all necessary and new released packages in Ubuntu. This list is stored locally in your hard drive, which apt-get refers into, when you type to install particular package. Ubuntu has many such repository FTP or HTTP web locations whole over the world, where a stable and new release packages will be added and kept ready for all users. The apt-get will look into those web locations to install your favorite packages. You can look in to that file under /etc/apt/sources.list.
What if Ubuntu you have installed is older one and many repositories might have updated with latest packages? How do you install those latest files into your machine? How do you know the package you have installed is very latest version? So, it is important you should have new list of addresses in your sources.list file, isn't it. In order to update the file list, type sudo apt-get update and press enter. Doing this will update the list of link's information in to your local machine with new released package repository addresses. Do it atleast once in a month or when you feel there is a new version of any package which you want to install is available. Let's see all commands in apt-get.
To Install a Package:
It is quite simple installing a package using apt-get. Use
sudo apt-get install package_name
For example to install Bin-Utils package (about which we cover later) type,
$sudo apt-get install binutils 
and press enter. You can see all the set of operation which apt-get taken care. The apt-get may ask for further permission while installing your package, say yes to it. Next steps will be handled by apt-get automatically, it installs all the dependencies of Bin-Utils before installing Bin-Utils itself.
To Remove a package:
removal of unnecessary package is also so easy, use
sudo apt-get remove package_name
For example to remove Bin-Utils, type sudo apt-get remove binutils and press enter. Be careful when you remove any package, it shouldn't hurt operating system's operation.
To Update package index:
As we have seen earlier, to update a package index use sudo apt-get update.
To Upgrade a package:
Over the time, updated versions for particular package may be available from the package repositories (for example may be some security updats). To upgrade your package, first update your package index as outlined above, and then type sudo apt-get upgrade package_name. Here package_name is optional, if you wish to upgrade a particular package then you can input the package name in argument, otherwise, be aware, all the packages installed in your system will get upgraded.
Some people get confuse with Update and Upgrade. The sudo apt-get update will update the list of database repository system, where as sudo apt-get upgrade will upgrade your package to new release version.
However, while Upgrading if the package needs to install or remove its new dependencies (if any), it will not be upgraded by the sudo apt-get upgrade command. For such an upgrade, it is necessary to use the sudo apt-get dist-upgrade command. After a fairly considerable amount of time, your computer will be upgraded to the new revision.
For further information about the use of APT type sudo apt-get help, and read.
In RedHat and Fedora Linux systems, the RedHat Package Manager will be used. It also has command line tool for installing packages, that is, yum install.

Let's conclude here. In next post I will discuss further steps in installing Tar files, Zip files and other executable files in Ubuntu. And we will also see some essential packages you must have in your system. Enjoy till then.

Tuesday, 7 August 2012

Essential Commands in Ubuntu


Hi friends, hope you have enjoyed most of the features in Ubuntu. From now, let's talk only technical. Here in this post I will introduce most of the basic commands you should know and practice them strongly.
We all know, in Unix environment, and so derived Linux, Command Line Interface (CLI) is most strongest and fastest way of communicating to your computer to do your tasks. Feel proud if you are using CLI because, almost, you will interact with Kernel and its subsidiaries. I know, 'Kernel' may be sounding little high for few people who worked much on Windows. Because, it is sad to say, Windows never specifies anything about the word 'Kernel'.
Kernel is a Heart of your Operating System. You might have heard about the 'Core' in your Operating System, yes it is same the Kernel. It act as bridge between your application and computer Hardware and manages your system resources.
There is lot more to discuss about Linux Kernel. For time being, you consider a Kernel in Linux are also sort of file (a very special files) which specially interact with your system hardware. Referring to above picture, above the Kernel there exists "Shell" layer, that is what is your Command Line Interface section. And hence, Terminal is tool that helps you to execute commands over Shell layer. Before we start Shell commands, let's do some stuff with your Terminal

Let's Play with Terminal:
Navigate to Applications > Accessories > Terminal. You will see user_name@computer_name:~$ prompt on screen; where user_name is your computer user name which you have logged in; computer_name is your system name you have provided while installing Ubuntu. Then, symbol ~ indicates your default work place  for 'user_name'.
To know what directory you are in, type pwd and press enter. 
Remember, commands are case sensitive and commands receives white space between different arguments. pwd stands for Present Working Directory. 
In my case, I got this output,
kiran@kiran-desktop:~$pwd
/home/kiran
kiran@kiran-desktop:~$
where "/home/kiran" is my present working directory. 
The symbol ~ will means same, the /home/kiran; So my default work place is /home/kiran.
Let's see what's the use of Default Work Place. 
Now change your directory to /home using cd command. cd stands for Change Directory.
kiran@kiran-desktop:~$cd /home/
kiran@kiran-desktop:/home$
Notice here, change in working location is indicated
Now if you type pwd, it will display /home as your present working directory. 
To go back, at any time, from any working location to your Default Working Location, just issue cd ~ and press enter.
kiran@kiran-desktop:/home$cd ~
kiran@kiran-desktop:~$

Keyboard Shortcuts with Terminal:
This section has some good stuffs to practice, go on,
[*] To erase the screen, use Ctrl+L. However, you can also use clear command in Terminal.
[*] Terminal is capable to run many Tabs. You can run multiple commands, multiple operations on different Tabs. Use Ctrl+Shift+T to open another new Tab. similarly you can open many Tabs whenever you want  to operate paralelly. 
[*] Use Ctrl+PageUp or Ctrl+PageDwn to navigate between Tabs.
[*] To open new Terminal Window itself, use Ctrl+Shift+N.
[*] Terminal is capable to do copy paste operations. If you have written commands in a text file, copy the command and in Terminal press Ctrl+Shift+V to paste it.
[*] Use Up and Down keys to get previously typed commands, in cyclic order.
[*] There is an auto command complete feature in Terminal. To demonstrate it, just type, cd /ho and press Tab key. See the auto completion feature, the Terminal will auto complete your command to cd /home/. Similarly all commands in Linux have auto complete capabilities in Terminal. 
[*] When there are multiple of commands initiating with same name, Terminal will display suggestions on double press of Tab key. To demonstrate type cd /m and press Tab key two times, Terminal will display media/ and mnt/ and waits for your next input. This means, cd can either be media/ or mnt/ directories both starts with letter m. Now, just add letter e (at same prompt cd /me) and press Tab key once, now see Terminal will auto complete your command to cd /media/, because now Terminal has only one directory option media/ which starts with letters me. Thus work it out on few commands for auto complete feature.
Make sure you are fully familiar with above Shortcut keys, you can do really quick operations with Terminal.

How do I get help on commands?
In Linux, help and information is always given to them who asks for it. They are nicely maintained information, which are called, mans or manuals.
To see manual page for pwd command, type man pwd and press enter. Similarly, you will get manual pages for all the commands used in Linux. If you have any doubt on any command at any time, about command input type, or arguments, or options, just do man about that command you will get the description displayed on your terminal. To come out of manual page press q from your keyboard.

Some more essential commands:
So far, we have seen cd and pwd commands. Let's see two main category commands, System Information related and Basic File related.

> System Information:
[*] date will display current system date on terminal.
[*] whoami is a command which displays who the user logged in as. It displays your current log-in information.
[*] uname display the current running Kernel and its version on terminal. The argument -a with this command (uname -a) displays full version information about your current running Kernel, where -a stands for all. Yes I said current running Kernel!!; What does a "current running" literally mean is, you can have a multiple versions of Kernels in single Linux Operating System, and you can chose one for present boot-up option. Those steps I will discuss in later sections. (Don't worry it's no big deal, once you go step by step and learn all basics, you will treat Kernel also as a simple file)
[*] whereis <app> command will display the probable location of app in your Linux system. Where <app> stands for application present in your system. Let me give an example, whereis bash displays probable location of application bash (may display /bin/bash - means bash is located at /bin/ directory) in your system. whereis vlc displays probable location of VLC Media Player located in your system [only if it is installed].

> Basic File Commands:
[*] ls is command to list directories and files in present directory. If you do ls -a it lists all the files, including system files and hidden files in present directory.
[*] cd, you already know, change directory. In Linux, to change directory one step back use cd .. (notice a white space between cd and ..
If you have done ls -a you might have noticed a . (a Dot) and a .. (a Dot Dot) entry in file list; remember Dot entry confine to "Present Directory" and Dot Dot entry confine to "Previous Directory". So to go to previous directory, you type cd .. 
[*] In Linux you can pass multiple argument to command, like if you want to jump two steps back from present directory /home/user/new_dir/ now you do cd ../.. it will automatically take you two steps back and /home/ will be your new location. Do cd ~ to change your present directory to your default work location.
[*] mkdir <dir_name> will create a new directory <dir_name>. If you have given a complete file path, the directory will be created at that specified file path; otherwise, if you just give directory name, it will be created at present directory.
[*] cp <file_name>  <dest_location> copies file with <file_name> to <dest_location>. You can give multiple files with comma separated argument like cp file1,file2,file3 location. Where, file1file2 and file3 are present in current directory. You may also copy different files from different path to one location. 
[*] To copy a directory instead of a file, do cp -r dir location. Where, flag -r indicates recursive.
[*] rm <file_name> will remove or delete the file with <file_name>. rm -r <dir_name> will delete the directory with name <dir_name> along with its contents, permanently.
[*] mv <file_name> <dest_location> will move the file <file_name> to <dest_location>. 
[*] Remember, you can also use mv command to rename the file to new name, use mv <file_oldname> <file_newname>.

It is not the end. We have to learn many other commands. I will write about those commands in further posts. Till then keep practicing above commands and have a good hand in them. Any time any help on any command, just do man <command>.

Let's surf Ubuntu


Hey friends, this post is for basic beginners, some where at Level zero !!
Believe me, I have seen many people, especially old age ones, they are afraid to operate their system, probably for over carefulness or in most of the cases 'what if something happens..?' My sir/madam, it's my sincere request you will not get to know anything until you try it out. Ask me,  until you try a new, new things will not happen in your life. Trial and Error is a Best Policy human beings have ever found. So try doing some stuffs with your system.

Let's come back to Ubuntu. Today let's surf a little, we will change some stuffs in your machine [aren't you bored off looking at same theme and appearance??] and will see where exactly we can ask for some more stuffs.

Appearance:
To change your desktop appearance, Right click on Desktop and chose 'Change Desktop Background'; or on the top Panel Bar, chose System > Preferences > Appearance, this will open Appearance Preference window. There are 4 tabs, namely 'Theme', 'Background', 'Fonts' and 'Visual Effects'. Use these tabs to completely change your appearance. In Theme tab, you will get 'Customize...' button, press it. Customizing Current Theme, you can just integrate different theme Controls, Colors, Window Border, Icons or Pointers into one and build your own Theme. In Visual Effects tab choose Extra option, if your PC Configuration supports, you will get higher visual effects and graphics operation over minimize, maximize operations.

Applications:
Navigate through top panel 'Applications', you will have different sub-menus - Accessories, Games, Graphics, Internet, Sound & Video, System Tools etc. Find what they have. In Office sub menu you will have all office tools, like Open Office Word, Spread-Sheet, Presentation etc. In Sound & Video sub menu you will find a free (ofcorse all are free here) Brasero Disk Burner, try it out, it's simple and yet powerful.

Drives and Disks:
Navigate through top panel 'Places', you will be able to locate all your drives and disk partitions. If you have some Windows disk partitions, you will locate them here. In 'Places' just open 'Computer', you will see your Hard Disks, Floppy Drives, ROMs, Removable Drives and File Systems; open 'File System', here you can find out all Linux File System Structure - all File System Hierarchy.
Try opening one of your Windows partition. If Ubuntu asks administrator password, just enter it. Ubuntu (in general Linux) will open it for you. You will see your drive on Desktop too. Navigate through your files, check out how different they are. Your Windows executable files(EXE) are of no use here in Linux, they don't have executable meaning.
If you have finished your work with Windows drive, to remove it safely from Desktop, right click on it and choose Unmount. In Linux, generally, before we open any drive, we should follow Mounting and to remove it is Un-mounting the drive. Don't worry much, we will discuss this in later posts.
Next, connect your thumb drive, your Ubuntu will auto-mount it and open it. Even if your thumb drive had 100 virus attacked, no matter, just insert it. Those virus have no meaning here in Linux; did I told you before Linux is Virus free? Usually Virus files are *.EXE files which can execute or auto-execute in Windows only; but here in Linux, EXE files doesn't have executable meaning, then what poor Virus files could do. If you had virus on thumb drive, they are just useless files in Linux, locate them one by one and delete them totally. If you have finished work with Thumb drive, to remove it safely, right click on it and say Safely Remove.

Terminal:
Well, this is my favorite tool in Linux. It is known fact, traditional Linux environment is Command Line Interface (CLI), where you will type commands to tell computer what to do. This CLI is faster and very powerful. So I recommend you get a good hands on Linux Commands. The basic essential commands I will introduce in my next posts. Before that, you just try opening and closing the terminal in Ubuntu. Navigate to Applications > Accessories > Terminal. This is default GNOME Terminal in Ubuntu. You will see a prompt "user_name@computer_name:~$" on screen; s name itself indicates user_name is 'user name' with which you have logged in, and 'computer_name' is your Computer Name you have given while installing Ubuntu. Well, the symbol ~ has got special meaning - it indicates your default work-place, we will study it in later posts. If you have used Command Prompt in Windows, try same commands here in Linux terminal also, some commands may work, if not, terminal will output saying command not found.
If you can't control your curiosity, try whatis command along with your Windows commands list; like whatis dirwhatis mkdirwhatis cd etc. whatis will search for your command [if available] and display a help string on terminal. Remember, Linux commands are case sensitive; most of the commands you type are lowercase letters and upper case entry of those commands have no meaning.
Now, for this session we will exit the Terminal. Enter exit on terminal and press enter.

Browser:
Mozilla Firefox is a default browser here in Ubuntu (in most of the Linux too). Well, if you have connected to Internet, just browse through your favorite websites.

Ubuntu Software Center:
This is a most famous tool, that every one liked. Ubuntu has added this tool, in default, from 10.04 version. It is a one-stop-solution for user to browse "New Free Softwares", Installing them in One click and Removing the old if they don't need it. I know you will definitely like it. Navigate to Applications > Ubuntu Software Center. There are hell lot of applications and are beautifully categorized in different sub sections.
If you are connected to Internet, let's install VLC media player in your Ubuntu. In Ubuntu Software Center, click on 'Sound & Video' department. It will open all the sound and video related application lists. On the top right corner there is a search option, type in "vlc" [without quotes], USC will automatically filters the list and displays only applications related to your search tag. Locate 'VLC media player' and click on it, a install button you will see on the right. Click install, if USC asks Password Authentication, just enter it. The installation will begin, your VLC will be downloaded from the Internet and installed automatically.
Like this, navigate through different sub sections of USC and download them all which you liked. Enjoy!!

To conclude here, really I didn't discuss anything new in this post, except the Terminal part, which few of you might have felt strange, especially guys who worked more on Windows. I am sure, my next posts will target only on Terminal and Linux commands. To be a Geek in Linux, as all expert say, you should be strong in commands. In my next posts you will only write commands, nothing else, so use terminal as frequently as possible. Create a short-cut of your Terminal on top Panel - Navigate to Applications > Accessories > Terminal, click on it, hold the click, drag and drop it on top panel.
See you guys in next posts.

Monday, 30 July 2012

Ubuntu in Virtual Machine


Many of my friends are really interested in installing and using an open source in their work machine, but for one or other reason they are not granted permission in their office. So what I thought, let's check for an alternate solution, people can install and use Ubuntu, without touching the OS running in their machine. 
So I have thought of writing a post on How to Install and use Ubuntu in Virtual Machine environment, I will chose Windows platform to install Virtual Machine. Reason I have chosen Windows is many people complained for installing Ubuntu over or beside running Windows, saying, who have patience to do all this stuffs? and also, I have many important softwares running in Windows, which I don't want to lose. So for them, this post may be a direct answer.

Virtual Machine (VM) environment is completely isolated operating system installation within your normal operating system, which is now achieved by Software Emulation. Or in easy words I can say, VM is a software implementation of a machine (or a complete computer) that executes programs and applications like a physical machine. Now a days many VM softwares are getting popular. VM Ware is the most popular virtual machine in market. However, there are may others too.
For my installation process I am taking one of the free Open Source Virtual Machine software called Oracle Virtual Box. It is free to download from Oracle webpage and yet powerful too. 
Download and install Oracle Virtual Box from >>here<<.
Next item is, Ubuntu ISO image, downloaded into your hard drive. If you don't have a latest copy download Ubuntu ISO image from >>here<<.

Minimum Requirements to Install Ubuntu in Virtual Box:
1) At least 2GB of RAM recommended. (Because 512 MB of RAM will be taken by VM Virtual Box for Ubuntu, other wise there is chance of crashing Ubuntu while running).
2) Minimum 8GB free space in your Hard Disk.

Let's start Virtual Box:
> Start Oracle VirtualBox.
> Click on the New button. In the New Virtual Machine wizard, click Next.
> In the Name field, enter UbuntuLinux, select Operating System as Linux and Version as Ubuntu. Click Next.
> In the Memory section, set the Base Memory Size to a minimum of 512 MB (default). Just make sure, the memory you allocate is less than half the physical RAM capacity. For example, if your computer has 2 GB RAM and you allocate 1 GB RAM for your Ubuntu Virtual Machine, there is a chance you will get an out-of-memory warning when you run the Virtual Box.
> In the Virtual Hard disk section, check Boot Hard Disk and select Create new hard disk.
> Select Next till you come to the Hard Disk Storage Type. Select Dynamically expanding storage and click Next.
> Set Location as UbuntuLinux and Size as 8.00 GB. The Summary page should be shown at this point. > Click on Finish, Click on Finish againIt will take you to the main screen.
Next step is Configuring your Ubuntu Installation.

Configuration:
In the main screen, select UbuntuLinux and click on Settings.
Navigate to Network on the left panel and change Attached to: to Bridged Adapter.
Navigate to Storage on the left panel and select IDE Controller and click Add CD/DVD devices > and click choose device button and select your Ubuntu ISO file.
Once it is all done, click on OK and in the main screen select UbuntuLinux and click on Start.
Do you get another screen now for Ubuntu installation? Just follow the instructions and install Ubuntu.

Installing Ubuntu:
Have a look into my first post Ubuntu Pre-Installation Tips and follow the same instructions here.
Select Install Ubuntu and do the install.
In "Allocate drive Space" screen, chose Erase and use Entire disk. Ubuntu will do all partition needed for you. Don't be afraid, the term entire disk here is your 8GB virtual partition you have created in previous steps. Your 8GB partition serves as entire hard disk, virtually for Ubuntu.  That's why it is Virtual Environment execution!!
After installation is complete, allow it to reboot. It will reboot and take you to the login page.
As it reboots you should hear the Ubuntu audio theme. If you can't, check the audio settings under SettingsEnable Audio should be checked.

Now, Open a terminal and type,
$ sudo su
enter password for Super User. Next type,
# sudo shutdown -h now
The Ubuntu Virtual Machine will shutdown now.

Now we have to remove the link to the Ubuntu iso file, or else it will start all over installation again. This step is similar to removing the Ubuntu CD from your CD Drive after the installation is complete.
Select UbuntuLinux and click on Settings; Go to Storage; Right-click on Ubuntu ISO link you have added and select Remove Attachment.

Now, you should be able to run your Ubuntu in Virtual Box.

How to share Windows folder in Virtual Box:
Believe me this situation will definitely occur, when you start using Ubuntu in your Virtual Box. Since, both the environments are different, you cannot access Windows files and folders in Virtual Box Ubuntu, [vice versa is also true].
There is a process how you can access Windows shared folder in Virtual Box Ubuntu. I found this method great helpful, with respect to Virtual Environment Execution.
Once you start UbuntuLinux, login with proper password.
Chose Device menu and click on Install Guest Additions. Install Virtual Box Guest application. It's an image file located in Virtual Box installation file. You may get more information about Guest Addition, hereRestart your Virtual Machine when completed. Now you should see a CD icon of "VBOX_ADDITIONS" on your Desktop.
Next step is, in your Windows drive, create a folder and name it properly. For example, i have created a folder named "ubuntu_share" in my C:\ drive. Next, share the drive for every one, with both Read, Write permission. To do so, right click on 'ubuntu_share' folder, chose properties, in sharing section, select share this folder.

Next, in Ubuntu Virtual Box machine, open Terminal and type,
$ sudo su
enter proper password.

Next part, Check what are all mounted in your system, to do that, type,
# mount
and hit enter.

You should see, what are all drives mounted in your system. There will be a line among list of all,
/dev/sr0 on /media/VBOXADDITIONS... type iso9660...

Next step is create a directory in /media/ drive. To do so, in Terminal type,
# mkdir /media/share/

Next, you have to mount your 'ubuntu_share' folder into /media/share/ directory. 
To do so, in terminal type,
# mount.vboxsf  ubuntu_share  /media/share/
and hit enter. 
If no warning is generated, then your ubuntu_share folder is successfully mounted on /media/share/ directory. Now, any file/folder you have kept in "ubuntu_share" in Windows you can access in Ubuntu Virtual Box. 
Try it out, keep any file in 'ubuntu_share' folder in Windows. In Ubuntu Virtual Box, in Terminal type,
# ls /media/share/
hit enter. You should see your file listed in here. 

Hope you Enjoyed !!

Friday, 27 July 2012

Ubuntu Pre-Installation Tips


I will write a post here on What to remember before you install Ubuntu - a famous Linux flavor. Even though I am speaking about Ubuntu here, I will try make it a general post for all Linux flavors.

Let me drag your precious 5 minutes. World's 80% of PC is still running with Windows as major operating system. Google Trend ranks Linux at approximately 0.5 while Windows at 1.8 to 2. What's the reason behind people not opting for a better choice? Well there are few reasons, which may rid off soon (hopefully). First and foremost reason, Not knowing How user friendly, Hardware friendly, Installer friendly and Developer friendly the Linux is than any other OS. If you not aware Why You Need Linux in your machine, really it's time to know it for you.

Second reason might be, you dependent on proprietary software where you paid heavily for it's license and can't let it go. No matter, Linux has a solution for that, Dual boot. You can install Linux in parallel to your Windows and while booting you can choose which OS you prefer to boot. With 100% fail safe, Linux promises, your parallel Windows OS will  not be touched at all. That's the beauty of Linux, unlike monopoly strategy of Windows. Ubuntu - Linux for human beings - is one step ahead to it. Yes I forgot to tell, each and every software you install in Linux is totally Free of cost and you will never feel missing your own packages or software environment in Linux what you liked in Windows. It's sad to here if you been charged for softwares which are freely available in Linux.

Other reasons also like, monopoly nature of hardware vendors, there may be hardwares which only support Windows. Are you receiving your brand new lappy with Windows OS installed in it and is your vendor refusing to sell your device if you tell him that you don't want to invest on Windows?

Well, change your mind, we will install Ubuntu in your computer and let's discuss what things you need to take care before you start it.

What options available for me to install Ubuntu
Well, you can install it through CD-Rom or if your CD-Rom not working or you presently don't have it, you can install Ubuntu through your USB stick (is it not amazing to learn?).

How to prepare my CD-Rom for Ubuntu installation
Ubuntu home page itself is best guide to clearly explain it. Follow the link, in 2nd point, chose I would like to create : CD as option and To create it, I will use : Windows/Mac (chose which one you have running) operating system as options and click on Show me How.

How to prepare my USB stick for Ubuntu installation
Here also Ubuntu home page is best capable to explain you how. Follow the link, in 2nd point, chose I would like to create : USB stick as option and To create it, I will use : Windows/Mac (chose which one you have running) operating system as options and click on Show me How.

What about Installation
Well, I will not discuss all the steps here, it's all easy, even a level zero guy could do it. I will share a link, where it is beautifully explained Ubuntu installation with snapshots. Follow that >> HERE <<

Wait, what you should remember before installation
Believe me, most of the people will not go for installing OS because they afraid of data loss when doing partition. Well let me just say, Ubuntu installation is as easy as you install a software in your machine. If you are afraid too much, Ubuntu will install easily into your hard drive without asking for partition, without touching rest of the data. Let me clear some points about Linux - Ubuntu,

Everything is Files in Linux:
Yes, everything is file in Linux. The disk Partition in any OS is not physically dividing your hard disk into different parts, neither there exists a physical partition in your drive. Definitely, who ever used Windows, have been misguided about it. It is just a kind of record kept (in safe) as Boundary for different space in your disk. Once you keep storing data into the drive, OS takes care you just not cross that boundary.
So, today onwards, please think your Drive (Partition) as simple Directory (Folder: windows convention) with just a 'Storage Limit' as one extra property set to it. Any time you can Delete/Create/Format/Resize your drive as if you do it with Directory (Please take care your important data will not be lost before you do all above operations).
Keeping in mind, "partition is a directory", let's move on to Linux Partition (Linux Main Directories Structures). Here is the image for all major directories (partitions) in any Linux (including Ubuntu),
You can see, there is a "/" at the left hand side, which connects to many other directories on the right. That "/" is called ROOT of DIRECTORIES, where your directory structure just initiates. 
Don't get confused ROOT ("/") with another directory at the right side "/root/", both are different, I will tell you about that later. 
You might be surprised, how this directory structure relate to Partition of a disk? Simple, referring to image above,
ROOT ("/") is a big Directory (or Partition) and consider it occupies your full Hard Drive in size. 
Then, all other directories on right are also partitions inside your ROOT and total size they all occupy is what size of ROOT. Remember, you can manually define size for each partitions.
So if you have allotted complete Hard Drive for your ROOT, you can create all other directories (partitions) by giving them with each of them a better size limit. Else if you had plan to allot only some part of free space in your Hard Drive for Linux installation, ROOT will have a size of free space you allotted and inside ROOT all other partitions will occupy quite less space. I mean to say bigger the space you allocate for Linux installation, bigger will be your partition sizes; quite obvious, isn't it.
Now, let's look into child partitions on right hand side,
The /root/ directory you have seen at the right hand side is a 'User Specific' directory for Administrator. In Windows you might have seen there possible to create different users and one among them is Administrator also who is the master user in machine. The same Administrator is called "root" in Linux terminology. He will have all the access in his computer and what so ever you operate as 'root' will be reflected in /root/ directory. 
Then what about other users I create? Other users you create (like if I have created a user with name Kiran), they will allotted space at different Directory, that is under "/home/" directory (like /home/Kiran/). 
Well, now, /Kiran/ directory inside /home/ is not exactly a partition, it doesn't have size limit, but /home/ is a partition and it has size limit (So, obviously, if you have created only /Kiran/ directory under /home/ and if you keep storing data, you will be limited by /home/ partition size, since /Kiran/ can't carry data which exceeds it's parent size).
So, all are Directories in Linux, all have size limits and sub directories will carry only their parental size data.
You can specify Partition (Directory) Size while installing Linux:
Yes, you can manually specify what size your ROOT and other Directories (partitions) will follow. While installing, in "Allocate Drive Space" screen, choose "Specify Partitions Manually (Advanced)" option. 
I will explain here what method I follow normally, it is not mandatory you should follow same. And I will introduce one special partition called "Swap" in between my discussion, (which you have not seen in above directory structure image), for that you should have information about what is your computer RAM size in terms of GB?
Let me take an example and explain. Consider, you have 15GB free space, which you want to allocate it for Linux installation; or you can consider your Hard Drive size itself is 15GB, which you use for Linux installation. Let's jump to partition making process in Linux installation. 
While partitioning your 15GB, you can specify 
[*] "Partition Size" in terms of MB (1GB = 1024MB), 
[*] its "File System Type" (like ext2, ext3, ext4...) and 
[*] its "Mount Point".
where 'File System Type' is a partition type, just like what you choose FAT32 or NTFS in Windows, it's ext2 or ext3 or ext4 etc here in Linux; 
and Mount Point is exactly the Directory structure (ROOT or /home/ or /boot/ or /bin/ or /root/ etc) what you are specifying.
Now, let's divide out of 15GB,
[step A]. Create 2GB, ext2 partition type. However, "Ext2" is not mandatory. Mount it for /boot/ directory. So 15GB - 2GB = 13GB left.
[step B]. Create One and Half times or Two times your RAM size Swap partition. That is, if your RAM size is 512MB, then its two times, create 1GB Swap partition. Remember, there is No Mount point for Swap partitions, hence it's not shown under ROOT. Swap partitions helps to hold memory pages that are inactive in RAM (read more about Swap).  So now, 13GB - 1GB = 12GB left.
[step C]. Create 5GB, ext4 partition type. Mount it for /usr/. In general, this /usr/ directory is where Linux will install many of the softwares and packages. So you can choose, if you are not installing much of the softwares or games in your Linux, make partition size less. But I have taken it as 5GB in my example, so 12GB - 5GB = 7GB left.
[step D]. Create rest all 7GB space, ext4 type partition. Mount it for "/" (ROOT).
I know you are confused at this step, where all other partitions gone? Don't worry, Linux will automatically create them for you under ROOT. I know you have question, where did I specify other directory's size? Don't worry, Linux has calculated their size and allocated. 
What happened in overall is, ROOT ("/") is total 14GB (except Swap 1GB), under which lies /boot/ of 2GB, the /usr/ of 5GB and rest of 7GB will be shared by Linux to different directories according to their priority and usage. Remember, if you are still not satisfied, you want to manually allocate size for each and every directory under ROOT, you can go ahead and do it. Follow the "step C" and mention Partition Size and Mount Point for each directory you wish to create. Probably, you may wish to refer link, Linux Filesystem Structure or may be this or may be this.
Well that's all about pre installation tips you need to keep in mind. If you still facing difficulty in installation, don't worry, just start the installation and in Allocate drive space screen just choose "Install alongside other operating systems" and move further; Ubuntu will take care of it all and will get install successfully side by side to your Windows, without harming any stuffs in your machine.

Hope you enjoyed.