How do I install a .deb file via the command line?
Packages are manually installed via the dpkg command (Debian Package Management System). dpkg is the backend to commands like apt-get and aptitude , which in turn are the backend for GUI install apps like the Software Center and Synaptic.
Something along the lines of:
dpkg —> apt-get , aptitude —> Synaptic, Software Center
But of course the easiest ways to install a package would be, first, the GUI apps (Synaptic, Software Center, etc..), followed by the terminal commands apt-get and aptitude that add a very nice user friendly approach to the backend dpkg, including but not limited to packaged dependencies, control over what is installed, needs update, not installed, broken packages, etc.. Lastly the dpkg command which is the base for all of them.
Since dpkg is the base, you can use it to install packaged directly from the command line.
Install a package
For example if the package file is called askubuntu_2.0.deb then you should do sudo dpkg -i askubuntu_2.0.deb . If dpkg reports an error due to dependency problems, you can run sudo apt-get install -f to download the missing dependencies and configure everything. If that reports an error, you’ll have to sort out the dependencies yourself by following for example How do I resolve unmet dependencies after adding a PPA?.
Remove a package
For example if the package is called askubuntu then you should do sudo dpkg -r askubuntu .
Reconfigure an existing package
sudo dpkg-reconfigure PACKAGE_NAME
This is useful when you need to reconfigure something related to said package. Some useful examples it the keyboard-configuration when you want to enable the Ctrl + Alt + Backspace in order to reset the X server, so you would the following:
sudo dpkg-reconfigure keyboard-configuration
Another great one is when you need to set the Timezone for a server or your local testing computer, so you use use the tzdata package:
sudo dpkg-reconfigure tzdata
How to Run an INSTALL.sh Script on Linux in 4 Easy Steps
This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
The wikiHow Tech Team also followed the article’s instructions and verified that they work.
This article has been viewed 458,223 times.
Did you download Linux software that came with an install.sh file? Install.sh is a simple text-based shell script that makes it easy to install software. To use an install.sh script, you’ll first need to make it executable using chmod +x install.sh. Then, you can execute the script in a terminal with the command ./install.sh or sudo ./install.sh. This wikiHow guide will walk you through executing an install.sh file from the Linux command line using Ubuntu, Debian, and any other version of Linux.
- To make install.sh file executable, use the command chmod +x install.sh.
- To execute the script, run the command ./install.sh.
- Depending on permissions, you may need to start each command with sudo to gain superuser (root) access.
- Before installing software, make sure to check the README or INSTALL file that came in your download for specific instructions and installation options.
- If the file you downloaded is compressed into a TGZ or TAR.GZ archive, be sure to unpack the files first.
- You can extract a TGZ or TAR.GZ file using the command tar -xzvf filename.tgz .
- To make sure you’re in the right directory, type ls -a and press Enter. You should see your install.sh file, as well as all other files in the directory.
- If you’re unable to change the permissions, you’ll need root access. Instead, run sudo chmod +x install.sh and press Enter.
- If you don’t see an error, you’ll know the install script is now executable.
- You can also use the command sudo bash install.sh or sudo sh install.sh to run the script.
- If you’re just installing the software in your own home directory and don’t need root permissions, you can use omit sudo and use ./install.sh instead.
- Depending on the script and app you’re installing, you may be prompted to complete additional steps to install the software.
Community Q&A
Enter these commands into the terminal: cd /location of file/. For example, /home/username/Documents./name_of_file.extension. Replace these with the name of the file/program and the extension (commonly .desktop in Linux or .exe (executable) or .sh (script). Make sure the file/program is marked as executable in its properties.
Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow
I typed: chmod +x install.sh but the output is chmod: cannot access ‘install.sh’: No such file or directory.
This means that there is no install.sh file. Linux is case-sensitive, so if you type the file name as install.sh, it won’t find a file that is named, for example, INSTALL.sh. Also check for typos, like typing isntall.sh instead of install.sh. Try typing ls to list all files in the current directory. If the install.sh file is not in the current directory, you need to change into the directory with that file using the cd command.
Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow
I want my (.sh) files to be executable by 1 word like «test» without commanding «./test.sh | bash test.sh». How to do that?
If that’s a program that someone else wrote, you can usually run «sudo make install» to install it, and then it will be possible to just type the program name. If it is a script that you wrote yourself, do the following: Add the line «#!/bin/bash» (without the quotation marks) to the beginning of the script file. Rename the file to not have «.sh» at the end, for example «test.sh» to just «test». Finally, move your file to the «/usr/bin» directory. Then, you can just type the word (in this example, «test») to execute the script. Also, when working from the Linux bash shell, you don’t need to type the » | bash test.sh» part, you can just write «./test.sh».
Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow
I’ve downloaded a .sh file — how do I install this?
I’m new to Ubuntu and know installing programs only from window. It is very easy there: Just double-click the setup.exe and the things start. But how do I install a program on Ubuntu? I want to install something which I couldn’t find in the Ubuntu Software Center. I downloaded a .sh file and now I don’t know what to do with it.
Thank you for your answer, but I want to install something which I couldn’t find in the Ubuntu Software Center. I downloaded a .sh file and now I don’t know what to do with it 🙂 Oh my god, what a stupid question 😉
general advice is not to install random stuff from the internet — its the quickest way to get into all sorts of trouble 🙂
it’s no «random stuff from the internet» I want to install, it’s just netbeans 😉 I think I have to learn much 🙂 Thank you for your help!
. also add what version of ubuntu you have installed — i’ve also found this question — does this help you? askubuntu.com/questions/21561/how-to-install-jdk-and-netbeans
4 Answers 4
First you might need to give the .sh file permission to execute. chmod +x file.sh , then you can execute it with ./file.sh .
You can also right-click on the file, select Properties, then select Permissions and then select ‘Allow executing file as program’. Then you double-click the file and select ‘Run in Terminal’ or ‘Run’.
An .sh file in Ubuntu is pretty much the same as a .bat or .wsh file is in Windows. What the program does, or how it works, is completely up to the developer. It is not possible to answer «how to install an .sh-file», except to say «read the README».
It’s poor practice to provide such programs. You should always look for .deb files, which is roughly comparable to .msi files in Windows, I believe. That is, you’ll double click it, and it’ll get installed.
It’s why we’re here. 🙂 The key thing to understand is that this doesn’t have anything to do with the operating system. It’s about how the developers of an app chooses to make it available. Unfortunately, some companies are lazy when it comes to Linux. They think «oh, Linux users are experts, so we don’t need to make our programs user friendly». They are wrong, because experts and geeks are the laziest people of them all. If anyone wants user-friendly, we do. The developers of NetBeans obviously do not care about Ubuntu. That will change very soon, or NetBeans will be forgotten.
You can the file permission via the command line console in your Ubuntu.
Open a Terminal Window and type:
chmod 777 downloaded_file.sh
After you changed the file attribute, you can execute those file directly via terminal window or click it when you use file manager. Your installation file should be working now.