# Installation on Linux

The installation instructions given here are done on Linux Mint 19 Cinnamon Edition. You can follow the same instructions for other versions. Check that you have an Internet connection and follow the instructions below.

Let's start by getting updates from our package list.

```bash
sudo apt-get update
```

Let's get the current repository for Java 8.

```bash
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
```

Now, begin the Java 8 open JDK installation.

```bash
sudo apt-get install openjdk-8-jdk
```

After completing the Java 8 installation, please note that our operating system already has the latest version of Java installed. We need to select the version of Java 8 as a default on our operating system. To do this use the following command;

```bash
sudo update-alternatives --config java
```

After this command, you will need to select the version of Java you want to use. You will see an output as shown in the example below.

![Java Sürümünün Seçimi](https://3585470428-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLGnZudlzfM63QD-_cp%2F-LQ0jDVozZ7EjpxoaSVn%2F-LQ0qDsEyKdV_tuNnuNy%2Fimage.png?alt=media\&token=4c2f0b23-5293-43ff-99bb-bcb099e89128)

Just enter the selection number for the Java 8 version you have installed and press enter.

Use the java version command to make sure that java is installed correctly. You will see an output as follows.

![Java sürümünün Kontrolü](https://3585470428-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLGnZudlzfM63QD-_cp%2F-LQ0xjBBz_ObDuilYf25%2F-LQ11-Qg_9cILDsU7gyQ%2Fimage.png?alt=media\&token=1c672205-5203-4797-9bf6-38f2604a4016)

After completing the Java 8 installation, the environment variables "JAVA\_HOME, LD\_LIBRARY\_PATH" must be set. To do this, we must set it in the "/etc/enviroment" file so that our environment variables are set each time our system is turned on. There are two ways to do this;

{% code title="1. Write directly to /etc/environment from the console." %}

```bash
sudo echo "JAVA_HOME=\"/usr/lib/jvm/java-8-openjdk-amd64\"" >> /etc/environment
sudo echo "LD_LIBRARY_PATH=/usr/local/lib" >> /etc/environment
```

{% endcode %}

veya

{% code title="2. Open the /etc/environment file with the nano editor. " %}

```bash
sudo nano /etc/environment

```

{% endcode %}

After setting our environment variables, you can restart your system to install or execute the below command;

```bash
source /etc/enviroment
```

Use the following commands to see if the environment variables are set correctly.

```bash
echo $JAVA_HOME
echo $LD_LIBRARY_PATH
```

So far we have completed Java 8 installation. Now we need to install the PostgreSQL database.

To begin installing PostgreSQL 9.6, we must first add the PostgreSQL 9.6 download repository to our package list. To do this, follow the instructions in order.&#x20;

```bash
sudo add-apt-repository -y "deb https://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-9.6
```

After the installation process is completed we need to create a username and password.

```bash
sudo -u postgres psql -c "ALTER USER postgres PASSWORD '1907';"
sudo passwd postgres
```

After these commands, you have completed the installation of PostgreSQL 9.6. Use the following command to test whether PostgreSQL is running.

```bash
sudo service postgresql status
```

We have completed the installation of PostgreSQL 9.6.&#x20;

Timeseries database influxDB installation;

```bash
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

sudo apt-get update && sudo apt-get install influxdb
sudo service influxdb start

```

We need to install redis, another important component for inSCADA. To do this;

```bash
sudo apt-get install redis-server
```

For inSCADA installation, create a folder in /opt/ folder with the name "inscada" and install it in this folder. We will also install the DNP3 protocol by following the commands below.

```bash
sudo mkdir /opt/inscada
sudo mkdir /opt/inscada/dnp
sudo apt-get install -y libasio-dev libssl-dev cmake g++ git
cd /opt/inscada/dnp
sudo git clone --recursive https://github.com/mkurt/dnp3.git
sudo cmake dnp3 -DDNP3_ALL=ON
sudo make
sudo make install
```

Download the file named inscada.sh from the link below and move it to the /opt/inscada/ folder.

{% file src="<https://3585470428-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLGnZudlzfM63QD-_cp%2F-LkTdmrqrw1xnz5L9s47%2F-LkTdrxhZ4PFVd6iBV7d%2Finscada.sh?alt=media&token=5e49e0a7-392f-4fc9-bfdf-70a7309875f3>" %}
inscada.sh
{% endfile %}

Use the following command to make the inscada.sh file executable.

```bash
sudo chmod u+x inscada.sh
```

Download the file named inscada.service from the link below and move it to the /etc/systemd/system/ folder.

{% file src="<https://3585470428-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLGnZudlzfM63QD-_cp%2F-LQ5l52-Z-Gf4nGHCIKw%2F-LQ5lDb1NuO3C237I9zX%2Finscada.service?alt=media&token=b2f20b72-683a-42e6-87fc-52d9b8d121f4>" %}
inscada.service
{% endfile %}

To introduce our service definition to the system, follow the commands below.

```bash
sudo systemctl daemon-reload
sudo systemctl enable inscada.service
sudo systemctl start inscada.service
```

You have run inSCADA. Finally, you can give the following command to see if it started correctly.

```bash
sudo systemctl status inscada.service
```

![inSCADA Service Status](https://3585470428-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLGnZudlzfM63QD-_cp%2F-LQ5oavwcDU1y_63QqwP%2F-LQ5qCMc1oDXJfgL_4sD%2Fimage.png?alt=media\&token=46976d11-6dc6-4441-ad0a-5ed37c2d30aa)

Congratulations you can now start using inSCADA. Please log in by typing '<https://localhost>: 8082' into your Chrome browser.

![inSCADA Login Page](https://3585470428-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLGnZudlzfM63QD-_cp%2F-LQ5rReuUd-3Lr8gxzXm%2F-LQ5rWHR8EnKooOnNp3X%2Fimage.png?alt=media\&token=32bc785b-7ec4-4209-8092-26cd1486da65)

{% hint style="info" %}
You may experience problems with some of the above instructions due to removal or modification of the repository links. You can get support from their own support pages or forms for the part you want to download.
{% endhint %}

{% hint style="info" %}
You may need to update your fonts on your operating system. To do this, follow the instructions below.
{% endhint %}

```bash
sudo wget http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.7_all.deb
sudo apt-get install ttf-mscorefonts-installer
```
