Upgrade FileCloud Server from Ubuntu 18.04 to 20.04

FileCloud release 21.1 supports Ubuntu 20.04 LTS. You can upgrade Ubuntu 18.04 LTS to Ubuntu 20.04 LTS. In this blog post we will address two use case scenarios:

  • Upgrading Ubuntu 18.04 LTS to Ubuntu 20.04 LTS, where the FileCloud server is below 21.1
  • Upgrading Ubuntu 18.04 LTS to Ubuntu 20.04 LTS, where the FileCloud server is 21.1 or higher.

Prior to running Ubuntu 20.04 LTS, we recommend backing up the Filecloud server, as well as /var/www/html and /var/lib/mongodb paths (the chance of deleting these files during the OS upgrade is very high).

The backup paths for the locations listed above are as follows:

  1. cp -rvf /var/www/html /var/www/html_backup
  2. cp -rvf /var/lib/mongodb /var/lib/mongodb_bkup

Upgrade Ubuntu 18.04 LTS to Ubuntu 20.04 LTS, where the FileCloud server is below 21.1

Once the backups have been created, the next step is to perform an Ubuntu package update with the following command:

apt-get update -y && apt-get upgrade -y
apt-get dist-upgrade -y
apt-get autoremove -y
sudo reboot
do-release-upgrade

Select all the default options when prompted. Toward the end of the upgrade, you will be prompted to restart.

Reinstall Apache and php

After the upgrade is complete, certain packages will need to be reinstalled, as they will have been removed by the upgrade process. To reinstall Apache and php, please follow the steps below:

LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php -y
add-apt-repository ppa:ondrej/apache2 -y
apt-get install unzip curl rsync python -y
apt-get install apache2 build-essential libssl-dev pkg-config memcached -y
apt-get install php7.2 php7.2-cli php7.2-common php7.2-dev php-pear php-dev php-zmq php7.2-zmq php7.2-json php7.2-opcache php7.2-mbstring php7.2-zip php7.2-memcache php7.2-xml php7.2-bcmath libapache2-mod-php7.2 php7.2-gd php7.2-curl php7.2-ldap php7.2-gmp php7.2-intl libreadline-dev php-pecl-http memcached php7.2-raphf php7.2-propro php7.2-mongodb php7.2-zmq -y
a2enmod php7.2
a2enmod headers
a2enmod ssl
apt-get -y install libmcrypt-dev
cat <(echo "") | pecl install mcrypt-1.0.2 2>&1
service apache2 status
//Get all the files from the backup, because the OS Ubuntu upgrade from v16 to v18 removed files:
rsync -avz /var/www/html_backup/ /var/www/html/
chown www-data:www-data /var/www/html -Rf

Install the cron job

If the FileCloud version is greater than or equal to 20.2, run the command below:

echo "*/5 * * * * php / /var/www/html/src/Scripts/cron.php" | crontab -u www-data –

If the FileCloud version is less than 20.2, run this command below:

echo "*/5 * * * * php /var/www/html/core/framework/cron.php" | crontab -u www-data –

If the above cronjob command fails, please follow the below method to perform cronjob troubleshooting and then run the command:

Check if /etc/cron.allow  ; if www-data is present:
vim /etc/cron.allow // Add “www-data” if not present.
crontab -e -u www-data // Make sure that the crontab editor pulls up if it does it will work. exit editor.
crontab -u www-data -l

Set up PHP CLI

To set up the PHP CLI, input the following command:

sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2

Run the below command:

php -v // Make sure it shows the version to make sure it is working.
php -m // Make sure it shows the modules to make sure it is working.

The expected output should be:

php -v
PHP 7.2.34-23+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jul  1 2021 16:06:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.2, Copyright (c) 2002-2018, by ionCube Ltd.
    with Zend OPcache v7.2.34-23+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
tp
gd
gettext
gmp
hash
iconv
intl
ionCube Loader
json
ldap
libxml
mbstring
mcrypt
memcache
mongodb
openssl
pcntl
pcre
PDO
Phar
posix
propro
raphf
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
zmq

[Zend Modules]
Zend OPcache
the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured)

Confirm FileCloud Server Upgrade

Once FileCloud is running and confirmed, you can run the FileCloud server upgrade with the below command:

filecloudcp -u

If the above command doesn’t work, use the command below:

wget http://patch.codelathe.com/tonidocloud/live/installer/filecloud-liu.sh && bash filecloud-liu.sh

Upgrading Ubuntu 18.04 LTS to Ubuntu 20.04 LTS where Filecloud server is 21.1 or higher

To upgrade Ubuntu 18.04 LTS to Ubuntu 20.04 LTS, we recommend stopping services first.

You can use the commands below to upgrade to 20.04 LTS:

apt update -y
apt-get update -y
apt-get upgrade -y
apt --purge autoremove
reboot

//Takes the backup of HTML folder

cp -rvf /var/www/html /var/www/html_new_backup

//Performs MongodDB backup

mongodump --out /root/db-dumps

apt install update-manager-core -y
service apache2 stop
service mongod stop
service fcorchestrator stop
service fcdocconverter stop
service solr stop
do-release-upgrade
a) Enter 'Yes' - (Pink screen) For restart services

Run Post-Upgrade Commands

Once the upgrade is complete, run post-upgrade commands detailed below:

Check lsb_release -sc  //should be "focal"

LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php -y
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/apache2 -y
sudo apt-get update -y
sudo apt-get install unzip curl rsync python -y
sudo apt-get install apache2 build-essential libssl-dev pkg-config memcached apt-transport-https language-pack-en -y
sudo apt-get install php7.4 php7.4-cli php7.4-common php7.4-dev php-pear -y
apt-get install php7.4-json php7.4-opcache php7.4-mbstring php7.4-zip php7.4-memcache php7.4-xml php7.4-bcmath libapache2-mod-php7.4 php7.4-gd php7.4-curl php7.4-ldap php7.4-gmp php7.4-mongodb php7.4-intl php7.4-mongodb libreadline-dev php-pecl-http php7.4-raphf libxml2-dev -y
sudo a2dismod php7.2
sudo a2enmod php7.4
a2enmod headers
a2enmod ssl
service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.4
sudo update-alternatives --set phar /usr/bin/phar7.4
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4
sudo update-alternatives --set phpize /usr/bin/phpize7.4
sudo update-alternatives --set php-config /usr/bin/php-config7.4

Perform Post-Upgrade Checks

After running post-upgrade commands, you can perform post-upgrade checks.

Check 1

php -v

//run this command only if multiple xml.ini exist
rm -rf /etc/php/7.4/cli/conf.d/20-xml.ini

//run this command only if multiple sysvshm.ini exist
rm -rf /etc/php/7.4/cli/conf.d/sysvshm.ini

apt-get install php7.4-propro -y

curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -

apt update -y

apt install -y nodejs

 

Check 2

cd /var/www/html
ls -al
mongo // mongo shell opens okay.
Reboot

Conclusion:

Upgrading the Ubuntu OS ensures the FileCloud server can perform even better than before! The FileCloud support team is also available to provide assistance or answer questions.

Article written by Nandakumar Chitrasuresh