Getting to Know Linux: Installing From Command Line - gHacks Tech News

Getting to Know Linux: Installing From Command Line

For users new to the Linux operating system, nothing beats installing applications with the graphical Add/Remove Software applications found in the main menu of your desktop. But sometimes that ever-so-user-friendly GUI isn't an option. Once such instance would be a headless server with no graphical desktop. Or maybe you've found a particular applicaiton that is only offered as a source package. For these you are going to have to know your way around command line installation.

In this article I am going to show you the basics of some of the more popular package management systems as well as the basics of installing via source. I will not spend too much time on each (otherwise this article could grow rather overwhelming). By the end of this article you should know how to install, querey, and remove applications with the more popular tools.

Source

Let's start from the source. Generally when you download a package for installation that ends with tgz, gz, bz2, or *zip this will be a source installation. For these installations you are going to take advantage of some powerful compilation tools. But before you can start the compilation you have to unpack the source directory. If your file ends with a "bz2" you will first have to ucompress the file will the command bunzip2 APPLICATION.tar.bz2. This will result in a new file like APPLICATION.tar. Tar is an archive system that rolls up directories into a file. To unpack the directory you would issue a command similar to tar xvf APPLICATION.tar. Unpacking the directory would then result in a directory (in our example) APPLICATION.

If the downloaded file ended in tgz or gz then you have a compressed archive and you simply have to add the "z" switch to the tar command to both uncompress and unpack the archive. This command would look like tar xvfz APPLICATION.tgz, which would result in the directory APPLICATION.

Once you have your directory unpacked you need to change into that directory (with the command cd APPLICATION). Once inside this directory issue the ls command. You will most likely see either a README file or an INSTALL file. Open those up and see if there are any special instructions for installation. If there are no special instructions then the standard compilation steps will most likely work. Here's how this works:

  • su to the root user
  • From within the APPLICATION directory issue the command ./configure. This will generate a make file for the compilation.
  • Issue the command make.
  • Issue the command make install

That's it. If all went as planned, the application should be installed.

RPM

RPM is the Red Hat Package Manager. Installing via RPM is actually quite simple. Here's how this works. Once you have downloaded the rpm file you want to install, open up a terminal window and issue the following commands:

  • su (you will be prompted to enter the root password)
  • rpm -ivh filename.rpm (where filename is the actual name of the file you downloaded)

That's it. If all went well your package should now be installed.

If you want to make sure your package was installed you can issue the command rpm -q filename and you should see the name of the package and the version that is installed.

If you want to remove that package you just installed (or another package) issue the command:

rpm -e filename

and the package will disappear.

APT-GET

This is one of the best installation systems available. With apt-get you do not have to download a package, you just have to know the name. Here's how apt-get works (I am going to assume Ubuntu is the distribution, so you'll make use of sudo). Open up a terminal window and issue the following:

sudo apt-get install package_name

to install the needed package.

To remove a package with apt-get you would issue the command:

sudo apt-get remove package_name

to remove the package from your system.

URPMI

The urpmi system is from the Mandriva distribution and is similar to apt-get. To install a package with urpmi you would open up a terminal window, become the root user, and issue the following command:

urpmi package_name

to install the needed package.

To remove a package with this system you would issue the command:

urpme package_name

and the package will be removed.

DPKG

This is the Debian installer and is as easy to use as any other. To use dpkg you will open up a terminal window and issue the following command to install a package:

sudo dpkg -i package_name

to install a package.

To remove a package issue the command:

sudo dpkg -r package_name

and the package will be gone.

Final Thoughts

There you go. A very basic description of package management with the more popular tools. Yes, there is much, much more to them than what you have just read, but this will give you enough of a foundation to get you going

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Comments

  1. RG said on January 16, 2009 at 8:02 pm
    Reply

    Thank you jack, very educational

  2. gokudomatic said on January 16, 2009 at 8:31 pm
    Reply

    and where is the yummy yum from Fedora?

  3. Paul. said on January 16, 2009 at 10:15 pm
    Reply

    Pfff. Great christal clear artikel again Jack.
    Thanks a lot. When you keep them comming, i prommise i wil keep reading them.

  4. jack said on January 16, 2009 at 11:15 pm
    Reply

    gokudomatic: you are correct. i left out yum. here’s the gist of yum:

    install

    yum install package_name

    remove the package:

    yum remove package_name

    simple as pie.

  5. gokudomatic said on January 17, 2009 at 2:20 am
    Reply

    thanks, jack.
    guys, you’re now ready to leave windows.

    just kiddin’

  6. iampriteshdesai said on January 17, 2009 at 7:58 am
    Reply

    It would have been very useful, had I read it but I guess for the time being I’m happy with Synaptic.

  7. Michele said on January 19, 2009 at 4:50 pm
    Reply

    Actually, it is required to be root only for issuing the ‘make install’ command.

  8. newbie said on July 10, 2009 at 8:18 pm
    Reply

    http://unetbootin.sourceforge.net/ linux file downloaded

    I downloaded a bin file and it is currently located in :
    /home/eddy/Desktop/july2009/unetbootin-linux-356

    How do you install it??????

    I tried creating a launcher on desktop but that didn’t work (no such file)
    Tried to copy to /bin directory and said (no permission)
    Tried to run through command line sudo like above and said
    something like no child dependencies found?

    Are some bin files zipped???

    In windows you just click and something installs. I would love to drop windows but
    but without decent help files it is hard to do

    I am trying to install that so I can create some new usb boots for a netbook.
    The netbook doesn’t have cd so I read with with that program you can create a
    boot usb directly from an iso file on the hard drive

    Once things are setup I would like to make an iso of my system and burn to dvd
    so if something goes wrong I can reinstall from it instead of having to download
    all the updates again, something I hate in windows. It takes days on a dialup
    connection.

    A simple step by step for installing from the current directory listed above
    would be greatly appreciated. Just pretend like I have never heard of linux
    and include every detail. Perhaps there is even a command line from terminal
    that would be easy to do. Multiple install options would be fine as I enjoy learning
    new things… :)

    I’ll bookmark this page and check back later. Thanks in advance for your help.

  9. newbie said on July 16, 2009 at 5:58 pm
    Reply

    Wow…still no answer to my question. The linux community sure isn’t very helpful. I guess I will
    just continue to use Windows as main and recommend all those I meet to also continue using
    windows as they won’t get any help on Linux if needed… ;(
    I see no need to ever return to this site again.

    1. brian said on March 7, 2014 at 9:22 pm
      Reply

      go to the folder containing the .bin file ‘(.bin file is a ‘binary file’ and as such would have been compiled and is unlikely to be crossplatform. but correct me if im wrong on this.)
      from command line type sh name_of_file.bin
      if you get permission errors, run it as root. or change .bin files permission.
      if you get other errors there is somthing wrong with the file. In that case you could try compiling it from sorce.
      best to see if you linux distribution already has the .bin file you are trying to run in its repository. Then use package manager to install and run it.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.