summaryrefslogtreecommitdiff
path: root/INSTALL
blob: 57d18bd851b7e0b4c149f121a6b09355945f0301 (plain)
  1. Installing LedgerSMB 1.2
  2. ========================
  3. This document contains information on how to install LedgerSMB. We
  4. recommend that the reader start by reading the section on manual
  5. installation and then start by trying the automated means mentioned
  6. later.
  7. Also this document assumes that the reader is already familiar with the
  8. release notes. If you have not already done so, please read the
  9. release_notes file in the doc/ directory.
  10. DISTRO AND OS-SPECIFIC NOTES
  11. ============================
  12. Debian users should read README.debian
  13. OpenBSD users, please consult the README.OpenBSD
  14. For Unix systems, '$' signifies the bash prompt, '=>' the psql prompt.
  15. MANUAL INSTALL
  16. ==============
  17. 1) Untar in desired location (for example, /usr/local/ledger-smb,
  18. refered to as LEDGERPATH for the remainder of this INSTALL file).
  19. LedgerSMB files should be owned by the apache user, apache:apache on
  20. many systems.
  21. 2) Create a postgresql admin database role, by convention named
  22. 'ledgersmb':
  23. $ createuser --no-superuser --createdb --no-createrole \
  24. -U postgres --pwprompt --encrypted ledgersmb
  25. (\ is a bash line continuation character, this is a single command)
  26. The prompted password (referred to as MYROLEPASSWORD) will later be
  27. used in the DBConnect: string in the configuration file
  28. 'ledger-smb.conf'
  29. The equivalent SQL statement to create the ledgersmb role is:
  30. => CREATE ROLE ledgersmb LOGIN PASSWORD 'MYROLEPASSWORD' NOINHERIT
  31. CREATEDB;
  32. Further commands and database interaction should be conducted using
  33. the new LedgerSMB admin role 'ledgersmb'.
  34. 3) Create a central user database, owned by the LedgerSMB admin role,
  35. 'ledgersmb':
  36. $ createdb -U ledgersmb -O ledgersmb ledgersmb
  37. The equivalent SQL statement is:
  38. => CREATE DATABASE ledgersmb WITH ENCODING='SQL_ASCII'
  39. OWNER=ledgersmb;
  40. 4) On the database that will store your user and session information,
  41. run the included Pg-central.sql SQL commands to configure the user
  42. and session tables and functions:
  43. $ psql -U ledgersmb -d ledgersmb -f LEDGERPATH/sql/Pg-central.sql
  44. (LEDGERPATH is in the location you expanded the release
  45. tarball file. If you untarred in '/usr/local' then LEDGERPATH will
  46. be '/usr/local/ledger-smb').
  47. NOTE: LedgerSMB's preferred configuration is to store the user and
  48. session management tables in a separate database from the company
  49. databases (aka 'datasets', created in admin.pl). If you are already
  50. working with or prefer to have your user and session tables in one
  51. company dataset, see further information in the manual. You must have
  52. PLPGSQL installed in the dataset as well. However that is beyond the
  53. scope of these instructions.
  54. 5) The SQL commands in step 4) created an LedgerSMB-managed admin user,
  55. e.g. a row in the users and users_conf table. You must now update the
  56. 'admin' user's password in users_conf from the default password.
  57. $ psql -U ledgersmb -d ledgersmb
  58. ledgersmb=> UPDATE users_conf SET password = md5('MYPASSWORD')
  59. WHERE id = 1;
  60. (Change MYPASSWORD to your preferred administrative password, which
  61. is separate, but can be the same spelling as MYROLEPASSWORD).
  62. ledgersmb=> \q
  63. 6) Edit the LEDGERPATH/ledger-smb.conf file:
  64. a) Copy 'ledger-smb.conf.default' to 'ledger-smb.conf'
  65. b) Make sure to set the section under [globaldbh] to point to the
  66. central user and session database, using password MYROLEPASSWORD:
  67. [globaldb]
  68. DBConnect: dbi:Pg:dbname=ledgersmb;host=localhost;port=5432
  69. DBUserName: ledgersmb
  70. DBPassword: MYROLEPASSWORD
  71. 7) Add configuration to Apache:
  72. $ sh configure_apache.sh
  73. 8) Check Dependencies:
  74. The Build.PL script can be used to test for unmet dependencies and
  75. run other tests. It doesn't install anything yet, but it will tell
  76. you what you are missing. To check for dependencies, run:
  77. $ perl Build.PL
  78. Missing dependencies can generally be installed via a Linux
  79. distribution's package manager, or by CPAN. (Build.PL itself uses
  80. Module::Build, which is available in packages like perl-Module-Build
  81. or libmodule-build-perl.)
  82. Once this is done and dependencies are satisfied, you can check to
  83. see whether the installation nominally works by running:
  84. $ ./Build test
  85. The test suites currently check to make sure all the perl modules
  86. load and that a number of numeric tests are passed.
  87. Dependencies which are recommended are needed only for specific
  88. functionality and may not be required in all circumstances. These
  89. include:
  90. * Net::TCLink for credit card processing in a POS environment
  91. * Parse::RecDescent for the CLI script host
  92. 9) Restart Apache (instructions vary with your Linux distro or operating
  93. system).
  94. Create Datasets and Users
  95. =========================
  96. 1) Create Datasets:
  97. Browse to:
  98. http://hostname/ledger-smb/admin.pl
  99. login with 'MYPASSWORD'
  100. Create dataset(s) with:
  101. User: ledgersmb
  102. Password: MYPASSWORD
  103. Superuser: postgres
  104. Password: (postgres password)
  105. Create one dataset (a postgresql datatabase) for each separate
  106. company which will use LedgerSMB for accounting, e.g.:
  107. ledgeracme
  108. ledgerbigco
  109. (...)
  110. 1) Create User(s) pointing to specific datasets:
  111. Browse to:
  112. http://hostname/ledger-smb/admin.pl
  113. login with 'MYPASSWORD'
  114. Create user(s) pointing to a specific dataset (ledgeracme, etc.)
  115. with database login information:
  116. User: ledgersmb
  117. Password: MYPASSWORD
  118. Congratulations, you have manually installed LedgerSMB 1.2.
  119. FTP INSTALLATION
  120. ================
  121. If you control the server and have shell access, the instructions above
  122. are preferred over those given here. instead of those given here. This
  123. is simply a set of notes for those who must install on a shared server.
  124. If you do not have access to the server's configuration files install
  125. LedgerSMB in userspace by ftp'ing all the files to your server.
  126. 1) Untar ledger-smb in your private_html directory.
  127. 2) turn on script execution for the folder ledger-smb. You can control
  128. this with an .htaccess file:
  129. Options +ExecCGI
  130. DirectoryIndex login.pl
  131. 3) Protect the users directory with an .htpasswd file:
  132. order allow,deny
  133. deny from all
  134. 4) Protect the templates directory with an .htpasswd file:
  135. order allow,deny
  136. deny from all
  137. 5) Set up your PostgreSQL database and the tables. The procedure is
  138. specified above.
  139. You will most likely only have access to PostgreSQL with some other
  140. tools like pgadmin.
  141. TROUBLESHOOTING
  142. ===============
  143. Error: Access Denied in admin.pl
  144. ---------------------------------
  145. Likely causes:
  146. 1) The password entered may not match the password set in Manual Install
  147. step 5). You can repreat that step as often as you need to get login
  148. to admin.pl working, but in case your 'admin' user is not id=1, try
  149. using the expanded version of the SQL:
  150. ledgersmb==> UPDATE users_conf SET password=mp5('MYPASSWORD')
  151. WHERE id = (SELECT id FROM user
  152. WHERE username = 'admin');
  153. (Substitute 'MYPASSWORD' for your chosen password).
  154. 2) The central database may have been created with a different postgres
  155. user (role) than you are using for the connection. In this case, you
  156. may not have permission to access the required database entities.
  157. To correct this, assuming that the admin database role is ledgersmb,
  158. issue the following commands from psql:
  159. ledgersmb==> GRANT ALL ON users TO ledgersmb;
  160. ledgersmb==> GRANT ALL ON users_id_seq TO ledgersmb;
  161. ledgersmb==> GRANT ALL ON users_conf TO ledgersmb;
  162. ledgersmb==> GRANT ALL ON session TO ledgersmb;
  163. ledgersmb==> GRANT ALL ON session_session_id_seq TO ledgersmb;
  164. Error: "No GlobalDBH Configured or Could not Connect"
  165. -----------------------------------------------------
  166. LedgerSMB 1.2 uses a dedicated connection to the central database for
  167. user authentication. When the attempt to connect to that database fails,
  168. the error message above is displayed. In this case, check the following
  169. parameters under the [globaldbh] of the ledger-smb.conf file.
  170. 1) DBUserName should match the database user you imported Pg-central
  171. as (if you followed the instructions above, that would be ledgersmb).
  172. 2) DBPassword needs to match the database password to used to connect
  173. to.
  174. You can test the above causes by running (from the command line):
  175. $ psql -U [DBUserName]
  176. password: [DBPassword]
  177. When you enter the password, it will not show up on the screen.
  178. The other line that you should pay attention to is the DBConnect
  179. line. Parameters in the form of name=value need to match those for
  180. your host. The following parameters need to be set correctly in that
  181. line:
  182. dbname=ledgersmb (the database you imported Pg-Central.sql into).
  183. host=localhost (don't change unless you know what you are doing!)
  184. port=5432 (don't change unless you know what you are doing!)
  185. The full line should then be something like:
  186. DBConnect: dbi:Pg:dbname=ledgersmb;host=localhost;port=5432
  187. And that section of ledger-smb.conf looks like:
  188. [globaldb]
  189. DBConnect: dbi:Pg:dbname=ledgersmb;host=localhost;port=5432
  190. DBUserName: ledgersmb
  191. DBPassword: MYROLEPASSWORD
  192. OTHER ISSUES:
  193. ===================================
  194. Before submitting a bug, please consult the COMPATABILITY list. This documents
  195. which versions of software have known interoperability problems with LedgerSMB.