Skip to content

Instantly share code, notes, and snippets.

@tayhimself
Last active June 10, 2016 20:02
Show Gist options
  • Save tayhimself/9ad385f92d47c10a51e919a403228e83 to your computer and use it in GitHub Desktop.
Save tayhimself/9ad385f92d47c10a51e919a403228e83 to your computer and use it in GitHub Desktop.
Update PHP packages on CentOS with yum

Use sudo or su or whatever to switch to root

If you want to install the remi repositories for PHP for example

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm

Now in order to update use the remi as well as the default repos, first check what repos are installed, enable them and run update. Some examples below

yum repolist
yum --enablerepo=remi update
sudo yum --enablerepo='remi-safe' --exclude R\* update
yum --enablerepo=ius update

Something a bit more sophisticated from the IUS repositories from https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/

Install the IUS repository.

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm

wget https://centos6.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum install yum-plugin-replace

Check what services need to be restarted to enable upgrade

needs-restarting

Have to reboot for kernel updates so check what kernels are avaliable

rpm -qa kernel

Check what kernel is running

uname -r 

Reboot if needed

shutdown -r now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment