Skip to content

Open Suse Scada Server Setup

sudo zypper update
sudo zypper install net-tools-deprecated


## install apache2

sudo zypper install apache2 
sudo systemctl start apache2
sudo systemctl enable apache2
### check appache2 status and version
systemctl status apache2
sudo httpd -v





## open fire wall ports 
sudo firewall-cmd --zone=public --add-port=80/tcp
sudo firewall-cmd --zone=public --add-port=8000/tcp
sudo firewall-cmd --zone=public --add-port=443/tcp
sudo firewall-cmd --zone=public --add-port=22/tcp
sudo firewall-cmd --zone=public --add-port=19999/tcp
sudo systemctl restart firewalld


* if this not work go to yast -->security and ../firewall and open the ports

## install filezilla
sudo zypper refresh
sudo zypper install filezilla
sudo zypper install composer
sudo zypper install php8-exif

sudo zypper install htop
sudo zypper in sshpass
sudo zypper install netdata
sudo service netdata start
sudo zypper install php8-fileinfo
sudo zypper install php8-pgsql




It is right.
real ip != localhost (aka 127.0.0.1)
but netdata default run as "localhost" in /etc/netdata/netdata.conf
bind to =
use "bind to = real ip"


# go to yast firewall and add to public port 19999


sudo netstat -plnt | grep netdata











sudo zypper install php8 php8-mysql apache2-mod_php8
sudo a2enmod php8
sudo systemctl restart apache2


## install sshpass
sudo zypper in sshpass
sudo zypper install phppgadmin













## install timescale db and postgress database

sudo zypper refresh
sudo zypper update

sudo zypper install postgresql15 postgresql15-server

* If you want a specific version, adjust 15 → 14, 13, etc.
* You can also check available versions with:

zypper se postgresql



## Set a password for the postgres account (requires root once)
su -                     * become root
passwd postgres          * set a password for postgres (temporary)
su - postgres
/usr/bin/initdb --locale=en_US.UTF-8 -E UTF8 -D /var/lib/pgsql/data
exit
exit
sudo systemctl enable postgresql
sudo systemctl start postgresql



### pass--Target490*


1) Add the repo (Leap 15.6)
sudo zypper addrepo -f https://download.opensuse.org/repositories/server:database:postgresql/15.6/server:database:postgresql.repo
sudo zypper refresh

sudo zypper install --allow-vendor-change postgresql15-timescaledb


## Enable it in PostgreSQL
 find your postgresql.conf path
sudo -u postgres psql -Atc "SHOW config_file;"
* suppose it prints: /var/lib/pgsql/data/postgresql.conf





# 1) Recover PostgreSQL (disable preload & any custom library path)
sed -i -E "s/^\s*shared_preload_libraries.*/# shared_preload_libraries = 'timescaledb'/" /var/lib/pgsql/data/postgresql.conf
sed -i -E "/^\s*dynamic_library_path\s*=/d" /var/lib/pgsql/data/postgresql.conf
systemctl start postgresql || { journalctl -u postgresql -n 60 --no-pager; exit 1; }

# 2) Install TimescaleDB built for PostgreSQL 16 (align with your server)
zypper install --allow-vendor-change postgresql16-timescaledb

# (optional but recommended) remove the PG15 TimescaleDB to avoid future confusion
# If you keep it, it's fine, but ensure no config points at PG15 paths.
# zypper remove -y postgresql15-timescaledb || true

# 3) Re-enable preload (DO NOT set dynamic_library_path now)
sed -i -E "s/^\s*#\s*shared_preload_libraries.*/shared_preload_libraries = 'timescaledb'/" /var/lib/pgsql/data/postgresql.conf

# 4) Restart PostgreSQL
systemctl restart postgresql
systemctl status postgresql --no-pager

# 5) Enable the extension (per database)
su - postgres -c "psql -c \"CREATE EXTENSION IF NOT EXISTS timescaledb;\""
su - postgres -c "psql -c \"\\dx\""


#install_pg_timescale_opensuse.sh

The script uses the official PostgreSQL repo and packagecloud’s helper to add the correct TimescaleDB repo for SUSE/openSUSE automatically.

It’s safe to re-run; it only installs/initializes when needed.

To skip DB creation: CREATE_DB=no sudo bash install_pg_timescale_opensuse.sh

To pick a different DB name: DB_NAME=mydb sudo bash install_pg_timescale_opensuse.sh



# Create Timescale Database `scada`

This guide explains how to create a new PostgreSQL database named **`scada`** and enable the **TimescaleDB** extension.

---

## 1. Switch to the `postgres` user
```bash
sudo -u postgres psql

2. Create the database

Inside the psql prompt, run:
CREATE DATABASE scada;

3. Connect to the database
\c scada

4. Enable the TimescaleDB extension
CREATE EXTENSION IF NOT EXISTS timescaledb;

5. Verify the extension
\dx


You should see timescaledb listed in the installed extensions.

The database scada is now created and TimescaleDB is enabled.



---

Do you also want me to extend this MkDocs page with **optional examples** (like creating a hypertable and retention policy), so your SCADA engineers have a ready-to-use template?




env file