Follow through this tutorial to learn how to upgrade existing OCS NG server installation on CentOS 7/CentOS 8. In our previous guides we covered how to install OCS-NG Inventory;
Install and Setup OCS NG Inventory Server on CentOS 7
Install OCS-NG Inventory on CentOS 8
Upgrading Existing OCS NG Server Installation on CentOS
So if you have an earlier installation of OCS NG server it can be upgraded to the latest version. This guide will cover upgrade existing OCS NG server installation.
The process involves:
- Remove installed plugins
- back-up existing configs used by OCS
- download the latest OCS-NG Inventory server archive
- follow through the installation process of OCS-NG
- finally restore backed-up OCS configs and access your latest OCS-NG server.
Removing Installed Plugins
Before running the update/installation its adviced to delete any existing plugins to avoid breaking of the update process. To delete a plugin navigate to Extensions -> Extensions Manager, select the plugin(s) and click the X icon to delete the plugin(s).
Remove any plugin configurations in /etc/ocsinventory-server/plugins
as well.
Backup Existing OCS Configs
Stop webserver service to prevent loss of data after bucking up OCS files:
systemctl stop httpd
The important files to be backed up for the update process are:
- z-ocsinventory-server.conf
- zz-ocsinventory-restapi.conf
- ocsinventory-reports.conf
- dbconfig.inc.php
Create a backup directory to make a copy of exesting OCS configaration files.
mkdir /opt/backup_ocs && cd /opt/backup_ocs
The first three files mentioned above are located inconf.d
directory of Apache webserver root configuration directory. Lets create a back up of the directory incase of any additional configurations done;
cp -r /etc/httpd/conf.d /opt/backup_ocs
Make a backup of Database configs as well;
cp /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php /opt/backup_ocs/
Backup OCS Database
Its a good practice to create a backup of OCS database incase the installation breaks or update gods bail on you.
mysqldump -u ocs -p [ocsdb] > /opt/backup_ocs/ocsdbbackup.sql
Update the existing OCS Server installation
Download the latest release of OCS from Github.
wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.9.2/OCSNG_UNIX_SERVER-2.9.2.tar.gz
Unpack the archive:
tar xzf OCSNG_UNIX_SERVER-2.9.2.tar.gz
Run the installation script and follow through the prompts to install latest version of OCS-NG inventory as covered on our previous installation guides. Press ENTER to accept the defaults.
cd OCSNG_UNIX_SERVER-2.9.2
sh setup.sh
Restore backed up configuration
Once the installation of latest OCS NG server is completed succesfully, restore the ocs configuration files that were backed up.
mv /etc/httpd/conf.d{,.clninstall}
cp -r /opt/backup_ocs/conf.d/ /etc/httpd/
mv /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php{,.orig}
cp /opt/backup_ocs/dbconfig.inc.php /usr/share/ocsinventory-reports/ocsreports/
Remove installation script
mv /usr/share/ocsinventory-reports/ocsreports/install.php{,.remove}
Access updated OCS NG Server
First update/set the proper permissions and ownership of OCS configuration files and adjust SELinux permissions on web server configuration files
chmod -R 766 /usr/share/ocsinventory-reports
chown -R apache:apache /usr/share/ocsinventory-reports
chown -R apache:apache /var/lib/ocsinventory-reports
chcon -R -t httpd_sys_rw_content_t /usr/share/ocsinventory-reports
Start apache webserver
systemctl start httpd
Access OCS web interface http://server-hostname-or-IP/ocsreports on the browser.
If prompted to update the database on the web interface, proceed to update by clicking update.
This brings us to the end of our guide.
Reference
Other tutorials