Showing posts with label yum. Show all posts
Showing posts with label yum. Show all posts

Monday, 21 August 2017

Obtain information about installed packages on CentOS and Ubuntu


CentOS / RHEL / Fedora

List all installed packages
rpm -qa

Get information about a specific package
rpm -qi <package name> 

List all files in a specific package
rpm -ql <package name> 

Combine the -a and -l options, in this exmaple we're searching for the package elasticsearch-5.5.2-1.noarch
package=$(rpm -qa | grep elasticsearch) && rpm -ql $package; 


Ubuntu

List all installed packages
dpkg-query -l


List all files in a specific package
dpkg-query -L <package name> 





Saturday, 10 June 2017

Adding new RPM's to an existing yum repo


1.) Copy the rpm to the repository directory (i.e alongside all the existing rpm's)

2.) Update the repository index:
createrepo --update <path to repo> --verbose

3.) Make sure your file permissions for <path to repo>/repodata are ok (i.e. so that your http server can access the files):
chmod -R go+rx <path to repo>/repodata

(NOTE: don't forget to ensure the actual package file (the rpm) has the correct file permissions also)

4.) Clear your yum client cache:
yum clean all 






Set up a local yum repository

Install yum-utils
yum install yum-utils createrepo

Create a directory for the repo
mkdir /my_repo

Get the RPM's to put in the repo. Use reposync to download from an existing repo or download rpm's manaully.. e.g.
wget http://mirror.lihnidos.org/CentOS/6/os/i386/Packages/NetworkManager-0.8.1-43.el6.i686.rpm

Create the repository
createrepo /my_repo

Create /etc/yum.repos.d/custom.repo with the following contents
[customrepo]

name=Custom Repository
baseurl=file:////my_repo/
enabled=1
gpgcheck=0