Adempiere Install for Windows & PostgreSQL
From ADempiere ERP Wiki
This install process applies to Windows operating systems and the PostgreSQL database.
This installation instruction is intended for initial installations where the database, application server and client all run on the same machine. For more complex installations, see Installation Steps.
An installation can take as little as 15 or 20 minutes if you start with the required downloads and do everything correctly.
Other alternatives you might want to investigate are the Windows Installer or VMWare/VirtualBox AVA packages. However, the following method will give you much more control over the installation including upgrades with the latest patches and scripts.
Before you begin, download each of the following packages:
- Java SE Development Kit - Get the latest from http://java.sun.com/javase/downloads/index.jsp. You only need the JDK without JavaFX, EE or NetBeans bundles.
- Postgre SQL - Get the latest Windows install from http://www.postgresql.org/download/windows.
- ADempiere Latest Release - Download the latest Adempiere from http://sourceforge.net/projects/adempiere/files/ADempiere Official Release.
- ADempiere Patches - From http://sourceforge.net/projects/adempiere/files/ADempiere Patches/ download the patches for the version of ADempiere downloaded above. The patches come in two files, a *_patches_*.jar and a *_migra_*.zip. You will need both.
Install the Pre-Requisites
Install the JAVA JDK with the default installation settings. Say OK to install the follow-on JRE as well.
Open Windows Explorer and navigate to the C:\Program Files\Java directory (or where-ever your Java is installed) and carefully note the full path for the JDK directory (e.g: C:\Program Files\java\jdk1.5.0_19) and the JRE directory that you have just installed.
There may well be a number of JDK and JRE directories, so choose the right one! The JDK should include the JRE.
Set the JAVA Environment Variables
On your Desktop (or using Start button / My Computer) right click My Computer and select System Properties / Advanced / Environmental Variables. (Alternatively: Start→Control Panel→System→Advanced tab.)
Add a new System Variable JAVA_HOME for your new JDK directory:
- JAVA_HOME use C:\Program Files\Java\jdk1.5.0_19 (or whatever your JDK directory is called)
Back in My Computer / System Properties / Advanced / Environmental Variables, find the Path variable and click Edit.
Append the following JDK path to the end of Path variable after putting in a connector semi-colon ";"
Do not delete or overwrite the paths that are already in the Path variable! Also, make sure you don't have an extra "\" at the end of path.
You can use an existing installation of PostgreSQL if you already have one. If so, gather the passwords for the postgres user, check the environment variable and path, verify that the service is running and move on to the next step.
Install PostgreSQL by running the Windows executable installer downloaded above. If you have problems, refer to PostgreSQL Installation & Setup for details.
- Account name: postgres
- Password: postgres (or whatever you want - but write your password down! - let me repeat - !!write it down!!)
- Port 5432 (the default port)
- Select your Locale and make sure the "pl/pgsql" box is ticked (which is the default)
- Uncheck the box "Launch Stack Builder at exit" and Finish. Cancel out of Stack Builder if it insists in launching
Create an environment variable POSTGRES_HOME set to the PostgreSQL install directory, for example "C:\Program Files\PostgreSQL\8.4"
Edit the PATH variable again and add %POSTGRES_HOME%\bin to the end of the path. This will make it easy to run the psql command from any directory.
In a DOS shell, type PATH and carefully check the result to ensure the JAVA and Postgres paths are correctly added to the PATH.
Start the PostgreSQL service. There will be a menu item in the PostgreSQL Start Menu to start the PostgreSQL service. It may already be running following the install. Check the running Services (Control Panel/Administrative Tools/Services).
Congratulations, you now have Postgres database running
Install the ADempiere Software
There is no install script. Just extract the Adempiere archive to <drive letter>:\ (e.g. c:\). For reference, call this directory $ADEMPIERE_ROOT. You should end up with the files in a folder like $ADEMPIERE_ROOT\Adempiere. For reference, call this folder $ADEMPIERE_HOME.
Do not extract to C:\Program Files\Adempiere. The batch scripts do not like directory names with spaces. If using a $ADEMPIERE_ROOT with multiple directories, avoid directory names with spaces.
Updating or Migrating to a More Recent Version
Back up your database before attempting to update. There is no way to revert a database to an earlier version once you have migrated to an newer one.
In the existing installation, save/rename any needed files (such as customization.jar). If you are not sure about this, it probably doesn't apply in your case.
Delete the contents of the following directories:
- $ADEMPIERE_HOME\migration (since 3.8.0)
Then extract the new ADempiere archive to the $ADEMPIERE_ROOT directory.
It is helpful to make a full backup of the $ADEMPIERE_HOME directory in case you need to revert.
Apply the Patches
Patches are a combination of *.jar files, which replace *.jar files in the $ADEMPIERE_HOME\lib directory, and migration scripts which update the database. In the Patches directory on Source Forge, there may be more than one type of *.jar that needs patching. If you downloaded one or more patch files, replace the existing file with the downloaded one, changing its name to match. For example, copy the *_patches_*.jar file to $ADEMPIERE_HOME\lib\patches.jar, overwriting the existing file. See the detailed instructions in Patches Installation.
If you are updating a patch file, it is a good idea to rename the existing *.jar file to something like patches.jar.old.
Apply Customizations, Packages and other Files
If you have a customization.jar with customized code or a packages.jar file with supporting *.jar files, add them to the $ADEMPIERE_HOME\lib directory, overwriting the existing files.
Also, if you have other customized files, such as *.bat files, a CustomReport.war file, etc..., don't forget to add them. If you don't know what this means, it doesn't apply to you. Yet. (It is useful to developers who want to add customized components to the install.)
Initial ADempiere Setup
A setup utility in ADempiere will prepare the software for use and create environment variables needed in the following steps.
Open a DOS shell with administrative privileges. Admin privileges are important here as the setup process will need to set environment variables.
Navigate to $ADEMPIERE_HOME and execute RUN_setup.bat. If this is the first time you are running this, a licence and security keys dialogs will appear. Accept the defaults.
The setup dialog will appear.
You will need to change:
- Database Server from <your-computer-name> to localhost
- Database Type from oracleXE to postgresql
- Database Name from xe to adempiere (You can use another name here if you like)
- System Password to postgres (or whatever you entered above for the database administrator)
- Database Password to adempiere
- Don't change anything in the Mail Server settings unless you want to set-up Adempiere for production purposes
You may also need to change the following:
- Adempiere Home to $ADEMPIERE_HOME (e.g. C:\Adempiere) if somehow it has been set to the wrong location
- Application Server Web Port to 8080 (if 80 is being used by something else) and SSL to 8443 (instead of 443)
Press the Test button
When the Test completes without errors and the Save button (bottom, right) is activated, click the Save button. Wait a few minutes until the Adempiere Server Setup screen disappears and the deployment is finished.
The database does not have a user adempiere or a database adempiere at this point, so these tests will not be checked. The user and database will be created in the next step.
Import ADempiere Example Data
The following script will DROP any existing adempiere database. Do not run this command if you already have data loaded.
Open a DOS shell.
Navigate to $ADEMPIERE_HOME\utils and type 'RUN_ImportAdempiere.bat'
As of Release 3.8.0, the RUN_ImportAdempiere script with also load and apply any xml migration scripts found in the $ADEMPIERE_HOME\migrations directory.
See CreateDatabase for more information.
Apply Migration Scripts
Prior to release 3.8.0, database migrations were performed using SQL scripts. From 3.8.0 onwards, the scripts are in XML. If you are migrating from an earlier version to a version 3.8.0 or later, you will need to apply the SQL to get to the start of the XML process and then apply the XML scripts from then on. For more information, see Migration.
The database installed above will be at the state of the release version and will have all migration scripts applied. If you are migrating an existing database to a new version or applying patches, you will also need to apply migration scripts to modify the database to keep it in sync with the software.
If you are not installing patches or migrating an existing database, skip this step.
SQL - Prior to Release 3.8.0
The migration scripts can be found in the *_migra_*.zip file downloaded above. Unzip the contents to a convenient directory.
Open a DOS shell and change to the directory where you saved these scripts. The script should all have a preface number. Starting at the lowest number and ascending, for each of the *.sql files, run:
- psql -f <number>.sql adempiere adempiere
You will need to enter the password adempiere each time.
If there is a tediously large number of scripts, try the following:
- Setup a '.pgpass' file according to the instructions for your version of PostgreSQL (for 8.4, see 30.14. The Password File). This will prevent the password entry each time you run the psql command.
- From a DOS shell, navigate to the directory where the scripts are located and execute this command:
- FOR %N IN (*.sql) DO psql -f %N adempiere adempiere
XML - Since Release 3.8.0
The XML migration scripts to apply should be saved in the $ADEMPIERE_HOME\migrations directory. These scripts will be included in *_migra_*.zip file. Unzip the contents to $ADEMPIERE_HOME\migrations.
The $ADEMPIERE_HOME\migrations directory should only contain the migrations to apply. If previous migrations are stored there, delete them or move them to a different directory. Any migration xml file in the directory will be applied and previous migrations, if applied a second time, could cause errors. See Jira Issue ADEMPIERE-328
To apply the scripts, execute the command $ADEMPIERE_HOME\utils\RUN_Migrate.bat from a dos shell.
Start the Application Server
Open a DOS shell Navigate to $ADEMPIERE_HOME\utils Type 'RUN_Server2.bat' and wait for the server to fully start - it will end this phase with "INFO [Server] JBoss .... Started in xx:xx:xx ms", which will take around 2 to 3 minutes.
Leave this DOS shell running. Later, to shut down the Application Server, you can either RUN_Server2Stop in another DOS Shell or simply close the shell.
Starting the Application Server Automatically
If you would like to run the server as a service, in a DOS shell, navigate to $ADEMPIERE_HOME\utils\windows and run Adempiere_Service_Install.bat. You will need to open the Services Window (Control Panel→Administrative Tools→Services) to set the properties so the service starts automatically or manually.
At this point, your installation is complete and you can move on to Launching the ADempiere Application.
Uninstall or Revert to Previous Version
To uninstall the software, simple delete the $ADEMPIERE_HOME directory. To delete the database, use the database administrator to drop the adempiere database and user.
To revert to the previous version, delete the $ADEMPIERE_HOME directory and copy the previous version to $ADEMPIERE_HOME. Restore the backed-up copy of the database using $ADEMPIER_HOME\utils\RUN_DBRestore.bat.