Rudimentary Shell Script (Done) - SVN Update for CentOS 6.7



  • It ain’t pretty, but I am getting a little flustered and having to constantly do all that typing to update FOG, regardless if I am just using a small call portion or not.

    I have tested this, and yes, it is VERY rudimentary and is currently usable.
    Automated - always up to date - script

    #!/bin/bash
    
    # Enter root and uninstall php-common to install FOG
    yum -y remove php-common
    
    # Update FOG to the latest SVN version (Can be replaced with GIT, I assume)
    cd /root/fogproject # Change this to your fog directory
    svn up # Can be replaced with <git pull>?
    cd bin
    ./installfog.sh -y # Requires no input (Thanks, Wayne)
    
    # Reinstall php-common so that you can actually load the FOG page with the proper PHP version (5.6)
    yum -y remove php-common
    yum -y update
    yum -y install epel-release
    wget https://dl.fedoraproject.org/pub/epel-release-latest-6.noarch.rpm
    wget https://centos6.iuscommunity.org/ius-release.rpm
    rpm -Uvh ius-release*.rpm
    yum -y update
    yum -y install php56u php56u-common php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
    
    # Configure PHP Options using Stream EDitor
    # php.ini default location = /etc/php.ini
    # Change the last part of the meta-data to the value you want and change your file directory to match the correct file
    sed -i 's/date.timezone =.*/date.timezone = Chicago\/America/' /etc/php.ini # Change this to meet your settings
    sed -i 's/memory_limit =.*/memory_limit = 2G/' /etc/php.ini # Change this to meet your settings
    sed -i 's/always_populate_raw_post_data =.*/always_populate_raw_post_data = Off/' /etc/php.ini # Change this to meet your settings
    sed -i 's/asp_tags =.*/asp_tags = Off/' /etc/php.ini # Change this to meet your settings
    
    # Restart Apache Service
    service httpd restart
    

    Make sure that your values are changed to what you need, and that you are changing the correct file. Values are within the last part of the sed string, in the metadata section: 's/entry =.*/replaced_entry = <value>/' <php.ini>

    If you need to add in special characters in your strings such as / you can set it like Chicago\/America and it will look like Chicago/America on your edited file - for those that are unfamiliar with sed.

    References:
    FOG Setup: https://wiki.fogproject.org/wiki/index.php?title=Upgrade_to_trunk
    PHP Setup for CentOS: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-centos.html#instgde-prereq-php55-install-centos
    sed assistance: http://stackoverflow.com/questions/16790793/how-to-replace-strings-containing-slashes-with-sed , http://stackoverflow.com/questions/8822097/how-to-replace-whole-line-with-sed , http://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files



  • @Wayne-Workman said in Rudimentary Shell Script - SVN Update for CentOS 6.7:

    The best suggestion still stands though - move to CentOS 7. There’s no reason not to, it’s a free and open OS.

    I would be totally for it, although this server does nothing but sit there and run fog – which is what a server is supposed to do, now that I think about it.

    That main reason is redoing the hardware RAID and making sure that is all set right as rain, and that all of our images make the transfer. It’s one of those too much to do in too little of a time frame – I mean this server has been here about 4 years before I got this position and it was still running FOG .29 (While the most updated version was 1.2.0).

    More or less, I am stuck with it for the time being.

    In place upgrade probably should not mess anything up, but the should is what I am skeptical about.


  • Moderator

    @ttrammell it could be because FOG is ordering yum to install those packages using the remi repo.

    At the very least - you can modify the packages list - and maybe even modify the installer to just not use the remi repo.

    The best suggestion still stands though - move to CentOS 7. There’s no reason not to, it’s a free and open OS.



  • @Wayne-Workman Sadly, running php_ver='5.5' php_verAdds='55u' ./installfog.sh -y– at the very least without having any other version of php running, it does not work (for me).

    Will take a look at editing package listings later.



  • thanks for these scripts, they are very helpful :)


  • Moderator

    @ttrammell

    ./installfog.sh # Requires Input
    

    can be replaced with

    ./installfog.sh -y # Does not require input.
    

    And if you move to CentOS 7, you can go to PHP 7.

    And, if you wish to stay on CentOS 6, you can replace that line with

    php_ver='5.5' php_verAdds='55u' ./installfog.sh -y
    

    Or, simply update your packages list inside of /opt/fog/.fogsettings with the ones you want to use, and also update php_verAdds and php_ver while you’re in there too.



  • @Quazz Your guess would be as good as mine, but that makes some sense since yum update could never find updates for PHP without those special repositories (fedoraproject / iuscommunity).


  • Moderator

    @ttrammell Ah, I guess php5.3 is the latest available for centos 6.7 by default yum repositories then?



  • @Quazz Recently, when I have been installing FOG it has only ever put on PHP 5.3, so – minimally – I’m installing 5.5 manually.

    I have to uninstall php-common everytime I want to update FOG, whether that is a problem officially or just something on my side, I am not sure.


  • Moderator

    Why are you installing PHP5.5 if I might ask?


Log in to reply
 

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.