How to Install an older version of php using apt-get? - linux

I have this older package in this exact version that I want to install on Ubuntu.
https://launchpad.net/ubuntu/+source/php5/5.3.10-1ubuntu3.20
How can I install it using apt-get ? Thank you

For those looking for an earlier version of php 7.
List all php 7 versions:
apt-cache policy php7.*
Specify and install a specific php 7 version, in example 7.4.3:
sudo apt install php7.4-fpm=7.4.3-4ubuntu2.2
^ ^
| |
(left) pkgname / (right) version part

to find out what different versions of a package is available in the enabled repository
apt-cache policy <package-name>
in your case
apt-cache policy php5
select the version that you want to install and then type
sudo apt-get install pkgname=version
in your case
sudo apt-get install php5=5.3.10-1ubuntu3.20
before running any of the above commands, it is better to update the apt-cache first. To do it, run
sudo apt-get update

Try:
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install phpX.Y # E.g. 7.4
Source: How to Install PHP 7.4 on Ubuntu 20.04 LTS.

Related

How to install specific version of libhwloc5

I'm using Ubuntu 16.04 with an already installed libhwloc5 package of version 1.11.2. I want to install it with version 1.11.5 or above. I've tried to remove it and run
sudo apt-get update
then I run
sudo apt-get install libhwloc5
but it installs the same old version, how can I specify the version of installation?
You could specify the version of your package like this:
sudo apt-get install libhwloc5=<version-number-here>
Example: apt-get install virtualbox=5.0.18-dfsg-2build1

How to reinstall the latest cmake version?

I would like to install cmake the latest version, on Linux environment. I have cmake version 3.5 installed and is not supported by some applications. I tried to upgrade it by uninstalling the current version. But when I reinstall with sudo apt-get install cmake, I get the same version 3.5 re-installed. How do I install the latest version with sudo apt-get install ....?
As far as I know the best way to get the latest CMake version installed on any Linux is not by apt but using pip.
Remove the apt cmake and install the latest version from pip which can easily keep up-to-date.
apt remove cmake -y
pip install cmake --upgrade
Edit: As GNUton has pointed out, the following only works on Ubuntu 16.04 and 18.04(Checked on June 2019).
Now CMake developer team in Kitware Inc provides APT repositiory. It allows you to install latest CMake via apt-get.
If you are using a minimal Ubuntu image or a Docker image, you may need to install the following packages:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg \
software-properties-common wget
Obtain a copy of our signing key:
wget -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc |
sudo apt-key add -
Add the repository to your sources list and update.
For Ubuntu Bionic Beaver (18.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt-get update
For Ubuntu Xenial Xerus (16.04):
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
sudo apt-get update
... Optional steps. See details in reference.
... Optional steps. See details in reference.
Now call
sudo apt-get install cmake
Reference: Kitware APT Repository.
You can try the following steps that have worked for me on Ubuntu 18.04.3 LTS as OS of the NVIDIA jetson Nano to get the last version of cmake "cmake-3.14.0" from https://cmake.org/download/.
Delete the installed version in your system
sudo apt purge cmake
Download cmake3.13.4 source
wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz
Extract files
tar zxvf cmake-3.13.4.tar.gz
Execute the following commands in this order to build it
cd cmake-3.13.4
sudo ./bootstrap
sudo make
sudo make install
Verify the version is installed correctly
cmake --version
Following the comments made on how to Install the latest CMake version and to post the answer for this question:
Ans:
This depends with Ubuntu OS version currently installed on your PC or Mac. If you have the following Ubuntu OS version then you have this CMake installed or that you could install and reinstall with "sudo apt-get install cmake". Even if you uninstall your version and try to reinstall later version.
Ubuntu 16.04 ships with cmake-3.5.1
Ubuntu 17.10 ships with cmake-3.9.1
Ubuntu 18.04 ships with cmake-3.10.2
Ubuntu 20.04 ships with cmake-3.16.3
Ubuntu 21.04 ships with cmake-3.18.4
Now if you have Ubuntu 16.04 installed and you want cmake-3.10, there is OS problem since you can only install and reinstalled cmake-3.5.1. To get cmake-3.10 or any other version, you have to download and install the package from https://packages.ubuntu.com/. Once you find the latest version of cmake .targz files, you have to build it yourself from the command line.
For CentOS/RHEL you can help these following steps:
yum -y install python-pip
pip install cmake --upgrade
If you are using Google Colab like me and wanted a higher version of cmake in it. Then do the following,
!pip uninstall cmake
!pip install cmake
This will install cmake 3.22 instead of the default version 3.12
pip install cmake --upgrade
if the following occurs after cmake .. :
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/.../.../...
CMake Error: Error executing cmake::LoadCache(). Aborting.
then try
hash -r
the following worked for me:
sudo apt remove cmake
pip install cmake --upgrade
then, I exited the terminal and again entered to check the version with cmake --version command
3.20.5 in ubuntu 16.04
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
sudo apt update
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D
sudo apt install cmake cmake-qt-gui cmake-curses-gui
yum remove cmake
wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz
tar zxvf cmake-3.13.4.tar.gz
cd cmake-3.13.4
sudo ./bootstrap --prefix=/usr/local
sudo make
sudo make install
vi ~/.bash_profile
...
# PATH=$PATH:$HOME/bin
PATH=/usr/local/bin:$PATH:$HOME/bin
export PATH
source ~/.bash_profile
cmake --version
vi ~/.bash_profile
centos7 it help me
In case someone still finds it hard to remove cmake from their machine.
This command works for me (requires sudo permissions):
$ sudo find / -name "cmake" | xargs -I % sudo rm -rf "%"

Ugrade tmux from 1.8 to 1.9 on Ubuntu 14.04

I was just adding tmux plugins to my .tmux.conf file to find out that one of the plugins (tmux-copycat I think) requires tmux 1.9. When I start tmux I get the message `Error: Tmux version unsupported. Please install tmux version 1.9 or greater!".
So, what is the best way to upgrade tmux 1.8 to 1.9 on Ubuntu 14.04?
Update: due to new tmux version and changes in package repository, this answer is updated to show how to install tmux 2.0 (which is better, no reason to use 1.9 anymore).
Here are the steps to update "blank" ubuntu - version 14.04 only (see below for other ubuntu versions):
sudo apt-get update
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update
sudo apt-get install -y tmux=2.0-1~ppa1~t
now if you do tmux -V it should show tmux 2.0 which is a good version for tmux plugins
I verified the above steps on a new digitalocean droplet.
Basically, it's adding the pi-rho/dev repository, updating and then installing tmux from there.
If you have another ubuntu version you might want to install a different tmux version from the same repo. So:
ubuntu 12.04 (Precise Pangolin) step 5: sudo apt-get install -y tmux=1.9a-1~ppa1~p (installs tmux 1.9, no package for tmux 2.0 yet)
ubuntu 13.10 (Saucy Salamander) step 5: sudo apt-get install -y tmux=1.9a-1~ppa1~s (installs tmux 1.9, no package for tmux 2.0 yet)
ubuntu 14.10 (Utopic Unicorn) step 5: sudo apt-get install -y tmux=2.0-1~ppa1~u
ubuntu 15.04 (Vivid Vervet) step 5: sudo apt-get install -y tmux=2.0-1~ppa1~v
If you don't want to add a PPA, you can just build it from source. It's explained in the README on tmux's GitHub page:
To build tmux from a release tarball, do:
$ ./configure && make
$ sudo make install
You might need to install some extra packages to build it. On Ubuntu I needed to install these packages before it would successfully build:
exuberant-ctags
cmake
libevent-dev
libncurses5-dev
Another way to do #3 above (especially if you are using a corporate proxy that might break ppa).
sudo add-apt-repository -y http://ppa.launchpad.net/pi-rho/dev/ubuntu
If using a tool like Artifactory to act as a caching package proxy
sudo add-apt-repository -y http://my.artifactory.site/ppa.launchpad.net/pi-rho/dev/ubuntu
or
sudo add-apt-repository -y http://my.domain/artifactory/ppa.launchpad.net/pi-rho/dev/ubuntu

update old node.js to new version doesn't work

My linux system used to install a old version node.js environment 0.8.14, now updated it to latest node.js through this
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
when update is done and i rebooted the linux system, then I found it is still the old version node.js.
I'm willing to bet you installed the previous version through apt-get without first adding Chris Lea's PPA. The standard Ubuntu repositories have an old version of node.
You'll need to uninstall this old version before you can get the new one:
sudo apt-get --purge remove nodejs # Remove the package itself
sudo apt-get autoremove # Remove any unneeded dependencies
sudo apt-get update
sudo apt-get install nodejs

Unable to update Git on Ubuntu

I am trying to set up Git on an Ubuntu Machine (I'm using a Samsung Chromebook running Ubuntu 12.04).
When I entered "sudo apt-get install git" and it successfully installed Git 1.79
user#ChrUbuntu:~$ git --version
git version 1.7.9.5
I can't figure out what I am doing wrong here. Any suggestions?
For new installations of Ubuntu I would first try this to get the latest updates
sudo apt-get dist-upgrade
For more info on this see https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade
That should solve it but if not, add the repository from these guys https://launchpad.net/~git-core/+archive/ppa
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
This way you don't have to build it, etc.
Perhaps you need to build for
the newest version
wget git-core.googlecode.com/files/git-1.8.1.1.tar.gz
tar -zxf git-1.8.1.1.tar.gz
cd git-1.8.1.1
make prefix=/usr/local all
sudo make prefix=/usr/local install
If you are trying to upgrade to the latest version of Git, you should do:
sudo apt-get update
sudo apt-get upgrade
This will update all your packages, as well as Git.
BTW, latest version of Git on my Kubuntu 12.10 is 1.7.10.4.
A combination of some of the answers worked for me. I did...
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get upgrade
Have you tried to do an apt-get update?
You might have an outdated package list.
In ubuntu 14.04 I tried the terminal code:
sudo apt-get update
sudo apt-get upgrade
step to upgrade git.
1.) git --version
*to know what git version you had in your computer
2.) sudo apt-get update
*update ubuntu
3.) sudo apt-get upgrade
*to upgrade software including git
4.) try to git --version
that's it :)

Resources