Introduction
This document shows how to deploy Projects in Linux Red Hat 8 through code lines. However, you need a PC as a client for doing the deployment in Red Hat 8 and make all necessary settings, after it, your Linux Server will keep running.
On this page:
Settings procedure
1 - We did this test using VMware Workstation 17 Player as the virtual machine, and we used RedHat Enterprise Linux 8.7 64-bit as the operational system.
2 - It was necessary to register and subscribe a RHEL system to the Red Hat Customer Portal using Red Hat Subscription-Manager using this command in prompt
Before that, get root permissions writing this in command line.
su //after clicking enter, it will ask for your RHEL password
subscription-manager register --username <username> --password <password> --auto-attach
You can find more information about it in the following link
https://access.redhat.com/solutions/253273
3 - Now we are going to download mono to make possible to run .NET Framework applications
First command to download Red Hat 8 is to update the system repository:
sudo dnf update
Second is to download the Mono package:
sudo dnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repo //This line code maybe will be necessary sudo dnf install mono-complete
After waiting to install all the package, write this command line to be sure that mono was installed correctly
mono --version
4 - On computer: Transfer folder "ProjectServer" localized in C:\Program Files (x86)\\\\IoT\ProjectServer .. and transfer to /home/username/ in Server Ubuntu. You can use any kind of file transfer, we generate a link from our driver, and access it in RHEL through Firefox browser.
5 - Deactivate Firewall in RHEL
systemctl stop firewalld
6 - Run the TServer using this command line, after this you Port will be open to receive TServer.
mono /home/user/Documents/ProjectServer/ProjectServer.exe //The path depends where you put the folder, this is just an example
7 - Now you need to create a Linux project on your computer, for this, follow the steps
Open 'Welcome' in FactoryStudio ->
Create new project with - Product Family: EdgeGateway;
Target Framework: Linux/Mono
In Welcome -> Server tab -> Remote -> Server Ip -> Connect button -> Update button -> Upload Project, you can choose the project created before
License tab -> Load license key
Projects -> Refresh -> Open project
Run -> Startup -> Run Startup button
8 - Now you can see in RHEL that your TServer is running, it should be like this:
If you are getting some error, please be sure that you are running in root level, just execute this command line:
su //after clicking enter, it will ask for your RHEL password
How to Deploy Projects and set FactoryStudio TServer as Service in Linux
This document shows how to deploy Projects in Linux through code lines (without graphics image in Ubuntu Server) and too how to initialize the FactoryStudio TServer automatically when Ubuntu is initialized. However, you need a PC as a client for doing the deployment in Linux and make all necessary settings, after it, your Linux Server will keep running.
The solution
Installation and Deploy Ubuntu
We used Putty and FileZilla software to access the Ubuntu Server.
On Ubuntu Server:
> sudo apt-get install openssh-server
On Computer:
Open putty and connect in Ubuntu Server
Through Putty or Linux Terminal:
commands of the PDF ‘How to Deploy Projects on Raspberry Pi or Linux’:
> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF > echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list > echo "deb http://download.mono-project.com/repo/debian wheezyapache24-compat main" | sudo tee -a /etc/apt/sources.list.d/monoxamarin.list > sudo apt-get update > sudo apt-get upgrade > sudo apt-get install mono-devel > sudo apt-get install mono-complete > sudo apt-get install referenceassemblies-pcl
On computer:
Transfer folder "ProjectServer" localized in C:\Program Files (x86)\\\\IoT\ProjectServer .. and transfer to /home/username/ in Server Ubuntu. We used FileZilla software to transfer.
On Putty or Linux Terminal:
install the xvfb with:
> sudo apt-get install xvfb
Create a screen with command:
> screen -S 'screen_name'
Use command to run server:
> xvfb-run mono /home/username/ProjectServer/ProjectServer.exe
Open 'Welcome' in FactoryStudio ->
Create new project with - Product Family: EdgeGateway;
Target Framework: Linux/Mono
In Welcome -> Server tab -> Remote -> Server Ip -> Connect button -> Update button -> Upload Project, you can choose the project created before
License tab -> Load license key
Projects -> Refresh -> Open project
Run -> Startup -> Run Startup button
If you wish you can run the project via ubuntu server using command:
> xvfb-run --auto-servernum --server-num=1 mono /home/username/TServer/TServer.exe /Project:project_name.tproj
AutoLogin Ubuntu
If your Ubuntu Server have Login and Password and you wish to enter in your Ubuntu server automatically you can do the steps below:
On Putty or Linux Terminal:
> sudo systemctl edit getty@tty1.service
This will the create a drop-in file (if neccessary) and open it an editor. Add the following, replacing myusername with your user name:
[Service] ExecStart= ExecStart=-/sbin/agetty --noissue --autologin myusername %I $TERM Type=idle
This will:
Create the folder /etc/systemd/system/getty@tty1.service.d if necessary
Create the file /etc/systemd/system/getty@tty1.smervice.d/override.conf if necessary
AutoRun FactoryStudio TServer with Service
When Ubuntu initializes your FactoryStudio TServer will initialize automatically.
On Putty or Linux Terminal:
> sudo su > nano /usr/local/sbin/my-startup.sh
You can write the text below to initialized your Server with this command:
#!/bin/sh xvfb-run mono /home/username/ProjectServer/ProjectServer.exe
Save it!
After:
> chmod +x /usr/local/sbin/my-startup.sh > nano /etc/systemd/system/my-startup.service
You can write the text below:
[Unit] Description=My Startup [Service] ExecStart=/usr/local/sbin/my-startup.sh [Install] WantedBy=multi-user.target
Save it too!
After:
> systemctl status my-startup.service > systemctl enable my-startup.service > reboot
Your Server will be running when Ubuntu initialized!
After reboot your Server Ubuntu you can open Welcome of FactoryStudio, 'Server' tab and connect again in "Remote -> Server IP" you can open your project and Run it.
In your FactoryStudio you can open "Trace Window" and you will could see information, errors, warning and debugs of your project.
In Putty you can write "systemctl status my-startup.service" and you will see status of project working.
On the computer, you can keep your project running and close the ‘Project Engineering’. In ‘Welcome FactoryStudio’ you can alter the ‘Remote’ to ‘Local’ and when you need to open your project and manage it, you need only access via “remote” again.
In this section...