summaryrefslogtreecommitdiff
path: root/INSTALL
blob: e86d32af2b769255705b90db33f9964d43024600 (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. DBname = ledgersmb
  69. DBhost = localhost
  70. DBport = 5432
  71. DBUserName = ledgersmb
  72. DBPassword = MYROLEPASSWORD
  73. 7) Add configuration to Apache:
  74. $ sh configure_apache.sh
  75. 8) Check Dependencies:
  76. The Build.PL script can be used to test for unmet dependencies and
  77. run other tests. It doesn't install anything yet, but it will tell
  78. you what you are missing. To check for dependencies, run:
  79. $ perl Build.PL
  80. Missing dependencies can generally be installed via a Linux
  81. distribution's package manager, or by CPAN. (Build.PL itself uses
  82. Module::Build, which is available in packages like perl-Module-Build
  83. or libmodule-build-perl.)
  84. Once this is done and dependencies are satisfied, you can check to
  85. see whether the installation nominally works by running:
  86. $ ./Build test
  87. The test suites currently check to make sure all the perl modules
  88. load and that a number of numeric tests are passed.
  89. Dependencies which are recommended are needed only for specific
  90. functionality and may not be required in all circumstances. These
  91. include:
  92. * Net::TCLink for credit card processing in a POS environment
  93. * Parse::RecDescent for the CLI script host
  94. 9) Restart Apache (instructions vary with your Linux distro or operating
  95. system).
  96. Create Datasets and Users
  97. =========================
  98. 1) Create Datasets:
  99. Browse to:
  100. http://hostname/ledger-smb/admin.pl
  101. login with 'MYPASSWORD'
  102. Create dataset(s) with:
  103. User: ledgersmb
  104. Password: MYPASSWORD
  105. Superuser: postgres
  106. Password: (postgres password)
  107. Create one dataset (a postgresql datatabase) for each separate
  108. company which will use LedgerSMB for accounting, e.g.:
  109. ledgeracme
  110. ledgerbigco
  111. (...)
  112. 1) Create User(s) pointing to specific datasets:
  113. Browse to:
  114. http://hostname/ledger-smb/admin.pl
  115. login with 'MYPASSWORD'
  116. Create user(s) pointing to a specific dataset (ledgeracme, etc.)
  117. with database login information:
  118. User: ledgersmb
  119. Password: MYPASSWORD
  120. Congratulations, you have manually installed LedgerSMB 1.2.
  121. FTP INSTALLATION
  122. ================
  123. If you control the server and have shell access, the instructions above
  124. are preferred over those given here. instead of those given here. This
  125. is simply a set of notes for those who must install on a shared server.
  126. If you do not have access to the server's configuration files install
  127. LedgerSMB in userspace by ftp'ing all the files to your server.
  128. 1) Untar ledger-smb in your private_html directory.
  129. 2) turn on script execution for the folder ledger-smb. You can control
  130. this with an .htaccess file:
  131. Options +ExecCGI
  132. DirectoryIndex login.pl
  133. 3) Protect the users directory with an .htpasswd file:
  134. order allow,deny
  135. deny from all
  136. 4) Protect the templates directory with an .htpasswd file:
  137. order allow,deny
  138. deny from all
  139. 5) Set up your PostgreSQL database and the tables. The procedure is
  140. specified above.
  141. You will most likely only have access to PostgreSQL with some other
  142. tools like pgadmin.
  143. TROUBLESHOOTING
  144. ===============
  145. Error: Access Denied in admin.pl
  146. ---------------------------------
  147. Likely causes:
  148. 1) The password entered may not match the password set in Manual Install
  149. step 5). You can repreat that step as often as you need to get login
  150. to admin.pl working, but in case your 'admin' user is not id=1, try
  151. using the expanded version of the SQL:
  152. ledgersmb==> UPDATE users_conf SET password=mp5('MYPASSWORD')
  153. WHERE id = (SELECT id FROM user
  154. WHERE username = 'admin');
  155. (Substitute 'MYPASSWORD' for your chosen password).
  156. 2) The central database may have been created with a different postgres
  157. user (role) than you are using for the connection. In this case, you
  158. may not have permission to access the required database entities.
  159. To correct this, assuming that the admin database role is ledgersmb,
  160. issue the following commands from psql:
  161. ledgersmb==> GRANT ALL ON users TO ledgersmb;
  162. ledgersmb==> GRANT ALL ON users_id_seq TO ledgersmb;
  163. ledgersmb==> GRANT ALL ON users_conf TO ledgersmb;
  164. ledgersmb==> GRANT ALL ON session TO ledgersmb;
  165. ledgersmb==> GRANT ALL ON session_session_id_seq TO ledgersmb;
  166. Error: "No GlobalDBH Configured or Could not Connect"
  167. -----------------------------------------------------
  168. LedgerSMB 1.2 uses a dedicated connection to the central database for
  169. user authentication. When the attempt to connect to that database fails,
  170. the error message above is displayed. In this case, check the following
  171. parameters under the [globaldbh] of the ledger-smb.conf file.
  172. 1) DBUserName should match the database user you imported Pg-central
  173. as (if you followed the instructions above, that would be ledgersmb).
  174. 2) DBPassword needs to match the database password to used to connect
  175. to.
  176. You can test the above causes by running (from the command line):
  177. $ psql -U [DBUserName]
  178. password: [DBPassword]
  179. When you enter the password, it will not show up on the screen.
  180. The other line that you should pay attention to is the DBConnect
  181. line. Parameters in the form of name=value need to match those for
  182. your host. The following parameters need to be set correctly in that
  183. line:
  184. dbname=ledgersmb (the database you imported Pg-Central.sql into).
  185. host=localhost (don't change unless you know what you are doing!)
  186. port=5432 (don't change unless you know what you are doing!)
  187. The full line should then be something like:
  188. DBConnect: dbi:Pg:dbname=ledgersmb;host=localhost;port=5432
  189. And that section of ledger-smb.conf looks like:
  190. [globaldb]
  191. DBConnect: dbi:Pg:dbname=ledgersmb;host=localhost;port=5432
  192. DBUserName: ledgersmb
  193. DBPassword: MYROLEPASSWORD
  194. OTHER ISSUES:
  195. ===================================
  196. Before submitting a bug, please consult the COMPATABILITY list. This documents
  197. which versions of software have known interoperability problems with LedgerSMB.