How to install MidServer on Linux hosted on VirtualBox

In this article I’m going to show how you can install MidServer on linux (CentOS7) using for that VirtualBox.
I’ll skip the VirtualBox installation. During the Centos installation you can choose default values if it’s not mentioned differently.

1. CentOS 7 Installation

You can download ISO file from (the minimal ISO is enough for our purpose):
https://www.centos.org/download/

Check in preferences (Ctrl + g) if there is NatNetwork created (if not add new one):

In VirtualBox add new machine: Type: Linux, Version: Red Hat (64-bit)

Next configure network settings for this machine:

  • Adapter 1:
    Attached to NatNetwork
  • Adapter 2:
    Host-only Adapter

Second thing is storage configuration and selecting ISO file for installation.

Next you can start machine.
During the installation turn on both network connection.

After beginning installation define password for root and create a new user (remember to check to make it an administrator).

2. OS configuration

Login to your server as user which you created during the installation.
First check if both network connections work. You can do this by the following command:

nmcli conn

In my case the second connection is off. I can turn it on using typing:

nmcli conn up enp0s8

Next you can type:

ip a s

and see something similar:

Next you have to make this connection up after rebooting the machine. You can do this by configuring file: /etc/sysconfig/network-scripts/ifcfg-enp0s8 (in my case the name is enp0s8 but it can differ on your machine).
Type:

sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s8

Take a backup of this file:

cp /etc/sysconfig/network-scripts/ifcfg-enp0s8 /home/snmidserver/ifcfg-enp0s8_backup

Find ‘ONBOOT’ parameter. To start modifying the file write ‘i’ and replace ‘no’ by ‘yes’. After that use ‘esc’ button and type ‘:wq’ to save changes.

It’s always good to update your server:

sudo yum update

3. JRE installation

To install jre in your server, type:

sudo yum install java-1.8.0-openjdk

Once the installation is completed you have to define JAVA_HOME variable to store information where java is installed. To find path to this foler use the below command:

sudo update-alternatives --config java

You should see something like this:

Take a backup of file you have to modify:

cp /etc/profile /home/snmidserver/profile_backup

Next:

sudo vi /etc/profile

Find the following line:

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

And one line below add new export (but use path which you finded above):

export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/bin/java"

Save file and reload changes:

source /etc/profile

Next check if everything has been configured correctly. Just type:

echo $JAVA_HOME

You should get path to your java directory.

4. MidServer installation

Create a new directory in /opt:

sudo mkdir /opt/midserver

Change owner and group for this new folder:

sudo chown snmidserver /opt/midserver
sudo chgrp snmidserver /opt/midserver

To download zip file with midserver I’m going to use curl.

In your ServiceNow instance go to MID Server => Download and copy link Linux 64 bit version

Go to your midserver directory:

cd /opt/midserver/

And use curl command to download zip file:

curl https://install.service-now.com/glide/distribution/builds/package/mid/2018/02/26/mid.jakarta-05-03-2017__patch8-02-14-2018_02-26-2018_1106.linux.x86-64.zip --output mid.jakarta-05-03-2017__patch8-02-14-2018_02-26-2018_1106.linux.x86-64.zip

Install unzip:

sudo yum install unzip

Unzip downloaded file:

unzip mid.jakarta-05-03-2017__patch8-02-14-2018_02-26-2018_1106.linux.x86-64.zip

Modify config file:

vi /opt/midserver/agent/config.xml

Find the following parameters and replace them by correct values:

  • parameter name=”url” value=”https://YOUR_INSTANCE.service-now.com”
  • parameter name=”mid.instance.username” value=”YOUR_INSTANCE_USER_NAME_HERE”
  • parameter name=”mid.instance.password” value=”YOUR_INSTANCE_PASSWORD_HERE” encrypt=”true”
  • parameter name=”name” value=”YOUR_MIDSERVER_NAME_GOES_HERE” (for instance: Linux_MidServer)

Next you have to add execute permission for two files:

chmod 740 /opt/midserver/agent/jre/bin/java
chmod 740 /opt/midserver/agent/bin/mid.sh

After we can install service:

sudo /opt/midserver/agent/bin/mid.sh install

And finally we can start our midserver:

sudo /opt/midserver/agent/bin/mid.sh start

Last thing is MidServer validation in your ServiceNow instance:

 

Leave a Reply

Your email address will not be published. Required fields are marked *