How to programmatically detect package and OS releases on Ubuntu - linux

From bash, what commands would I run to get a boolean value that indicates whether or not there are available package updates or operating system upgrades in Ubuntu?
I know how to run apt-get upgrade and apt-get dist-upgrade to actually perform the upgrades, but I can't find any easy way to detect when these options are available without using the --simulate argument and trying to parse stdout.

The command:
aptitude search '~U'
will list all available package updates. You can customize the output format with the -F option; see the manual for details on how.
I'm not aware of any direct equivalent for Ubuntu release updates.
(Relatedly, though, apt-get dist-upgrade does not upgrade to a newer release. It's the same concept as upgrade, just a little more aggressive about dealing with changing dependencies.)

Rephrasing my question in Google lead me to this answer that lists the command simply as:
/usr/lib/update-notifier/apt-check

Related

Remove individual Wine packages Ubuntu 15.04

I use Ubuntu 15.04.
I wanted to install PSpice, but I needed a program that would run .exe; I found out about Wine, and so tried to install it like this:
sudo apt-get install wine
Everything was working fine, I watched it download and install a TON of packages. However, a screen popped up asking for agreement to Eula software terms. There was no way to accept, so I had to end the process by closing the terminal with the "x" button (which locked up dpkg).
I removed the lock file from /var/lib/apt/lists and /var/cache/apt/archives, and killed the process that had locked dpkg (am I phrasing that correctly?).
So now, the ship is running smoothly, but I want to remove all of the packages that are associated with Wine.
I tried:
sudo apt-get --purge remove wine
I got a message saying "wine not installed".
There must be some way to identify all the packages in /var/cache/apt/archives that are directly associated with Wine, and subsequently remove them.
I'm relatively new to this, please be EXTRA thorough in your help.
First, your system runs fine, wine doesn't exist on it any more, so there isn't too many to do. What I understand you actually want an afterparty cleanup after your wine try.
Wine hasn't too many dependent packages and they don't harm too many. In similar cases, if there is a large software system from a lot of packages, there is a common package on which all of them depends. For example, in case of X it is x11-common, removing it with apt-get --purge remove cleans up your whole system from the X entirely. You can find this by calling some dpkg -s on some packages recursively, and see where is this "common denominator".
But in the case of wine it isn't the case, wine depends only on some libs. Your system now works, maybe the recursive removal of ~/.wine would be useful (here are all of your wine settings, even your virtual C:).
apt-get --purge autoremove removes all of your packages which were installed as a dependency (thus, not directly by apt-get install), and whose original package doesn't exist any more.
deporphan is also a useful tool, it finds packages who aren't dependency of anything and seem seamlessly uninstallable.
dpkg -l|grep wine shows every package whose name or short description contains the wine string, maybe some wine-common or similar package does exist yet.
sudo apt-get remove --autoremove wine-stable wine-stable-amd64
use this command to remove wine completely

how to update make 3.81 linux

I am new to Linux (new as in installed it yesterday), I need it for my programming course in the university and I've been told to install specific versions of specific programs, but though I've used apt-get install to install them (having previously done apt-get update) they aren't in the correct version.
The programs that I need are make 4.0 and valgrind 3.10.1.
apt-get installs make 3.81 and valgrind 3.10.0.SVN.
I have tried typing "apt-get install make4.0" and "apt-get install valgrind10.3.1" to no avail. I have downloaded them from the internet and followed what instructions I could understand to install the newer versions but it keeps saying that I have the older ones. (I'm not sure if I can post direct links here, if I can let me know and I'll post where I got them from).
What have I been doing wrong? How can I fix this?
I am currently running Linux Mint.
Thanks for any answer in advance.
Due to a long-standing unresolved Debian bug report, GNU Make remained the age-old 3.81 in Debian for a very long time, and as a consequence, in Debian-based distributions such as Ubuntu and Mint.
The latest Debian release, Jessie, has upgraded to 4.0, so Debian-based distributions will have that upgrade. However, it is better to use 4.1.
This has been discussed many times on the GNU Make mailing list and elsewhere.
So to get a newer version, you must compile it from scratch.
This is easy:
Install the required packages (gcc, make and such).
Open up a shell (if you're using the GUI, a terminal window).
Type the following commands (or something equivalent, e.g. you can use curl instead of wget):
cd /tmp
wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz
tar xvf make-4.1.tar.gz
cd make-4.1/
./configure
make
sudo make install
cd ..
rm -rf make-4.1.tar.gz make-4.1
Now, make 4.1 is in /usr/local/bin/make.
You can verify it is there with whereis make.
You can make it your default make by prefixing /usr/local/bin to your $PATH variable in your shell startup file; for instance, in .profile or .bashrc if you use the bash shell.
Don't try to install a self-compiled make (or anything else that doesn't come from the distribution's package manager) into /bin or /usr/bin; doing that will confuse your package manager.

apt-get update and apt-get upgrade in Chef

If package "nginx" in Chef gets translated into apt-get install nginx on an Ubuntu node, what can be written in a Chef recipe that would translate into:
apt-get -y update
apt-get -y upgrade
Couldn't figure out from the apt cookbook.
The Opscode "apt" cookbook's default recipe will run apt-get update to ensure that the package cache is updated. We recommend putting that early in your node's run list so later on packages can be installed with the correct versions.
We generally don't recommend that users use "apt-get upgrade" in a recipe, for a couple reasons.
apt-get may upgrade a package that has conflicting configuration or other issues that cannot be resolved without running the command again, or running other apt/dpkg commands manually.
Automated upgrades of all packages on the system can have unintended side effects on the running system (the edge cases are many and possibly thorny, so I can't cover them all).
Instead, use the "upgrade" action for packages that should always update to the latest version.
package "nginx" do
action :upgrade
end
If you're reusing a cookbook that defines the cookbook, you can write a recipe that modifies the action of the existing resource, like this:
resources("package[nginx]").action(:upgrade)
The #resources method in a recipe will look up in the Resource Collection the specified resource (package nginx). Then sending the #action method with the argument :upgrade will tell Chef that the action should be to upgrade.
Edit Update: Do be careful when choosing packages that would be upgraded automatically in this way. An upstream change in a package can cause detrimental effects on the system. This is especially true if such a package does a restart of services it manages during the post installation scripts. Know your infrastructure, and if in doubt run your own package repository that has the critical packages you need for the application stack.
The Apt chef recipe will not update with every chef run. The attribute which controls this is called periodic_update_min_delay and is set to 86400 (The attribute should be called sec_delay). If the following file exists and is older than 24 hours apt will update the cache.
/var/lib/apt/periodic/update-success-stamp
It also appears that the apt recipe (default.rb) includes a directive to force an update which your recipe could call.
# For other recipes to call to force an update
execute 'apt-get update' do
If you're doing that though, you'll want a not_if to avoid running it too often at which point you might as well call it manually yourself. I got sick of messing with this and ended up just calling apt-get update in a stanza before my install.
execute "apt-get-update" do
command "apt-get update"
end
I suspect the long-term solution for security updates is to set update delay to a few hours.

Install Gnome without using yum on centos 4

I'm using CentOS 4.8 , i386.
I would appreciate if any one can help me to install Gnome (or any other GUI) while there is no yum available.
I tried to install yum but since It's a company's server with many things installed on it,
I faced with many problems.
However I decided to find a way to install Gnome without using yum
And please take note:
I'm a neophyte!
Did you try getting the source-code and building it manually?
You can get the code from
http://www.gnome.org/getting-gnome/
GNOME also provides a build tool to make the installation easier.
But, as it has already been pointed out - Servers are best managed over command line. It will give you more power and control over what you are doing.

Installing cassandra in ubuntu?

I have already installed cassandra in ubuntu using with wiki
Problem is I have no control over which version to install and upgrade to in feature.
I am want to be able to install specific version not just latest, because i have a machine running 0.6.2 now i want a another node and i want to install 0.6.2.
How can i install debian package for specific version instead of latest one?
for installing a specific version of cassandra you can do something like this:
in this case i want to install cassandra 1.2.8
sudo apt-get clean
sudo apt-get update
sudo apt-get install cassandra=1.2.8
The best way to do something like this, that I have found so far is pinning. This is a little inconvenient at the moment because you have to manually create the pinning preferences (and change them if necessary). Also, the pinning will not work with aptitude in case you use this.
Another example is the pinning I have done for php here. However, you have to make sure that whatever version you want to have is available in the repos/ppas that you have configured in your sources.list (sources.list.d).

Resources