HOW-TO - FPMI on Ubuntu Server

Ok, this is my attempt at a how to. No pictures… yet. I am assuming you already have Ubuntu server installed. The commands will look a little different for previous version of Ubuntu server, and I will fill in those gaps at a later time.

  1. This step updates all packages currently installed on the server

sudo apt-get update sudo apt-get upgrade

1b. Setup networking

sudo nano /etc/network/interfaces

for dhcp, keep the interface set as follows. Replace eth0 with the desired interface identifier.

# The primary network interface auto eth0 iface eth0 inet dhcp

For Static Ip mapping

# The primary network interface auto eth0 iface eth0 inet static address x.x.x.x netmask x.x.x.x gateway x.x.x.x

  1. Install the java runtime
sudo apt-get install sun-java6-jre

3.download the factoryPMI executable stack.

wget "http://www.inductiveautomation.com/downloads/products/?id=16&type=5"
  1. Unzip software to the location of your choosing. I use /opt/factorypmi. Set permissions

sudo mkdir /opt/factorypmi sudo mv FactoryPMI_3.3.3-b3269.tar.gz /opt/factorypmi/ cd /opt/factorypmi/ sudo tar xzf FactoryPMI_3.3.3-b3269.tar.gz sudo chown -R root.root . sudo chmod -R 755 .

  1. Setup the startup script
sudo ln -s  /opt/ignition/startGateway.sh /etc/init.d/factorypmi

Open the script for editing

sudo nano /opt/ignition/ignition.sh

Modify the last line of code scroll all the way to the end and add a space and &. The end of the line should look as follows

.gateway.Service &

install the script and delete the calls to shutdown factorypmi, as this code has not been added yet. Set permissions

sudo update-rc.d factorypmi defaults sudo rm /etc/rc0.d/K20factorypmi sudo rm /etc/rc1.d/K20factorypmi sudo rm /etc/rc6.d/K20factorypmi sudo chmod 755 factorypmi

6.Startup the service. For Ubuntu 9.10+, use the following command

sudo service factorypmi start

For 9.04 and before, use

sudo /etc/init.d/factorypmi start
  1. Browse to http://ipaddress:8080

That should be everything you need to get a working copy of FPMI working. I will add to this walkthough soon on how to install MySQl either from the repositories or from tar.gz. Also, I am looking a modifying the startup script to allow shutdown of the service, and running it as a different user.

This part will explain how to install MySQL from the Ubuntu respoitories.

1.Install MySQL using apt-get

sudo apt-get install mysql-server-5.1

2.Login to mysql

mysql -u root -p
  1. I like to change the root users name for a bit more security

update mysql.user set user='somename' where user='root'; flush privileges;

4.Add a remote user. % mean is a wildcard, in this case, it lets us connect from anywhere. This could be a security issue, but thats up to you to decide. Use a strong password. the . part corresponds to schema.table

grant all privileges on *.* to "someotheruser"@"%" identified by "somepass"; flush privileges; exit

And the should pretty much do it. Now just connect the dots and your good to go.

The version of MySQL in the Ubuntu repositories is not usually kept up to date. I normally install using binaries from MySQL.

1.Add mysql user. Make is a system account, and do not make a home directory.

sudo useradd -M -r mysql

2.Download binaries. You can replace the url with any source you want.

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.40-linux-i686-glibc23.tar.gz/from/http://mirror.trouble-free.net/mysql_mirror/
  1. Extract and move binaries to the final destination.

tar xzf mysql-5.1.40-linux-i686-glibc23.tar.gz sudo mv mysql-5.1.40-linux-i686-glibc23 /usr/local

  1. Sym Link the install directory to a standard directory

cd /usr/local sudo ln -s /usr/local/mysql-5.1.40-linux-i686-glibc23/ mysql

5.temporarily set owner user and group to mysql

cd mysql sudo chown -R mysql . sudo chgrp -R mysql .

  1. Initialize the database schemas
sudo scripts/mysql_install_db --user=mysql
  1. Set permanent owners.

sudo chown -R root . sudo chown -R mysql data

8.Copy the mysql server init script to /etc/init.d and install

sudo cp support-files/mysql.server /etc/init.d/mysql sudo update-rc.d mysql default

9.Link mysql binaries to /usr/bin

sudo ln -s /usr/local/mysql/bin/* /usr/bin
  1. Start MySQL. For 9.10+
sudo service mysql start

For 9.04-

sudo /etc/init.d/mysql start
  1. Log into mysql and set up users. Remove the test schema. Create factorypmi schema.

mysql -u root drop schema test; create schema factorypmi; delete from mysql.user where user=''; update mysql.user set user='someuser',password=PASSWORD('somepassword') where user='root'; flush privileges;

  1. Create remote user.

grant all privileges on *.* to 'someuser2'@'%' identified by 'somepassword'; flush privileges; exit

I think thats everything. Let me know if i forgot anything.

Kyle,

This looks great. Seeing it laid out like this makes a lot of sense. I’m going to give this a go and let you know how I get on.

Kyle - you’re the man. Fully expect us to take your work and turn it into a whitepaper/howto. Don’t worry - we’ll cite our sources :wink:

The only thing I dont like about the write up is running FactoryPMI as root. I dont know how to start java as another user without the wrapper. I know the next version of the software has the wrapper built in, and I am planning on doing a writeup for that too.

Kyle, if you don’t mind i’m going to copy your idea and list how to get Ignition installed under RHEL 5.

Just different enough I think it might be useful.