Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, January 22, 2018

How to Install a Local .deb File in Ubuntu (Like a Pro)

So, you've downloaded a .deb file and you're wondering: "What next?"

Let’s break it down.

When you install software using apt, Ubuntu performs two main actions:

  1. Resolves dependencies from the online repositories.

  2. Uses dpkg under the hood to install the actual packages.

However, when you're working with a local .deb file, the process changes slightly. Here's how you can install it properly depending on your setup.


Option 1: Install Using dpkg and Fix Dependencies

bash

sudo dpkg -i /path/to/package.deb sudo apt-get install -f
  • dpkg -i: Installs the .deb file

  • apt-get install -f: Attempts to fix any missing dependencies

This approach is manual but gives you control over the install and resolution process.


Option 2: Install Directly with apt (Recommended for Ubuntu 16.04+)

bash

sudo apt install ./package-name.deb

You can also provide the full path if the file isn't in the current directory:

bash

sudo apt install /home/sangram/Downloads/xyz.deb

Why this method is preferred:

  • Automatically resolves and installs dependencies.

  • Cleaner and more robust for modern Ubuntu versions.


Option 3: Use gdebi for a GUI-Based Install

Install the gdebi tool first:

bash

sudo apt install gdebi

Then:

  1. Right-click your .deb file.

  2. Choose “Open with GDebi Package Installer.”

GDebi Advantages:

  • Graphical interface.

  • Automatically checks and resolves dependencies.

  • Ideal for users who prefer not to use the terminal.


Extra Tip: Manual Installation for Older Systems

On some older systems where apt install doesn’t support local files, you can move the .deb file manually:

bash

sudo mv yourfile.deb /var/cache/apt/archives/

Then:

bash

cd /var/cache/apt/archives/ sudo apt-get install yourfile.deb

This mimics how apt handles package files internally.


A Word About Dependencies

All of these methods rely on the APT package index, defined in the following configuration files:

  • /etc/apt/sources.list

  • /etc/apt/sources.list.d/

If your system is unable to resolve dependencies, the installation will fail. To avoid issues, always make sure your repository list is up to date:

bash

sudo apt update

Source

Originally inspired by a helpful StackExchange post

Wednesday, October 26, 2016

How to Create a Text File for Multiple Software Installations on Linux

Hello everyone,

Today, I'll show you a simple way to automate the installation of multiple software packages on a newly installed Linux system — by using a text file and a shell script.

If you've just installed a Linux distribution, especially Fedora or Ubuntu-based, you might find it time-consuming to install all your essential tools one by one. Let's solve that with a batch installation script.


Step 1: Create a .txt or .sh File

Open any text editor and create a file named example.txt (or better, example.sh if you're writing a shell script).

Paste the following commands into the file:

bash

# Update system sudo dnf -y update echo "================================================================" echo " Update Successfully Installed " echo "================================================================" # Install Google Chrome wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm sudo dnf -y install ./google-chrome-stable_current_x86_64.rpm echo "================================================================" echo " Chrome Successfully Installed " echo "================================================================" # Install Vim sudo dnf -y install vim echo "================================================================" echo " Vim Successfully Installed " echo "================================================================" # Install VLC Media Player sudo dnf -y install vlc echo "================================================================" echo " VLC Player Successfully Installed " echo "================================================================" # Install Skype sudo dnf -y install skype echo "================================================================" echo " Skype Successfully Installed " echo "================================================================" # Install Atom Editor (if available in repo or via RPM) sudo dnf -y install atom echo "================================================================" echo " Atom Successfully Installed " echo "================================================================" # Install Aptitude (for Debian-based systems only) # You can skip this if you're on Fedora sudo apt-get -y install aptitude echo "================================================================" echo " Aptitude Successfully Installed " echo "================================================================"

⚠️ Note: The commands above are primarily for Fedora (dnf). If you're on Ubuntu or Debian-based systems, replace dnf with apt.


Step 2: Save the File

Save the file as example.sh (recommended since it's a shell script, not just plain text).


Step 3: Make the Script Executable

Now, open your terminal and run the following command to make the script executable:

bash

chmod 744 example.sh

This sets the file permissions so that:

  • You (the file owner) can read, write, and execute the script.

  • Others can only read it.


Step 4: Run the Script

Execute the script by running:

bash

./example.sh

This will start installing all the listed software, one by one, automatically.


Final Notes

  • Make sure your internet connection is active.

  • You may need to enter your password when prompted by sudo.

  • You can always add or remove software commands to suit your preferences.


Summary

Using a script file for software installation saves time and ensures consistency every time you set up a new system.

Let me know if you'd like a follow-up post on writing cross-platform install scripts for both Ubuntu and Fedora systems.