Fedora comes with RPM package manager (PM) and Yum Updater, Ubuntu has Dpkg (USC now) PM and Apt updater, Arch has Pacman PM and Updater and in general every distro features its own package manager and update method.
Most of these package management systems are backends for packagekit and are responsible to add, update and remove applications in our box, resolving at the same time any dependencies required.
fedora’s yum stands for..
..Yellowdog Updater, Modifier developed by Seth Vidal and is an open-source command-line package-management utility for RPM-compatible Linux operating systems and has been released under the GNU General Public License.
Fedora 18, new Grub Theme
Next, I will refer some common operations with yum, common to most of us, but not to everyone.
add a new user
Because I normally use Fedora’s minimal installation, I haven’t a either a user or a graphical interface at first. Luckily we have a root account, so lets create a new user first.
# useradd alex
and set a password so we actually can use this account.
# passwd alex
There is also a “adduser” command. The “adduser” in Fedora is just a link to “useradd” where in Ubuntu is a script that uses “useradd” and adds some more functionality. I am not going to cover the options of “useradd” but running it without options is exactly the same as make a new account within user interface, so you can use safely the terminal to add new users.
If you want to remove a user you can use the “userdel” command that without options doesn’t remove the home and mail directories.
# userdel alex
add users to sudo-ers
It is strongly recommended to don’t use our root account in a Linux Desktop. Indeed we have to avoid it, mostly because we forget to close terminals with a root logged in, and then we might re-use them, supposing we have a normal user logged in.
But how we can use Yum to install new things without a root account? Well, there is a “sudo” command for terminal or “gksudo” for GUIs. Sudo (SuperUser Do) is a program that allows users to run programs with the security privileges of another user (normally root).
Before we can use “sudo” we have to add our user to
/etc/sudoers config file. Although it is common to use “visudo” to edit this file we can use another (and simpler) text editor like nano. Visudo checks the sudoers file for errors. So if you make any error here, you might lockout from your system :)
# nano /etc/sudoers
And we add our user “alex”.
##Allow root to run any commands anywhere
root ALL = (ALL) ALL
alex ALL = (ALL) ALL
Sudoers configuration can get much complicated, but here is small trick: We have a single user box, so why should sudo asks us for a password? Lets remove this. Just edit your sudoers like this:
##Allow root to run any commands anywhere
root ALL = (ALL) ALL
alex ALL = (ALL) NOPASSWD: ALL
It isn’t really smart to mess up with our sudoers configuration if haven’t read some docs first, and besides Fedora places by default the first user in sudoers group in a typical installation.
I repeat that editing this file and make a typo, will lock you out of your system (and we have to repair with a liveCD), so it is needed to use the visudo to edit it :)
Ok, now that I can use “sudo yum” to install software, I want to install Gnome (I have currently not a GUI installed). I can install one by one Gnome modules as yum will take care the dependencies.
$ sudo yum install gdm gnome-control-center nautilus ..etc
..but how I can know all the possible Gnome Modules that Gnome uses? Fedora makes it easy to install whole environments with a single command. To find out the available options run:
$ yum grouplist
and you get this response
Available Environment Groups: GNOME Desktop KDE Desktop Xfce Desktop LXDE Desktop Cinnamon Desktop MATE Desktop Sugar Desktop Environment Development and Creative Workstation Web Server Infrastructure Server Basic X windows Minimal install Installed Groups: Administration Tools Authoring and Publishing Design Suite Development Tools Electronic Lab Milkymist Network Servers Office/Productivity Robotics Sound and Video System Tools Text-based Internet Available Groups: Books and Guides Cloud Infrastructure Editors Educational Software Engineering and Scientific Fedora Eclipse Games and Entertainment LibreOffice Medical Applications Web Development Window Managers
We can also search for a specif group by using
$ yum grouplist gnome\*
Now install Gnome simply:
$ sudo yum groupinstall "GNOME Desktop"
$ sudo yum groupinstall gnome-desktop
$ sudo yum install @gnome-desktop
Obviously you can replace “GNOME Desktop” with any of the available groups.
Now I want, to check what packages the @gnome-desktop will install:
$ yum groupinfo gnome-desktop
|Environment Group: GNOME Desktop
Description:GNOME is a highly intuitive and user friendly desktop environment.
|Group: GNOME Desktop Environment
Description:GNOME is a powerful graphical user interface which includes a panel, desktop, system icons, and a graphical file manager
These are the default packages in Fedora 18 for Gnome ..in case you are curious! And yes Epiphany is still an optional package in Fedora 18, pff…
We can search for a package in a grouplist
$ sudo yum groupinfo gnome/* | grep -i mplayer
or display it in more readable way
$ sudo yum groupinfo gnome/* | less
Of course we can remove our grouplist by:
$ sudo yum groupremove gnome-desktop
or update it
$ sudo yum groupupdate gnome-desktop
yum common operations
$ yum clean all
Clean all the cache and metadata in yum
$ yum check-update
Checking if there are available updates
$ sudo yum update
Checking and installs the available updates -if any.
$ sudo yum update --skip-broken
Many times in Fedora(!?) we have broken packages that prevent the installation of others. We can use the –skip-broken flag to overpass it.
$ sudo yum install package1 package2
Installs two packages, but it can also used with a regex
$ sudo yum install gnome-shell-ext*
Installs all the packages that the name starts from gnome-shell-ext. This will install all the available gnome-shell extensions.
$ sudo yum remove package1 package2
Removes these two packages
$ yum search package
Searches for a package, and is useful to use some regex here and filtering it with grep
$ yum provides package
Looking for a missing lib or a package and returns the package or the repo that contains it.
Yum and every other updating system are very complex programs with dozens of options, so there is no way to address all the capabilities of Yum.
$ man yum
You get all the available options of yum :)
Sometimes yum ins’t enough to install or to remove packages. Suppose we want to install a package that lies somewhere in our hard drive and not in an online repository. To install it we will use rpm program.
$ sudo rpm -i /PATH_TO_FILE/package.rpm
$ sudo rpm -U /PATH_TO_FILE/package.rpm
to update it.
$ sudo rpm -e package
To erase a package that you had install with rpm
Another nice thing about rpm is that we can install or remove packages dropping any dependencies with the –nodeps flag
$ sudo rpm -i /PATH_TO_FILE/package.rpm --nodeps
Install package without calculating dependencies
$ sudo rpm -e package --nodeps
Erase the package without removing the dependencies.
Searching with rpm
$ rpm -q package
Look for a package if it is installed
$ rpm -qa
Returns all the installed packages
$ rpm -qa | grep -i gnome-do
Returns all the installed packages that contains “gnome-do” as part of their name.
rpm -q --changelog package | less
Returns the changelog of the package, really cool!
$ man rpm
Man is your best friend :)
All the repositories in Fedora are stored in
/etc/yum.repos.d/ The typical fedora.repo looks like that:
[fedora] name=Fedora $releasever - $basearch failovermethod=priority #baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch enabled=1 #metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch [fedora-debuginfo] name=Fedora $releasever - $basearch - Debug failovermethod=priority #baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch [fedora-source] name=Fedora $releasever - Source failovermethod=priority #baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
Enable and GPGKey is the two variables that we can use to enable(1)/disable(0), the repositories and the gpg checks.
Fedora comes by default with 3 repositories, fedora.repo, fedora-updates.repo and fedora-updates-testing.repo. As their names suggest, the first is the stable and the only one that is enabled by default. Also we can add the Rawhide repository which is the next development version of Fedora.
$ sudo yum install fedora-release-rawhide
which is extremely unstable! If you enable Rawhide you must to disable the other three.
Yum in Fedora comes with some plugins enabled by default (like presto) but there are lots of plugins out there to install. One of the most common and highly recommended is Fastest Mirrors
The Fastest Mirror plugin is designed for use in repository configurations where you have more than 1 mirror in a repo configuration. It makes a connection to each mirror, timing the connection and then sorts the mirrors by fastest to slowest for use by yum. This won’t work behind a proxy!
sudo yum install yum-plugin-fastestmirror
Yum plugins configuration is stored in
/etc/yum/pluginsconfig.d, and from there you can enable or disable them. But you can also disable a plugin instantly.
yum check-update --disableplugin=fastestmirror
Run Yum behind a proxy
To enable yum operations to use a proxy server you should first add the following parameter to /etc/yum.conf
where yourproxy is the name of the proxy server you want to access and 8080 is the proxy port. If the server requires authentication you can specify the login credentials like:
The rpm package manager makes use of the proxy environment variable. This can be set system wide in /etc/profile or user specific in ~/.bash_profile
export http_proxy=http://yourproxy:8080/ export ftp_proxy=http://yourproxy:8080/
To use wget throug a proxy server add the following lines to /etc/wgetrc
http_proxy = http://yourproxy:8080/ ftp_proxy = http://yourproxy:8080/
In both cases, login information can be set like in the example above.
source: CentOS wiki
Keep more than 3 kernels
In Fedora there are some special packages that are “installed only” and cannot be updated. These (as far as I know) are only the kernels. A default Fedora Yum configuration is set to keep the three latest kernels. However sometimes is critical to keep more kernels. We can easily manage the number of the kernels that yum installs by editing yum.config.
And obviously we need to change the installonly_limit variable to any number.
Packages installation Priorities
Sometimes we need to define a specific package (ie a kernel, Php etc) to be updated from a specific repo no matter if there is a more updated version in another repo. While many people using yum plugins like “Priorities”, it isn’t a very nice way to do things. I will try to make a detailed guide on this later, as I needed it recently :)