Changes

From SME Server
Jump to navigationJump to search
16,762 bytes added ,  16:10, 15 December 2018
Add notes on correcting yum source after using smedev, smetest or smecontribs-testing
Line 14: Line 14:  
Yum doesn't do this job in one command but small scripts must be used for this purpose.
 
Yum doesn't do this job in one command but small scripts must be used for this purpose.
   −
===Scripts===
+
===yumcheck.sh===
3 scripts are available at this time:
  −
 
  −
====yumcheck.sh====
      
yumcheck.sh can be used to check for and optionally install updates to packages that were originally installed from a 3rd party repository.
 
yumcheck.sh can be used to check for and optionally install updates to packages that were originally installed from a 3rd party repository.
Line 23: Line 20:  
yumcheck.sh is an attachment to [[bugzilla:10158]]
 
yumcheck.sh is an attachment to [[bugzilla:10158]]
   −
Install at the sme server shell using:
+
Install at the sme server shell using (updated 2017-12-14):<br />
  <nowiki>curl -s https://bugs.contribs.org/attachment.cgi?id=5837 |sed -e 's/\r//' >/usr/local/bin/yumcheck.sh
+
(If this curl command doesn't work you can open the bug using the link above, view the attachment, create a local file with the same content, and make the local file executable)
chmod +x /usr/local/bin/yumcheck.sh
+
  curl -s <nowiki>https://bugs.contribs.org/attachment.cgi?id=6016</nowiki> |sed -e 's/\r//' >/usr/local/bin/yumcheck.sh
</nowiki>
+
chmod +x /usr/local/bin/yumcheck.sh
 +
 
    
Usage:
 
Usage:
Line 48: Line 46:  
* Arguments starting with "@" are stripped out and handled separately.  If *all* arguments start with "@", the default "check-update -q" will be passed to yum.
 
* Arguments starting with "@" are stripped out and handled separately.  If *all* arguments start with "@", the default "check-update -q" will be passed to yum.
   −
====script 1====
+
=== Problems ===
 +
 
 +
==== smeupdates-testing ====
 +
You might be directed in the forums or in bugzilla to install an update to a package from the smedev, smetest, or smeupdates-testing repository.  Once the developer is confident that the update works and solves the problem, it gets "released" to smeupdates or smecontribs.  In this case, yumcheck.sh will continue to look for updates only in original repo until you have installed the "released" version from the correct repository.
 +
 
 +
Assuming you have been directed to update "smeserver-php-scl" from the "smecontribs-testing" repository, you would "correct" the package once it is released by running:<syntaxhighlight lang="bash">
 +
yum --enablerepo=smecontribs reinstall smeserver-php-scl
 +
</syntaxhighlight>Note: "yum reinstall" works only for identical package versions.  If smecontribs has a newer version, you can get it using "yum --enablerepo=smecontribs update smeserver-php-scl"
 +
 
 +
==== Changed Dependencies ====
 +
From time to time an rpm will acquire new dependencies. Since yumcheck.sh is restricting each repository to only the packages that already came from that repository, the update will fail.
 +
 
 +
To work around this problem, you will need to update the affected packages manually with the source repository enabled.
 +
 
 +
Be sure to check the output of your yum update command carefully before allowing the update to be installed - make sure that no SME-specific rpms are included in the update!
 +
 
 +
Example:
 +
 
 +
yumcheck.sh fails to run due to a dependency problem:<syntaxhighlight lang="bash">
 +
# yumcheck.sh update
 +
...
 +
Error: Package: php71-php-mcrypt-7.1.25-1.el6.remi.x86_64 (installed)
 +
          Requires: php71-php-common(x86-64) = 7.1.25-1.el6.remi
 +
...
 +
 
 +
</syntaxhighlight>Find the repository that the installed package came from:<syntaxhighlight lang="bash">
 +
# yum info php71-php-mcrypt
 +
# yum info php71-php-mcrypt
 +
Loaded plugins: fastestmirror, post-transaction-actions, smeserver
 +
Loading mirror speeds from cached hostfile
 +
* base: centos2.zswap.net
 +
* smeaddons: mirror.canada.pialasse.com
 +
* smeextras: mirror.canada.pialasse.com
 +
* smeos: mirror.canada.pialasse.com
 +
* smeupdates: mirror.canada.pialasse.com
 +
* updates: centos2.zswap.net
 +
Installed Packages
 +
Name        : php71-php-mcrypt
 +
Arch        : x86_64
 +
Version    : 7.1.25
 +
Release    : 2.el6.remi
 +
Size        : 39 k
 +
Repo        : installed
 +
From repo  : remi-safe
 +
Summary    : Standard PHP module provides mcrypt library support
 +
URL        : http://www.php.net/
 +
License    : PHP
 +
Description : The php71-php-mcrypt package contains a dynamic shared object that will add
 +
            : support for using the mcrypt library to PHP.
 +
</syntaxhighlight>Do an update with only the indicated repository enabled:<syntaxhighlight lang="bash">
 +
# yum --disablerepo=* --enablerepo=remi-safe update
 +
...
 +
Dependencies Resolved
   −
#!/bin/bash
+
============================================================================================================================================================
   
+
  Package                                  Arch                          Version                                    Repository                        Size
echo "List of available repos beside SME:";
+
============================================================================================================================================================
#list the disabled repos
+
Updating:
for repo in $(yum repolist disabled |awk  '$1 !~ /id|Modules|repolist:/ {print $1}'); do
+
php54-php                                x86_64                        5.4.45-16.el6.remi                          remi-safe                        1.4 M
+
php54-php-bcmath                          x86_64                        5.4.45-16.el6.remi                          remi-safe                        59 k
      echo $repo;
+
php54-php-cli                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        2.7 M
+
php54-php-common                          x86_64                        5.4.45-16.el6.remi                          remi-safe                        581 k
done
+
php54-php-enchant                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        44 k
echo "";
+
php54-php-gd                              x86_64                        5.4.45-16.el6.remi                          remi-safe                        125 k
+
php54-php-imap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        65 k
# repo selection
+
php54-php-ldap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        56 k
index=0;
+
php54-php-mbstring                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        498 k
repos="";
+
php54-php-mcrypt                          x86_64                        5.4.45-16.el6.remi                          remi-safe                        49 k
proceed="proceed";
+
php54-php-mysqlnd                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        1.8 M
+
php54-php-pdo                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        91 k
until [ "$repos" == "$proceed" ]; do
+
php54-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
+
php54-php-process                        x86_64                        5.4.45-16.el6.remi                          remi-safe                        54 k
        repos[$index]=$repos;
+
php54-php-soap                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        160 k
        ((index=index+1));
+
php54-php-tidy                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        51 k
        read -p 'Enter 1x repo name for selection or "proceed" to start the updating: ' repos;
+
php54-php-xml                            x86_64                        5.4.45-16.el6.remi                          remi-safe                        119 k
+
php55-php                                x86_64                        5.5.38-10.el6.remi                          remi-safe                        1.4 M
done
+
php55-php-bcmath                          x86_64                        5.5.38-10.el6.remi                          remi-safe                        60 k
+
php55-php-cli                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        2.6 M
# remove the repo "proceed"
+
php55-php-common                          x86_64                        5.5.38-10.el6.remi                          remi-safe                        672 k
repos=("${repos[@]:1}");
+
php55-php-enchant                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        45 k
+
php55-php-gd                              x86_64                        5.5.38-10.el6.remi                          remi-safe                        67 k
+
php55-php-imap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        66 k
for repo in "${repos[@]}"; do
+
php55-php-ldap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        57 k
        echo "";
+
php55-php-mbstring                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        512 k
        echo "======================================";
+
php55-php-mcrypt                          x86_64                        5.5.38-10.el6.remi                          remi-safe                        50 k
        echo -e "\tUPDATE from repo: "$repo;
+
php55-php-mysqlnd                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        175 k
        echo "======================================";
+
php55-php-pdo                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        93 k
   
+
php55-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
        # generate the list of rpm installed from the repo
+
php55-php-process                        x86_64                        5.5.38-10.el6.remi                          remi-safe                        58 k
        for rpm in $(/sbin/e-smith/audittools/newrpms |awk -v repo_awk=@$repo 'repo_awk==$3 {print $1}'); do
+
php55-php-soap                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        163 k
   
+
php55-php-tidy                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        52 k
                rpms=$rpm' '$rpms
+
php55-php-xml                            x86_64                        5.5.38-10.el6.remi                          remi-safe                        150 k
   
+
php56-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
        done
+
php70-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        371 k
   
+
php71-php                                x86_64                        7.1.25-2.el6.remi                          remi-safe                        1.4 M
# updating
+
php71-php-bcmath                          x86_64                        7.1.25-2.el6.remi                          remi-safe                        68 k
        yum --enablerepo=$repo update $rpms;
+
php71-php-cli                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        2.7 M
   
+
php71-php-common                          x86_64                        7.1.25-2.el6.remi                          remi-safe                        597 k
  done
+
php71-php-enchant                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        53 k
   
+
  php71-php-fpm                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        1.4 M
  exit 0
+
php71-php-gd                              x86_64                        7.1.25-2.el6.remi                          remi-safe                        70 k
 +
php71-php-imap                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        73 k
 +
php71-php-json                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        62 k
 +
php71-php-ldap                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        65 k
 +
php71-php-mbstring                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        522 k
 +
php71-php-mcrypt                          x86_64                        7.1.25-2.el6.remi                          remi-safe                        58 k
 +
php71-php-mysqlnd                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        164 k
 +
php71-php-pdo                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        102 k
 +
php71-php-pear                            noarch                        1:1.10.7-1.el6.remi                        remi-safe                        370 k
 +
php71-php-process                        x86_64                        7.1.25-2.el6.remi                          remi-safe                        66 k
 +
php71-php-soap                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        156 k
 +
php71-php-tidy                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        60 k
 +
php71-php-xml                            x86_64                        7.1.25-2.el6.remi                          remi-safe                        155 k
 +
php72-php                                x86_64                        7.2.13-2.el6.remi                          remi-safe                        1.5 M
 +
php72-php-bcmath                          x86_64                        7.2.13-2.el6.remi                          remi-safe                        70 k
 +
php72-php-cli                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        2.9 M
 +
  php72-php-common                          x86_64                        7.2.13-2.el6.remi                          remi-safe                        627 k
 +
php72-php-enchant                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        54 k
 +
php72-php-gd                              x86_64                        7.2.13-2.el6.remi                          remi-safe                        73 k
 +
php72-php-imap                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        74 k
 +
  php72-php-json                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        64 k
 +
php72-php-ldap                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        69 k
 +
  php72-php-mbstring                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        557 k
 +
php72-php-mysqlnd                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        166 k
 +
php72-php-pdo                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        104 k
 +
  php72-php-process                        x86_64                        7.2.13-2.el6.remi                          remi-safe                        67 k
 +
  php72-php-soap                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        157 k
 +
  php72-php-tidy                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        61 k
 +
  php72-php-xml                            x86_64                        7.2.13-2.el6.remi                          remi-safe                        156 k
   −
Using this script is very easy:
+
Transaction Summary
* you get the list of all available repositories
+
============================================================================================================================================================
* enter 1 by 1 the name of the repo you want to update from
+
Upgrade      71 Package(s)
* enter 'proceed' after the last repo
  −
* for each repo, yum show the list of rpms that could be updated and ask (Y/N) before starting
     −
eg.:
+
Total size: 30 M
List of available repos beside SME:
+
Is this ok [y/N]: y
centosplus
+
...
contrib
  −
epel
  −
extras
  −
fasttrack
  −
fws
  −
remi
  −
smecontribs
  −
smedev
  −
smetest
  −
smeupdates-testing
  −
sogo3
  −
  −
Enter 1x repo name for selection or "proceed" to start the updating: epel
  −
Enter 1x repo name for selection or "proceed" to start the updating: fws
  −
Enter 1x repo name for selection or "proceed" to start the updating: proceed
     −
====script 2====
+
Updated:
This script is much shorter, runs faster and doesn't require to enter the name of the several repos:
+
  php54-php.x86_64 0:5.4.45-16.el6.remi              php54-php-bcmath.x86_64 0:5.4.45-16.el6.remi        php54-php-cli.x86_64 0:5.4.45-16.el6.remi       
 +
  php54-php-common.x86_64 0:5.4.45-16.el6.remi      php54-php-enchant.x86_64 0:5.4.45-16.el6.remi      php54-php-gd.x86_64 0:5.4.45-16.el6.remi         
 +
  php54-php-imap.x86_64 0:5.4.45-16.el6.remi        php54-php-ldap.x86_64 0:5.4.45-16.el6.remi          php54-php-mbstring.x86_64 0:5.4.45-16.el6.remi   
 +
  php54-php-mcrypt.x86_64 0:5.4.45-16.el6.remi      php54-php-mysqlnd.x86_64 0:5.4.45-16.el6.remi      php54-php-pdo.x86_64 0:5.4.45-16.el6.remi       
 +
  php54-php-pear.noarch 1:1.10.7-1.el6.remi          php54-php-process.x86_64 0:5.4.45-16.el6.remi      php54-php-soap.x86_64 0:5.4.45-16.el6.remi       
 +
  php54-php-tidy.x86_64 0:5.4.45-16.el6.remi        php54-php-xml.x86_64 0:5.4.45-16.el6.remi          php55-php.x86_64 0:5.5.38-10.el6.remi           
 +
  php55-php-bcmath.x86_64 0:5.5.38-10.el6.remi      php55-php-cli.x86_64 0:5.5.38-10.el6.remi          php55-php-common.x86_64 0:5.5.38-10.el6.remi     
 +
  php55-php-enchant.x86_64 0:5.5.38-10.el6.remi      php55-php-gd.x86_64 0:5.5.38-10.el6.remi            php55-php-imap.x86_64 0:5.5.38-10.el6.remi       
 +
  php55-php-ldap.x86_64 0:5.5.38-10.el6.remi        php55-php-mbstring.x86_64 0:5.5.38-10.el6.remi      php55-php-mcrypt.x86_64 0:5.5.38-10.el6.remi     
 +
  php55-php-mysqlnd.x86_64 0:5.5.38-10.el6.remi      php55-php-pdo.x86_64 0:5.5.38-10.el6.remi          php55-php-pear.noarch 1:1.10.7-1.el6.remi       
 +
  php55-php-process.x86_64 0:5.5.38-10.el6.remi      php55-php-soap.x86_64 0:5.5.38-10.el6.remi          php55-php-tidy.x86_64 0:5.5.38-10.el6.remi       
 +
  php55-php-xml.x86_64 0:5.5.38-10.el6.remi          php56-php-pear.noarch 1:1.10.7-1.el6.remi          php70-php-pear.noarch 1:1.10.7-1.el6.remi       
 +
  php71-php.x86_64 0:7.1.25-2.el6.remi              php71-php-bcmath.x86_64 0:7.1.25-2.el6.remi        php71-php-cli.x86_64 0:7.1.25-2.el6.remi         
 +
  php71-php-common.x86_64 0:7.1.25-2.el6.remi        php71-php-enchant.x86_64 0:7.1.25-2.el6.remi        php71-php-fpm.x86_64 0:7.1.25-2.el6.remi         
 +
  php71-php-gd.x86_64 0:7.1.25-2.el6.remi            php71-php-imap.x86_64 0:7.1.25-2.el6.remi          php71-php-json.x86_64 0:7.1.25-2.el6.remi       
 +
  php71-php-ldap.x86_64 0:7.1.25-2.el6.remi          php71-php-mbstring.x86_64 0:7.1.25-2.el6.remi      php71-php-mcrypt.x86_64 0:7.1.25-2.el6.remi     
 +
  php71-php-mysqlnd.x86_64 0:7.1.25-2.el6.remi      php71-php-pdo.x86_64 0:7.1.25-2.el6.remi            php71-php-pear.noarch 1:1.10.7-1.el6.remi       
 +
  php71-php-process.x86_64 0:7.1.25-2.el6.remi      php71-php-soap.x86_64 0:7.1.25-2.el6.remi          php71-php-tidy.x86_64 0:7.1.25-2.el6.remi       
 +
  php71-php-xml.x86_64 0:7.1.25-2.el6.remi          php72-php.x86_64 0:7.2.13-2.el6.remi                php72-php-bcmath.x86_64 0:7.2.13-2.el6.remi     
 +
  php72-php-cli.x86_64 0:7.2.13-2.el6.remi          php72-php-common.x86_64 0:7.2.13-2.el6.remi        php72-php-enchant.x86_64 0:7.2.13-2.el6.remi     
 +
  php72-php-gd.x86_64 0:7.2.13-2.el6.remi            php72-php-imap.x86_64 0:7.2.13-2.el6.remi          php72-php-json.x86_64 0:7.2.13-2.el6.remi       
 +
  php72-php-ldap.x86_64 0:7.2.13-2.el6.remi          php72-php-mbstring.x86_64 0:7.2.13-2.el6.remi      php72-php-mysqlnd.x86_64 0:7.2.13-2.el6.remi     
 +
  php72-php-pdo.x86_64 0:7.2.13-2.el6.remi          php72-php-process.x86_64 0:7.2.13-2.el6.remi        php72-php-soap.x86_64 0:7.2.13-2.el6.remi       
 +
  php72-php-tidy.x86_64 0:7.2.13-2.el6.remi          php72-php-xml.x86_64 0:7.2.13-2.el6.remi         
   −
#!/bin/bash
+
Complete!
  −
for repo in $(/sbin/e-smith/audittools/newrpms |grep \@ |awk ' {print $3}' |sort -u |sed s/@//); do
  −
  −
        # generate the list of rpm installed from the repo
  −
        for rpm in $(/sbin/e-smith/audittools/newrpms |awk -v repo_awk=@$repo 'repo_awk==$3 {print $1}'); do
  −
                rpms=$rpm' '$rpms
  −
        done
  −
  −
        echo -e "\n\n===";
  −
        echo -e "Repo: "$repo;
  −
        echo -e "\nIncludePkgs: "$rpms;
  −
        echo "===";
  −
        # updating
  −
        yum --enablerepo=$repo --setopt="$repo.includepkgs='$rpms'" update
  −
  −
done
  −
  −
exit 0
     −
The script
+
</syntaxhighlight>
* runs 'newrpms' to get all repos that have been used to install non-standard packages
  −
* creates a list of rpms for each such repo
  −
* uses "--setopts" to specify "includepkgs" for each repo during update
  −
* asks for Y/N and runs the update
      +
The objective is to update only the package or packages that are blocking safe updates using yumcheck.sh.  If updating as above (with only the indicated repository enabled) includes too many packages, you might need to add package names to the update command.  If the indicated packages include dependencies from other repositories you may need to enable those other repositories.
 +
 +
The epel repository, for example, contains many useful packages (fail2ban, nodejs, roundcube, imapsync, and many more) - but "yum --enablerepo=epel update" would break horde and php on a SME server.  In that case you would add the affected package to the update command:<syntaxhighlight lang="bash">
 +
# yum --enablerepo=epel update roundcube
 +
</syntaxhighlight>
    
===Related Information===
 
===Related Information===
 +
====Alternative Scripts====
 +
: [https://wiki.contribs.org/Talk:Update_contribs Original scripts]
 
====Forum====
 
====Forum====
 
:[https://forums.contribs.org/index.php/topic,52795.0.htm How to update completely and properly a SME?]
 
:[https://forums.contribs.org/index.php/topic,52795.0.htm How to update completely and properly a SME?]
Line 162: Line 231:  
  |disablecache=1
 
  |disablecache=1
 
  |noresultsmessage="Bug not found"
 
  |noresultsmessage="Bug not found"
  |headers=show}}
+
  |headers=show}}   [[Category:Howto]]    [[Category:Tools]]  [[Category:Updating]]
 
  −
[[Category: Howto]]
 

Navigation menu