summaryrefslogtreecommitdiff
path: root/INSTALL
blob: fc600975a03a407ac60bd88dd9928702687b47cf (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/ledgersmb,
  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) Install the procedural language on your database server
  22. Note: installing here on the template1 database will permit it
  23. to propogate to every future database created, both those used
  24. by LedgerSMB (which require it) and to other databases you
  25. may create for other applications (which may not need it).
  26. If that is not what you want, consider first creating a
  27. template2-plpgsql database, adapting this command to install
  28. the language on that application specific template, leaving
  29. your template1 clean. Then you can use your template2-plpgsql
  30. database as a starting point for any datasets you create
  31. for LedgerSMB.
  32. We start by ensuring that the plpgsql language has not already
  33. been installed. If that first query does not result in a
  34. record where the 'lanname' field is 'plpgsql', then you need
  35. to install the procedural language.
  36. # su - postgres
  37. $ psql
  38. => \c template1
  39. => SELECT * FROM pg_language;
  40. => \q
  41. $ createlang plpgsql template1
  42. $ psql
  43. => ALTER ROLE postgres WITH PASSWORD 'YOURPASSWORD';
  44. Some distributions will create a postgres database user without
  45. ever prompting the user for an administrative password for
  46. the user. If you start as root, su - postgres and invoke
  47. psql from the postgres shell prompt, you would never need the
  48. postgres database user's password. But you will need to know
  49. the password later when you start creating accounting datasets.
  50. So might as well create one now.
  51. 3) Create a postgresql admin database role, by convention named
  52. 'ledgersmb':
  53. $ createuser --no-superuser --createdb --no-createrole \
  54. -U postgres --pwprompt --encrypted ledgersmb
  55. (\ is a bash line continuation character, this is a single command)
  56. The prompted password (referred to as MYROLEPASSWORD) will later be
  57. used in the DBConnect: string in the configuration file
  58. 'ledgersmb.conf'
  59. If you prefer to work in postgresql's psql console, the equivalent SQL
  60. statement to create the ledgersmb role is:
  61. => CREATE ROLE ledgersmb LOGIN PASSWORD 'MYROLEPASSWORD' NOINHERIT
  62. CREATEDB;
  63. Further commands and database interaction should be conducted using
  64. the new LedgerSMB admin role 'ledgersmb'.
  65. 4) Create a central user database, owned by the LedgerSMB admin role,
  66. 'ledgersmb':
  67. $ createdb -U ledgersmb -O ledgersmb ledgersmb
  68. The equivalent SQL statement is:
  69. => CREATE DATABASE ledgersmb WITH ENCODING='SQL_ASCII'
  70. OWNER=ledgersmb;
  71. 5) On the database that will store your user and session information,
  72. run the included Pg-central.sql SQL commands to configure the user
  73. and session tables and functions:
  74. $ psql -U ledgersmb -d ledgersmb -f LEDGERPATH/sql/Pg-central.sql
  75. (LEDGERPATH is in the location you expanded the release
  76. tarball file. If you untarred in '/usr/local' then LEDGERPATH will
  77. be '/usr/local/ledgersmb').
  78. NOTE: LedgerSMB's preferred configuration is to store the user and
  79. session management tables in a separate database from the company
  80. databases (aka 'datasets', created in admin.pl). If you are already
  81. working with or prefer to have your user and session tables in one
  82. company dataset, see further information in the manual. You must have
  83. PLPGSQL installed in the dataset as well. However that is beyond the
  84. scope of these instructions.
  85. 6) The SQL commands in step 5) created an LedgerSMB-managed admin user,
  86. e.g. a row in the users and users_conf table. You must now update the
  87. 'admin' user's password in users_conf from the default password.
  88. $ psql -U ledgersmb -d ledgersmb
  89. ledgersmb=> UPDATE users_conf SET password = md5('MYPASSWORD')
  90. WHERE id = 1;
  91. (Change MYPASSWORD to your preferred administrative password, which
  92. is separate, but can be the same spelling as MYROLEPASSWORD).
  93. ledgersmb=> \q
  94. 7) Edit the LEDGERPATH/ledgersmb.conf file:
  95. a) Copy 'ledgersmb.conf.default' to 'ledgersmb.conf'
  96. b) Make sure to set the section under [globaldb] to point to the
  97. central user and session database, using password MYROLEPASSWORD:
  98. [globaldb]
  99. DBname = ledgersmb
  100. DBhost = localhost
  101. DBport = 5432
  102. DBUserName = ledgersmb
  103. DBPassword = MYROLEPASSWORD
  104. 8) Add configuration to Apache:
  105. $ sh configure_apache.sh
  106. You will be prompted for the user which runs your apache server.
  107. This user is usually known as: apache, www-data, nobody or
  108. something similiar.
  109. You will also be prompted for the directory where you want to install
  110. the modified apache configuration file for LedgerSMB. On an apache2
  111. installation (at least on a Debian server) that would be:
  112. /etc/apache2/sites-available
  113. $ cd /etc/apache2/sites-available
  114. $ a2en ledgersmb-http.conf
  115. That will create a symlink in your ../sites-enabled/ directory
  116. and prompt you to restart your server.
  117. 9) Check Dependencies:
  118. The Build.PL script can be used to test for unmet dependencies and
  119. run other tests. It doesn't install anything yet, but it will tell
  120. you what you are missing. To check for dependencies, run:
  121. $ perl Build.PL
  122. Missing dependencies can generally be installed via a Linux
  123. distribution's package manager, or by CPAN. (Build.PL itself uses
  124. Module::Build, which is available in packages like perl-Module-Build
  125. or libmodule-build-perl.)
  126. Alternately you can use the Makefile.PL as follows:
  127. $ perl Makefile.PL
  128. That should serve essentially the same function as running
  129. Build.PL would.
  130. Once this is done and dependencies are satisfied, you can check to
  131. see whether the installation nominally works by running:
  132. $ ./Build test
  133. or, if you are using the makefile, try this instead:
  134. $ make
  135. $ make test
  136. The test suites currently check to make sure all the perl modules
  137. load and that a number of numeric tests are passed.
  138. Dependencies which are recommended are needed only for specific
  139. functionality and may not be required in all circumstances. These
  140. include:
  141. * Net::TCLink for credit card processing in a POS environment
  142. * Parse::RecDescent for the CLI script host
  143. Finally, if you are using the makefile, instead of the Build
  144. method, to install the application, as the root user, use this:
  145. # make install
  146. 10) Restart Apache (instructions vary with your Linux distro or operating
  147. system).
  148. On a Debian system try:
  149. # /etc/init.d/apache2 reload
  150. Create Datasets and Users
  151. =========================
  152. 1) Create Datasets:
  153. Browse to:
  154. http://hostname/ledgersmb/admin.pl
  155. login with 'MYPASSWORD'
  156. Create dataset(s) with:
  157. User: ledgersmb
  158. Password: MYPASSWORD
  159. Superuser: postgres
  160. Password: (postgres password)
  161. Create one dataset (a postgresql datatabase) for each separate
  162. company which will use LedgerSMB for accounting, e.g.:
  163. ledgeracme
  164. ledgerbigco
  165. (...)
  166. 2) Create User(s) pointing to specific datasets:
  167. Browse to:
  168. http://hostname/ledgersmb/admin.pl
  169. login with 'MYPASSWORD'
  170. Create user(s) pointing to a specific dataset (ledgeracme, etc.)
  171. with database login information:
  172. User: ledgersmb
  173. Password: MYPASSWORD
  174. Congratulations, you have installed and configured LedgerSMB 1.2
  175. FTP INSTALLATION
  176. ================
  177. If you control the server and have shell access, the instructions above
  178. are preferred over those given here. instead of those given here. This
  179. is simply a set of notes for those who must install on a shared server.
  180. If you do not have access to the server's configuration files install
  181. LedgerSMB in userspace by ftp'ing all the files to your server.
  182. 1) Untar ledgersmb in your private_html directory.
  183. 2) turn on script execution for the folder ledgersmb. You can control
  184. this with an .htaccess file:
  185. Options +ExecCGI
  186. DirectoryIndex login.pl
  187. 3) Protect the users directory with an .htpasswd file:
  188. order allow,deny
  189. deny from all
  190. 4) Protect the templates directory with an .htpasswd file:
  191. order allow,deny
  192. deny from all
  193. 5) Set up your PostgreSQL database and the tables. The procedure is
  194. specified above.
  195. You will most likely only have access to PostgreSQL with some other
  196. tools like pgadmin.
  197. TROUBLESHOOTING
  198. ===============
  199. Error: Access Denied in admin.pl
  200. ---------------------------------
  201. Likely causes:
  202. 1) The password entered may not match the password set in Manual Install
  203. step 5). You can repreat that step as often as you need to get login
  204. to admin.pl working, but in case your 'admin' user is not id=1, try
  205. using the expanded version of the SQL:
  206. ledgersmb==> UPDATE users_conf SET password=md5('MYPASSWORD')
  207. WHERE id = (SELECT id FROM user
  208. WHERE username = 'admin');
  209. (Substitute 'MYPASSWORD' for your chosen password).
  210. 2) The central database may have been created with a different postgres
  211. user (role) than you are using for the connection. In this case, you
  212. may not have permission to access the required database entities.
  213. To correct this, assuming that the admin database role is ledgersmb,
  214. issue the following commands from psql:
  215. ledgersmb==> GRANT ALL ON users TO ledgersmb;
  216. ledgersmb==> GRANT ALL ON users_id_seq TO ledgersmb;
  217. ledgersmb==> GRANT ALL ON users_conf TO ledgersmb;
  218. ledgersmb==> GRANT ALL ON session TO ledgersmb;
  219. ledgersmb==> GRANT ALL ON session_session_id_seq TO ledgersmb;
  220. Error: "No GlobalDBH Configured or Could not Connect"
  221. -----------------------------------------------------
  222. LedgerSMB 1.2 uses a dedicated connection to the central database for
  223. user authentication. When the attempt to connect to that database fails,
  224. the error message above is displayed. In this case, check the following
  225. parameters under the [globaldbh] of the ledgersmb.conf file.
  226. 1) DBUserName should match the database user you imported Pg-central
  227. as (if you followed the instructions above, that would be ledgersmb).
  228. 2) DBPassword needs to match the database password to used to connect
  229. to.
  230. You can test the above causes by running (from the command line):
  231. $ psql -U [DBUserName]
  232. password: [DBPassword]
  233. When you enter the password, it will not show up on the screen.
  234. The other line that you should pay attention to is the DBConnect
  235. line. Parameters in the form of name=value need to match those for
  236. your host. The following parameters need to be set correctly in that
  237. line:
  238. dbname=ledgersmb (the database you imported Pg-Central.sql into).
  239. host=localhost (don't change unless you know what you are doing!)
  240. port=5432 (don't change unless you know what you are doing!)
  241. The full line should then be something like:
  242. DBConnect: dbi:Pg:dbname=ledgersmb;host=localhost;port=5432
  243. And that section of ledgersmb.conf looks like:
  244. [globaldb]
  245. DBname = ledgersmb
  246. DBhost = localhost
  247. DBport = 5432
  248. DBUserName = ledgersmb
  249. DBPassword = MYROLEPASSWORD
  250. OTHER ISSUES:
  251. ===================================
  252. Before submitting a bug, please consult the COMPATABILITY list. This documents
  253. which versions of software have known interoperability problems with LedgerSMB.