| 102 | |
| 103 | == Plugins == |
| 104 | |
| 105 | Plugins are python modules which eextend yum's functionality. Plugins are available from a variety of sources. A good place to start looking for plugins is the yum-utils Trac wiki, [http://yum.baseurl.org/wiki/YumUtils here]. |
| 106 | |
| 107 | === Installing a plugin === |
| 108 | |
| 109 | At the very least, a plugin requires a python script (something.py) and a configuration file (something.conf). The script should be placed in %UNIXROOT%\usr\lib\yum-plugins or %UNIXROOT%\usr\share\yum-plugins (create the directory if it does not exist). Alternatively, plugins may be placed in the directory of your choice by adding the following to %UNIXROOT%\etc\yum\yum.conf in the [main] section: |
| 110 | |
| 111 | pluginpath=x:/somewhere/somedir |
| 112 | |
| 113 | (Multiple plugin directories may be specified.) |
| 114 | |
| 115 | The plugin configuration file should be placed in %UNIXROOT%\etc\yum\pluginconf.d (create the directory if it does not exist). Alternatively, plugin configuration files may be placed in the directory of your choice by adding the following to %UNIXROOT%\etc\yum\yum.conf in the [main] section: |
| 116 | |
| 117 | pluginconfpath=x:/somewhere/somedir |
| 118 | |
| 119 | (Multiple plugin configuration directories may be specified.) |
| 120 | |
| 121 | The plugin configuration file must at a minimum consist of the following two lines: |
| 122 | |
| 123 | [main][[BR]] |
| 124 | enabled=1 |
| 125 | |
| 126 | (Individual plugins may be disabled by toggling the above value to 0 in their respective configuration files.) |
| 127 | |
| 128 | === Enabling the use of plugins === |
| 129 | |
| 130 | In order for yum to process any plugins, it is necessary to add the following line to %UNIXROOT%\etc\yum\yum.conf in the [main] section: |
| 131 | |
| 132 | plugins=1 |
| 133 | |
| 134 | This may be overridden on the commandline with the --noplugins option, or to disable certain plugins only, the --disableplugin=plugin1[,plugin2,plugin3,etc.] option may be specified. |
| 135 | |
| 136 | === Miscellaneous plugin issues === |
| 137 | |
| 138 | Sometimes, a given plugin will not load. When that happens, you should see a message, such as: |
| 139 | |
| 140 | Plugin "xyz" can't be imported |
| 141 | |
| 142 | This may be because the plugin itself (a python script) has one or more unsatisfied dependencies. To determine what may be the cause requires examining the plugin to see what it might need to import and from what other module. Here's an example: |
| 143 | |
| 144 | {{{ |
| 145 | yum repolist[[BR]] |
| 146 | Plugin "xyz" can't be imported |
| 147 | [remainder of output] |
| 148 | }}} |
| 149 | |
| 150 | Examining %UNIXROOT%/usr/lib/yum-plugins/xyz.py, we see the following just after the opening comments: |
| 151 | |
| 152 | from yumutils.i18n import _ |
| 153 | |
| 154 | Checking %UNIXROOT%/usr/lib/pythonX.X/, we find no yumutils module directory, and none under %UNIXROOT%/usr/lib/pythonX.X/site-packages, either. |
| 155 | |
| 156 | Testing further: |
| 157 | |
| 158 | {{{ |
| 159 | python |
| 160 | >>> from yumutils.i18n import _ |
| 161 | Traceback (most recent call last): |
| 162 | File "<stdin>", line 1, in <module> |
| 163 | ImportError: No module named yumutils.i18n |
| 164 | }}} |
| 165 | |
| 166 | Upon installing the yumutils module, the above command succeeds: |
| 167 | |
| 168 | {{{ |
| 169 | >>> from yumutils.i18n import _ |
| 170 | >>> |
| 171 | }}} |
| 172 | |
| 173 | as does yum. |
| 174 | |
| 175 | In the future, as on other platforms, we hope to have some plugins available for installation via yum itself, which will handle these dependencies. |
| 176 | |
| 177 | === The fastestmirror plugin === |
| 178 | |
| 179 | ==== Background ==== |
| 180 | |
| 181 | In short, the fastestmirror plugin allows yum to make a determination as to which repo is more responsive from your location, given available bandwidth, traffic, routing constraints, and of course, server load. From the comments in the script itself: |
| 182 | |
| 183 | A plugin for the Yellowdog Updater Modified which sorts each repo's[[BR]] |
| 184 | mirrorlist by connection speed prior to download. |
| 185 | |
| 186 | ==== Installing the plugin ==== |
| 187 | |
| 188 | See [#Installingaplugin Installing a plugin] for more detail, but in general, follow these steps to get fastestmirror up and running quickly: |
| 189 | |
| 190 | 1. Download this [http://www.2rosenthals.com/rpm.netlabs.org/mirror/fastestmirror.py file] and place it in %UNIXROOT%\usr\lib\yum-plugins (create yum-plugins if it does not exist). |
| 191 | 2. Download this [http://www.2rosenthals.com/rpm.netlabs.org/mirror/fastestmirror.conf file] and place it in %UNIXROOT%\etc\yum\pluginconf.d (create pluginconf.d if it does not exist). |
| 192 | 3. Open %UNIXROOT%\etc\yum\yum.conf in your favorite text editor. Under the [main] section, add the following line: |
| 193 | |
| 194 | plugins=1 |
| 195 | |
| 196 | 4. If you have previously downloaded the repo files for the Rosenthal & Rosenthal mirrors (see above sections), you should delete those two files: |
| 197 | |
| 198 | netlabs-rel-2rosenthals.repo[[BR]] |
| 199 | netlabs-exp-2rosenthals.repo |
| 200 | |
| 201 | and either confirm that the Rosenthal & Rosenthal mirrors are already listed in your netlabs repo files (editing them as necessary) ''or'' you may overwrite your existing (remaining) repo files with these two, which have the Rosenthal & Rosenthal mirrors appended to them: |
| 202 | |
| 203 | [http://www.2rosenthals.com/rpm.netlabs.org/mirror/netlabs-rel.repo netlabs-rel.repo][[BR]] |
| 204 | [http://www.2rosenthals.com/rpm.netlabs.org/mirror/netlabs-exp.repo netlabs-exp.repo] - repo disabled by default |
| 205 | |
| 206 | N.B.: fastestmirror does not optimize between different repo files, so mirrors for the same repository must be listed in a single repo file, e.g., both the rpm.netlabs.org and the www.2rosenthals.com URIs should be listed in the corresponding repo file, as in: |
| 207 | |
| 208 | {{{ |
| 209 | baseurl=http://rpm.netlabs.org/release/$releasever/$basearch/ |
| 210 | http://www.2rosenthals.com/rpm.netlabs.org/release/$releasever/$basearch/ |
| 211 | }}} |
| 212 | |
| 213 | If you want to enable the experimental repository, follow the directions under [#Managingrepositories Managing repositories], above. |
| 214 | |
| 215 | ==== Tuning ==== |
| 216 | |
| 217 | You may want to adjust the behavior of fastestrepo to better suit your conditions. This is done through %UNIXROOT%\etc\yum\pluginconf.d\fastestmirror.conf. Hints are provided there as well as in the beginning comments in the plugin itself. As provided, the configuration should be adequate for most users. |
| 218 | |
| 219 | ==== Example session ==== |
| 220 | |
| 221 | Here's an example of the output when using fastestmirror: |
| 222 | |
| 223 | {{{ |
| 224 | yum check-update |
| 225 | Loaded plugins: fastestmirror |
| 226 | Loading mirror speeds from cached hostfile |
| 227 | * www.2rosenthals.com : 0.067000 secs |
| 228 | * www.2rosenthals.com : 0.063000 secs |
| 229 | * rpm.netlabs.org : 0.149000 secs |
| 230 | * rpm.netlabs.org : 0.174000 secs |
| 231 | rpm.netlabs.org already timed: 0.174000024796 |
| 232 | * rpm.netlabs.org : 0.174000 secs |
| 233 | www.2rosenthals.com already timed: 0.0629999637604 |
| 234 | * www.2rosenthals.com : 0.063000 secs |
| 235 | * netlabs-exp: www.2rosenthals.com |
| 236 | rpm.netlabs.org already timed: 0.174000024796 |
| 237 | * rpm.netlabs.org : 0.174000 secs |
| 238 | www.2rosenthals.com already timed: 0.0629999637604 |
| 239 | * www.2rosenthals.com : 0.063000 secs |
| 240 | * netlabs-rel: www.2rosenthals.com |
| 241 | netlabs-exp 100% |=========================| 1.3 kB 00:00 |
| 242 | netlabs-rel 100% |=========================| 1.3 kB 00:00 |
| 243 | }}} |