Our blog

 

Setting Up Amazon’s AMTU on a Linux Server

Amazon helpfully supply a java package called AMTU which does the grunt work of the XML integration for Amazon marketplace. With AMTU you can easily update products, stock levels, prices and also grab order info etc.

Being based on Java, AMTU can run on pretty much any operating system. It uses a "hot folder" system so integration with client systems is as simple as dropping files into certain folders.

There are some good instructions for setting up AMTU on windows. That's great if you want to run it on your desktop (or a windows server if you are that way inclinded.... :-) ). However if you are one of my clients you are running a Linux server and need it setting up on there.

Unfortunately the documentation for AMTU on Linux is pretty lightweight. This blog post aims to help out anyone struggling with getting AMTU working on their server.

Before you start. Open up the README file (just download the package to your local machine). Have a quick read through and then understand that the README is simply wrong. It is a guide at best, but not strict instructions. They definitely haven't made it easy for us.

Speaking to Amazon about this, it is apparent that AMTU was developed by someone who is no longer around to support it. They have released it as open source software and basically left us to it. They are not willing to support it themselves.

Here's my instructions:

1. Log into SSH as root on your server.
Using your favourite SSH client. If you use linux you can just use the terminal, definitely my favourite way of handling SSH.

2. Navigate to the root folder that you want to install AMTU to.

CODE:
  1. cd /opt

3. Download the AMTU Files

CODE:
  1. mkdir amtu
  2.  
  3. cd amtu
  4.  
  5. wget http://freefr.dl.sourceforge.net/sourceforge/amtu/amtu-linux-1.0.9.tar.gz

4. Unpack the Archive

CODE:
  1. tar -xvf amtu-linux-1.0.9.tar.gz

5. Edit the config files

5.1 Find your JAVA_HOME

This may change depending on what version of Linux you are using. If you are not sure then use the following command to find out:

CODE:
  1. cat /etc/issue

The following command will show you which Java version you are running. If you are it doesn't work then it looks like you don't have Java installed. Please see Apendix A for Java install instructions.

CODE:
  1. java -version

You need to find out the exact path for java. You can use this command:

CODE:
  1. find / -name java

This will display a few lines. There is usually only one Java folder though with the others being symlinks (shortcuts kind of ) to the Java folder.

5.2 Edit the Install.sh File

First get into the AMTU folder:

CODE:
  1. cd /opt/amtu/

Now make sure you have your path to the JRE noted down somewhere and open up the install.sh for editing. For me the path is /usr/bin/java

CODE:
  1. vi install.sh

(vi is a text editor for linux. If you are not familiar with it simply search for "vi common commands or something like that).

Now go to the top of the file and add a new line. Replace /usr/bin/java with your own path to Java.

CODE:
  1. export JAVA_HOME=/usr/bin/java

6. Run the Install Script

First we need to make the install script executable.

CODE:
  1. chmod a+x install.sh

Now run the install script.

CODE:
  1. ./install.sh

7. Configure AMTU

This is where it gets interesting. AMTU is installed, but you haven't given it any kind of information regarding your Amazon account so how will it be able to connect to your specific account??

You need to use the configure.sh script to do this. For me this wouldn't work until I edited it and ran it manually. There is a configure.sh in the root amtu folder, however all this seems to do is run the configure script in the service folder.

Lets go straight to the service folder and get that one working.

CODE:
  1. cd /opt/amtu/service/bin
  2.  
  3. vi configure.sh

In this file they are mixing up the JAVA_HOME variable and appending /bin/java to it. I'm not really sure why they would do this.

First of all try running the script

CODE:
  1. ./configure.sh

If you get an error like:

./configure.sh: line 3: /bin/java: No such file or directory

Then you will need to edit the file. For me to get it to work I had to remove the following:

$JAVA_HOME/bin/java

and simply replace it with my path to Java which is:

/usr/bin/java

Then run the script again and it will ask you a bunch of questions. For most questions the default answers seem fine to me. You will need to know your SMTP details. You will want to log into your seller central account as well so that you can copy relevant details from there.

If it is all successful you should get a message similar to the following:

Please standby while your account details are verified...
Ping was successful
Updating configuration... done!

To alter this configuration, please use the Configuration Utility in the directory you installed this application.

Exiting Application

8. Starting the AMTU and Monitor services
To start the amt and amt_monitor services you need to manually start them. You can also check the status of these processes.

First get into the bin folder

CODE:
  1. cd /opt/amtu/service/bin

check status

CODE:
  1. ./amt status
  2.  
  3. ./amt_monitor status

If they are not started simply run the start commands

CODE:
  1. ./amt start
  2.  
  3. ./amt_monitor start

Running these two commands should have created some folders in your DocumentTransport folder. To check this out simply go to the folder and check

CODE:
  1. cd /opt/amtu/DocumentTransport
  2.  
  3. ls

You should see a folder called logs and a folder called production. The production folder contains our Hot Folder for sending files up to Amazon.

7. Set up symlinks
Once everything is working nicely, you will probably want to create symlinks from folders accessible by PHP.

Navigate to the place that PHP can access and which you would like to place a symlink to the production/outgoing folder. Then use the following command - replace the details as necessary

CODE:
  1. cd /home/path/to/php/accessible
  2.  
  3. ln -s /opt/amtu/DocumentTransport/production/outgoing my_amtu_symlink_folder_name

8. Test it Out
All you need to do to test it out is to drop a file into the /opt/amtu/DocumentTransport/production/outgoing folder (or the symlink to this folder that you have just created). Then wait 5 minutes (cup of tea time) and come back. Now browse through the production folders. If the file is in the /sent folder then your upload has worked OK. If it is in the /failed folder then something has gone wrong.

If like me it didn't work (surprise surprise) then you need to examine the log files to find out what the problem is. The best log to look in to start with is the audit_log.

CODE:
  1. cd /opt/amtu/DocumentTransport/logs
  2. vi amtu_audit.log

To go to the bottom of the file use the vi shortcut [shift]+[g]

As for figuring out exactly why AMTU doesn't like your feed file, I leave that bit to you.



Appendix

A. Install Java

These are instructions for a CentOS Linux install. Your Linux might be a different flavour. Simply search around for instructions for your specific setup.

A.1 Download JRE

Go to the Java downloads page
Find the link to the Linux Java JRE bin. (For CentOS you need the rpm version). Copy the link to your clipboard

CODE:
  1. cd opt
  2.     wget {link from clipboard for JRE download}

This will download the file. However as it is accessed via a script, it will give it a crazy long filename. Lets just rename that first. To rename a file with special characters simply wrap the filename in "" otherwise it won't work.

CODE:
  1. ls

now copy the filename to your clipboard

now paste it into this command

CODE:
  1. mv "filename from clipboard" jre-rpm.bin

Now we need to set the file as executable

CODE:
  1. chmod a+x jre-rpm.bin

Now we install it

CODE:
  1. ./jre-rpm.bin

This will then flash up a bunch of terms and conditions. Just hold down [return] until you get to the bottom, then type "yes".

To check its all installed use the command

CODE:
  1. java -version

You should get something similar to the following:

java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)

References
installing the latest jre on centos 5
AMTU Homepage
AMTU Forum - not much of use in there unfortunately

More...

More Reading:

13 Comments

[...] Posts Linux Symlink chown Setting Up Amazon’s AMTU on a Linux Server osCommerce Version 3 Roadmap osCommerce Version 3 System [...]

 

[...] Posts Online SSL Checker (Google Checkout) Linux Symlink chown Setting Up Amazon’s AMTU on a Linux Server osCommerce Version 3 [...]

 

Neuland
July 19th, 2009

hi, doing the installation i got this fail:
exec: 349: ./wrapper: not found

but the file wrapper is there!

---

java version \1.6.0_0\
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu10)
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)

---

what could be wrong?

Best regards from germany

 

admin
July 19th, 2009

I wouldn't use the openJDK if I were you.

Try installing the Sun JDK and see what happens. Wouldn't be surprised if that fixed it.

 

David J.
November 2nd, 2009

Thanks

Been running a version for a client for a few years but had to change the configuration.

With your help it took minutes to figure out how to do this.

David J.

 

Mike
April 7th, 2010

Have you performed many successful magento/AMTU integrations, then?

We're looking to move over to magento and one major question mark is what it would take to get the automated amazon market-place stuff up and working.

If this is something you can do for me then please give me a shout ;)

 

ice
April 23rd, 2010

This was verry helpful. thanks. We have the AMTU already running on one machine, but the howto was a help for another machine.

 

Brian
November 8th, 2010

THANK YOU! Your documentation made this possible..... as usual the "wild" documentation from Amazon is incomplete and non-functional. Would you please consider updating the Linux Readme with your documentation and contributing it back to the sourforge project?

Best Regards and many thanks.
running Ubuntu Lucid Lynx here.

Only modification for ubuntu was to scrap the Sun Java and use the OpenJRE... I spent an hour trying to install Sun and finally just tried the Open one instead. Seems Ubuntu has a vendetta against licensing and Sun will have no part of Ubuntu/Debian packages...

 

Brian
November 8th, 2010

Oh, I forgot to mention..... this removes *one more* business critical task from Windows and puts it on Linux!

 

Tony
November 12th, 2010

I'm having the same problem as Neuland when starting the amt and the amt_monitor services:

exec: 349: ./wrapper: not found

Using Ubuntu 10.04

java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.2) (6b18-1.8.2-4ubuntu2)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)

Has anyone figured this out?

 

Tony
November 12th, 2010

I found my answer here:
http://www.devcomments.com/Zend-Tool-Problem-Ubuntu-Jaunty-at107489.htm

Hi I thought I update you on how this problem was solved. It occurs that a
default instalation of ubuntu 10.04 64 bit comes without the libc6-i386
library. After installing the package everything works. I wish there was
a
more meaningful error from the Linux OS.

On Thu, Jul 8, 2010 at 11:09 AM, Christian Meisenbichler wrote:

I am using eXist 1.4 for a while. Now I want to move to a new
Machine, an
ubuntu 10.04 64-bit system. It works fine, except for the wrapper
script
ment to start the database.

the start script fails with:

sudo /data/eXist/tools/wrapper/bin/exist.sh start
Starting eXist Native XML Database...
exec: 349: ./wrapper: not found

The exact same thing works perfectly on my old system. So, can you
imagine
a reason why this would not work? What is this wrapper program
anyway, why
does it fail to start on the 64 bit system? And, why with this
strange
error?

 

admin
November 15th, 2010

Thanks for that Tony

for the record I always prefer to use the Sun Java version than the Ubuntu one..

Canonical don't use the Sun one because its not open source which is fair enough, but if you just want it to work well then the Sun one is the best IMO.

 

Stefan
November 29th, 2010

Same problem with the wrapper with "Debian GNU/Linux 5.0":

-bash: ./wrapper: No such file or directory

Solution:

apt-get install libc6-i386

 

 

Leave a Reply