Manual installation

<< Click to Display Table of Contents >>

Navigation:  TeslaCloud Standalone Server > Installation Guide >

Manual installation

Previous pageReturn to chapter overviewNext page

Overview

Manual installation of the TeslaCloud Standalone Server provides full control over the installation and configuration process.

This method is intended for system administrators and advanced users who require custom configuration or integration with existing infrastructure.

The installation is performed step by step using standard Linux tools and services.


Server Preparation

Before installing TeslaCloud, update the operating system and install the required utilities.

sudo apt update && sudo apt upgrade -y
sudo apt install -y unzip curl wget gnupg2 ca-certificates lsb-release


Java Installation

TeslaCloud requires Java 8. OpenJDK 8 is recommended. Other compatible JDK distributions may also be used if required.

Install Java Repository

sudo apt install -y software-properties-common
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update

Install OpenJDK 8

sudo apt install -y openjdk-8-jdk


PostgreSQL Installation

Install PostgreSQL and additional database utilities.

sudo apt install -y postgresql postgresql-contrib

Create Database and User

Open the PostgreSQL console:

sudo -u postgres psql

Create the database and user for TeslaCloud:

CREATE DATABASE teslacloud;
CREATE USER tesla WITH PASSWORD '123456';
ALTER USER tesla WITH SUPERUSER;
\q


TeslaCloud Server Installation

Create Installation Directory

sudo mkdir -p /opt/servercloud
sudo chown $USER:$USER /opt/servercloud

Download and Extract TeslaCloud

cd /opt/servercloud
wget https://teslascada.com/Downloads/servercloud.zip
unzip servercloud.zip
rm servercloud.zip


Backend Configuration (systemd)

Create Service User

sudo useradd -r -s /bin/false servercloud

Set Permissions

sudo chown -R servercloud:servercloud /opt/servercloud
sudo mkdir -p /home/servercloud/.java/.userPrefs
sudo chown -R servercloud:servercloud /home/servercloud/.java
sudo chmod -R 700 /home/servercloud/.java

Create systemd Service

Create the service file:

/etc/systemd/system/servercloud.service

Service configuration:

[Unit]
Description=TeslaCloud
After=network.target postgresql.service
[Service]
Type=simple
User=servercloud
WorkingDirectory=/opt/servercloud
ExecStart=/usr/bin/java -jar servercloud.jar
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target

Enable and Start the Service

sudo systemctl daemon-reload
sudo systemctl enable servercloud
sudo systemctl start servercloud

Service Status and Logs

sudo systemctl status servercloud
journalctl -u servercloud -f


Nginx Installation and Configuration

Install Nginx

sudo apt install -y nginx

Create Nginx Configuration

Configuration file:

/etc/nginx/sites-available/servercloud

Example configuration:

server {
    listen 80;
    server_name domain.com;
    root /opt/servercloud/html;
    index index.html;
    location /mqtt {
        if ($http_upgrade != "websocket") {
            return 444;
        }
        proxy_pass http://127.0.0.1:1884/mqtt;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 86400;
        proxy_send_timeout 86400;
    }
    location /external/api {
        proxy_pass https://127.0.0.1:8090/external/api;
    }
    location / {
        try_files $uri $uri/ /index.html;
    }
}

Enable Nginx Configuration

sudo ln -s /etc/nginx/sites-available/servercloud /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
sudo rm /etc/nginx/sites-enabled/default


Final Permissions

Add User to servercloud Group

sudo usermod -aG servercloud user

Set Directory Permissions

sudo chown -R servercloud:servercloud /opt/servercloud
sudo chmod -R 775 /opt/servercloud


Completion

After completing all steps, TeslaCloud Standalone Server is installed and running as a background service.

The system is accessible through a web browser and operates entirely on the local server.

For a faster and simpler deployment, refer to the Automatic Installation section.