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