Packages, Ubuntu counterparts of Gentoo's useful commands - linux

Trying to learn how to work with packages in Ubuntu (and have Gentoo experience). This command is already known:
(1) sudo apt-get install pkgname
Looking for counterparts of these:
(2) emerge -s pkgname
(3) equery files pkgname
(4) equery belongs filename
(5) cat /var/lib/portage world
Which useful (console) package commands do you use in Ubuntu? Links to Ubuntu packages tutorial in style of Gentoo's Handbook?

This would be the equivalent commands in Ubuntu:
apt-cache search package
dpkg -L package
dpkg -S filename
aptitude search ~n.*

This question is better suited for superuser.com or https://askubuntu.com/.
Anyway, I haven't used Gentoo's tools, but I think this Debian guide on package management is quite complete and you'll find the equivalents.
Some examples on apt-get:
apt-cache search package queries the repo for package.
apt-cache show package displays info on a certain package (dependencies and such).

Ubuntu Hacks/Package Management - Manage Packages From the Command Line
Debian Reference - Basic package management tools: apt-get / apt-cache and aptitude.

Related

from where rpm query search and from where yum list search

I did rpm -qa and didn't found the package but when when I did yum list I found the package. why so and which command is useful in finding the installed packages in Linux?
I personally don't use yum or rpm to handle package management on my machine (running Debian 10 currently with XFCE) but I use the command apt list --installed to check my installed packages. Then you can grep for whatever specific stuff you are looking for.
You could also check out this article. It's well written and has a lot of good info.
https://itsfoss.com/list-installed-packages-ubuntu/

Linux: How to install certain old version of a software via apt-get

I am trying to install the same versions of Apache, MySQL and PHP in my Linux PC (Raspberry Debian) as installed in my remote public server.
For instance, I'd like to install the last legacy release of the 2.2 branch, Apache/2.2.31.
apt-cache showpkg apache2
Output:
Package: apache2
Versions:
2.4.10-10+deb8u4 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_jessie_main_binary-armhf_Packages)
But there isn't any information about the 2.2.31 version, neither in "Reverse Provides" section. I can do it by compiling from the sources, but it takes a lot of time. And I tried to find a reliable PPA or a reliable sources for deb packages, without any success.
How can I do it?
If APT tracks the specific version you are looking for, (like Kyle said) then it's pretty easy.
sudo apt-get install <pkg_name>=<pkg_version>
or
sudo apt-get -t=<target_version> <pkg_name>
To see which packages are tracked, run
apt-cache showpkg <package_name>
Unfortunately though, if a particular version is not managed by the APT, then you are out of luck using APT. It might be managed by some of the other package managers out there.
Ref. How can I downgrade a package via apt-get?
If you have the version number, or the target release, apt-get supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from a terminal by typing man apt-get.
sudo apt-get install <package-name>=<package-version-number>
or
sudo apt-get -t=<target release> install <package-name>

apt-get for Cygwin?

Is there any apt-get-like program for use with Cygwin?
I already tried cyg-apt but when I try I get this error:
cyg-apt: downloading: http://cygwin.mirrors.pair.com/setup-2.bz2
cyg-apt: downloading: http://cygwin.mirrors.pair.com/setup-2.ini
cyg-apt: bad URL http://cygwin.mirrors.pair.com/setup-2.ini, exiting.
Best I have ever used:
apt-cyg package manager
You can do this using Cygwin’s setup.exe from Windows command line. Example:
cd C:\cygwin64
setup-x86_64 -q -P wget,tar,gawk,bzip2,subversion,vim
For a more convenient installer, you may want to use the
apt-cyg package manager. Its syntax is
similar to apt-get, which is a plus. For this, follow the above steps and then
use Cygwin Bash for the following steps:
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
Now that apt-cyg is installed. Here are a few examples of installing some
packages:
apt-cyg install nano
apt-cyg install git
apt-cyg install ca-certificates
Update: you can read the more complex answer, which contains more methods and information.
There exists a couple of scripts, which can be used as simple package managers. But as far as I know, none of them allows you to upgrade packages, because it’s not an easy task on Windows since there is not possible to overwrite files in use. So you have to close all Cygwin instances first and then you can use Cygwin’s native setup.exe (which itself does the upgrade via “replace after reboot” method, when files are in use).
apt-cyg
The best one for me. Simply because it’s one of the most recent. It works correctly for both platforms - x86 and x86_64. There exists a lot of forks with some additional features. For example the kou1okada fork is one of improved versions.
Cygwin’s setup.exe
It has also command line mode. Moreover it allows you to upgrade all installed packages at once.
setup.exe-x86_64.exe -q --packages=bash,vim
Example use:
setup.exe-x86_64.exe -q --packages="bash,vim"
You can create an alias for easier use, for example:
alias cyg-get="/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P"
Then you can for example install the Vim package with:
cyg-get vim
you can always make a bash alias to setup*.exe files in $home/.bashrc
cygwin 32bit
alias cyg-get="/cygdrive/c/cygwin/setup-x86.exe -q -P"
cygwin 64bit
alias cyg-get="/cygdrive/c/cygwin64/setup-x86_64.exe -q -P"
now you can install packages with
cyg-get <package>
This got it working for me:
curl https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg > \
apt-cyg && install apt-cyg /bin
No. The only officially supported tool for downloading and updating Cygwin packages is the setup.exe file you used for the initial install, although that can be invoked with command line arguments to help the process.
From that same page:
The basic reason for not having a more full-featured package manager is that such a program would need full access to all of Cygwin's POSIX functionality. That is, however, difficult to provide in a Cygwin-free environment, such as exists on first installation. Additionally, Windows does not easily allow overwriting of in-use executables so installing a new version of the Cygwin DLL while a package manager is using the DLL is problematic.
You can use Chocolatey to install cyg-get and then install your packages with it.
For example:
choco install cyg-get
Then:
cyg-get install my-package

What command should I use in finding the latest version of libgtk in linux

I need to install libgtk in Ubuntu linux.
I tried to use "sudo apt-get install libgtk", but the answer is that libgtk can't be found in the libgtk package.
How can I use a Linux command to find the latest version of libgtk?
If you're looking to FIND a gtk that's already installed on your box, try locate libgtk (if you have gnu slocate installed and running) or find / -name "libgtk*.so*" and be prepared to wait a while.
The suggestion to search using aptitude search or apt-cache search will probably do what you need if you're trying to determine how to INSTALL libgtk. Chances are you should have run sudo apt-get install libgtk2.0-dev.
You can use
aptitude search libgtk
or
apt-cache search libgtk
to search for package names containing libgtk. Availability of aptitude depends on Ubuntu version, but it can be easily installed by apt-get if not found; apt-cache is probably always available.
Which libgtk package you need can't really be decided by the information you provide, so please clarify if you need further help.

Is there a tool for finding out what packages provide a file?

For example, if ./configure or Make tells me I'm lacking libX11.so.6, and it's nowhere on my system, is there a tool or website into which I could type
libX11.so.6
followed by a distribution/arch and get back
libx11-6
libx11-6-debug [or whatever; asking README would probably return reams of entries]
http://sysinf0.klabs.be/ does something similar for some distributions and architectures, but it doesn't seem to have more recent distributions. Also, they don't have an entry for the filename so you need to Google "packagename site:sysinf0.klabs.be".
I'm most interested in Ubuntu, but it would be good to know about similar tools for other distributions as well.
Debian does that via the website:
search the Packages page under Search contents of packages
the answer in this example
options selected where 'packages that contain files whose name contain the keyword' for the unstable distribution (as it is the largest) on 'any' architecture
Ubuntu probably does something similar but I don't know the website / launchpad that well.
You could also fetch the index file ftp://ftp.us.debian.org/debian/dists/sid/Contents-i386.gz but as it changes frequently the website option is probably more convenient.
$ sudo apt-get install apt-file
$ sudo apt-file update
$ apt-file search libX11.so.6
apt-file will let you list and search the contents of packages whether or not they are installed on your system.
$ sudo apt-get install auto-apt
$ sudo auto-apt update
$ sudo auto-apt updatedb
$ sudo auto-apt update-local
$ auto-apt run ./configure
For even more automation, auto-apt will detect attempts to access non-existent files and automatically prompt you to install the packages providing those files.
There is many other tools to do this
check this great page for this : http://www.debianhelp.co.uk/findfile.htm
It is for debian or Ubuntu
If you have a file on your machine, and you want to know which package is responsible for it, then (on Debian & Ubuntu) it's...
$ dpkg -S FILENAME

Resources