Friday 24 October 2014

Easy steps to install Dolibarr

Install Dolibarr


On your dedicated computer/server

Logo windows.png With DoliWamp (Windows .exe package)

- Prerequisite: Windows
- Level: Non experienced users
This process works only for Windows users and is recommended for user with no computer knowledges. If you are experimented with Apache, PHP and Mysql installation, next chapter is better for you. However, if you are a newbie user and running Windows, you can use DoliWamp. DoliWamp is a specialized Dolibarr distribution for Windows. This distribution allows you to make an installation under Windows with all prerequisites (Apache, Mysql, PHP) and with no computer knowledge. This is steps to install DoliWamp:
  • Download last Dolibarr version for Windows DoliWamp.
For this, see page download DoliWamp on NLTechno web site.
  • Run the downloaded .exe and follow instructions.

Logo ubuntu.png With DoliDeb (Debian or Ubuntu .deb package)

- Prerequisite: Linux Ubuntu
- Level: Non experienced users
This process works only for Ubuntu or Debian Linux users and is recommended for user with no computer knowledges. If you are experimented with Apache, PHP and Mysql installation, chapter 'with standard pakcage' is better for you. However, if you are a newbie user and running Ubuntu, you can use DoliDeb. DoliDeb is a specialized Dolibarr distribution for Debian or Ubuntu. This distribution allows you to make an installation under Ubuntu with all prerequisites (Apache, Mysql, PHP) and with no computer knowledge.

Logo rpm.png With DoliRpm (Fedora, Redhat, Mandriva, Mageia or OpenSuse .rpm package)

- Prerequisite: Linux Fedora, Redhat, Mandriva, Mageia or OpenSuse
- Level: Non experienced users
This process works only for Fedora, Redhat, Mandriva, Mageia or OpenSuse Linux users and is recommended for user with no computer knowledges. If you are experimented with Apache, PHP and Mysql installation, next chapter 'with standard package' is better for you. However, if you are a newbie user and running Fedora or Redhat, you can use DoliRpm. DoliRpm is a specialized Dolibarr distribution for Fedora, Redhat or Mandriva. This distribution allows you to make an installation under such OS with all prerequisites (Apache, Mysql, PHP) and with no computer knowledge.

Gnu.png With Dolibarr (standard .tgz package)

- Prerequisite: Apache, PHP and a database server (MySQL or PostgreSQL) are already running correctly and user/pass (of a new database or root server) is known.
- Level: Users with few Web and Database administration knowledges.
This procedure describe manual (and recommended) installation on a GNU/Linux system (Debian, Mandriva, ...), it can be used for other OS with minor changes. You can follow this tutorial for any Dolibarr version >= 2.0.0
  • Check that you have installed Apache, PHP 5.3.0+ (requires functions like DateTimeZone.getOffset) and a database server (MySQL 4.1+ or PostGreSQL) correctly (check list of installed packaged on your server by using the package manager of your distribution). If not, install them (use last recent version).
  • Check that main root or admin user/password couple for the server is known and works correctly. If this root or admin user/password is not known because not yet defined, read following chapter. Otherwise go on next step:
For Linux users, if you have just installed a MySQL server, the admin user is root. If the root password has never been set yet, you must run the following command to initialize the password:
mysql
Once in Mysql interface, run the SQL command to modify the root password:
GRANT ALL privileges ON *.* TO root@'localhost' IDENTIFIED BY 'newrootpass' WITH GRANT OPTION;
Then enter and \q to quit.
To check that connexion with the new couple user/password works, launch the command
mysql -u root -p
And type your password newrootpass then \q to quit if connexion has been successfull.
For Linux users, if you have just installed a PostgreSQL server, you must run the following command to initialize an admin user and password. For this, add the following line in file /etc/postgresql/x.x/main/pg_hba.conf (replace x.x with your postgres version)
local   all         dolibarrowner    md5
Also, comment the line
#local   all         all                               ident
This line ensure that system login used to connect to database (it will be login the web server run with), is same than database account (this is never the case).
Then launch commands from a root shell
sudo -s -u postgres
createuser dolibarrowner
psql -h localhost -d template1 -c "alter user dolibarrowner with password 'dolibarrownerpass'"
exit
sudo /etc/init.d/postgresql restart
You can test a connection with this user with command
psql -d postgres -U dolibarrowner -W
And type your dolibarrownerpass as password and \q to quit if connection is ok.


  • Go into the directory where to install Dolibarr (the web root directory defined for your web server)
  1. For Debian and Ubuntu families, it is generally: /var/www
  2. For Mandriva, RedHat, Fedora: /var/www/html
  3. For Suse: /srv/www/htdocs
$ cd /var/www
or
$ cd /var/www/html
  • Get the application archive of last stable version
$ wget http://www.dolibarr.org/files/dolibarr.tgz
  • Uncompress archive
$ tar xvfz dolibarr.tgz
  • Rename directory dolibarr-x.y.z into dolibarr to have a directory name that does not depends on version (replace x.y.z with source version)
$ mv dolibarr-x.y.z dolibarr
  • Change permission and owner of the 'dolibarr' directory to that of the group under which the web server runs (assumed to be 'www-data' for debian, 'apache' for redhat, mandriva, fedora)
$ chmod -R 755 /var/www/dolibarr
$ chown -R www-data.www-data /var/www/dolibarr
or
$ chmod -R 755 /var/www/html/dolibarr
$ chown -R apache.apache /var/www/html/dolibarr
  • For Fedora, since SELinux is usually enabled, it is also advisable to run the following commands to make the 'dolibarr' directory compliant with the SELinux requirement (else you are likely to get quite a few alerts) :
$ semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/dolibarr(/.*)?'
$ restorecon -R -v '/var/www/html/dolibarr'
  • As a root user, create, into directory dolibarr/htdocs/conf, an empty configuration file called conf.php and set, as owner, the web server user (example www-data on Debian, apache on Mandriva, RedHat, Fedora or other distributions ...). This is required because the web server will have to write into this file during install process.
$ cd dolibarr ; touch htdocs/conf/conf.php ; chown www-data htdocs/conf/conf.php
  • As a root user, create a directory that will be used to save all files generated and stocked by Dolibarr (PDf invoices, uploaded images, ...), and attribute to this directory a owner that must be the web server (example www-data on Debian, apache on Mandriva, RedHat, Fedora...). The web server must have write permission into this directory. It is recommanded to use a directory outside of your directory of web pages, for example - "/var/lib/dolibarr/documents"
$ mkdir documents ; chown www-data documents
  • Now call your browser to point to the main page
http://127.0.0.1/dolibarr/htdocs/
  • Follow instructions of setup steps until end of install process.
  • For security reason, we recommend, once setup is finished, to create a file install.lock into Dolibarr installed directory that only root user can delete. This will lock the call of the install process again (you will have to remove this file for upgrades).
If this is not done, Dolibarr will show you a warning once logged by an administrator user.
$ touch /var/www/dolibarr/install.lock; chmod go-w /var/www/dolibarr;

On a mutualized Web Hosting Provider (with restricted access)

It is not possible to provide a generic documentation to install Dolibarr on a particular Web hosting provider as this depends on provider. In most cases, using the following process should works for most providers:
- Prerequisite: Apache web server, PHP and a database server (MySQL or PostgreSQL) are already running correctly and user/pass (of a new database or root server) is known.
- Level: Users with few Web and Database administration knowledges. Knowledge to use a tool (FTP, SFTP) to upload files on the server.
  • Check that you have an Apache web server, PHP and a database server (MySQL or PostGreSQL) that works correctly.
Warning.png Warning, check that code page of PHP server and database server are same.
  • Check that main root or admin user/password couple for the server is known and works correctly. Ask them to your Web Hosting Provider if unknown.
  • Get the application archive of last stable version and uncompress it locally.
  • Upload all content of htdocs directory to your web root directory, for example using FTP in binary mode.
  • Create a directory called "documents" into Dolibarr directory that will serve to save all documents generated and stocked by Dolibarr (PDF invoices, uploaded images, ...). The web server must have write permission into this directory. You can set permissions with your FTP client.
  • Now call your browser to point to the main page index.php
  • Follow instructions of setup steps until end of install process.
  • For security reason, we recommend, once setup is finished, to create a file install.lock into Dolibarr installed directory. This will lock the call of the install process again (you will have to remove it for upgrades). If this is not done, Dolibarr will show you a warning once logged as an administrator user.

On a SaaS or Cloud web hosting provider

Dolibarr is also available on a lot of "ready to use" SaaS or Cloud platforms/services that provides preinstalled versions.
See page Cloud Solutions.
Dolibarr can also be installed manually on all Cloud platforms that support PHP and Mysql.
See page Cloud Solutions.

Upgrade Dolibarr

This chapter describe process to upgrade an existing installation of Dolibarr from an old version to a new one. Process is same whatever is version you are coming fro and version you are going to, but will differ according to the distribution/operating system you used for your first installation. You should use the same for upgrade.

Logo windows.png With DoliWamp (Windows .exe package)

  • Download new .exe package of DoliWamp.
  • Run downloaded .exe file and follow steps without changing any default values. This will upgrades all your files.
  • At the end of the execution, your browser is launched with a page to ask you to run upgrade of your database. Choose the upgrade according to your case.
If there is more than one version late, the page in your browser will loop to start again the upgrade wizard as often as required to run upgrade process, version by version, until your reach the new installed version.

Logo ubuntu.png With DoliDeb (Debian or Ubuntu .deb package)

Process to upgrade using Debian/Ubuntu package is same way than install process (see previous chapters), so it is as easy as installing a package. You can also read page Dolibarr for Ubuntu or Debian.

Logo rpm.png With DoliRpm (Fedora, Redhat, Mandriva, Mageia or OpenSuse .rpm package)

Process to upgrade using rpm package is same way than install process, so it is as easy as installing a package (see previous chapters).

Gnu.png With Dolibarr (standard .tgz package)

This is tutorial to use when using standard distribution for a manual upgrade.
  • Go into the directory where you installed Dolibarr (it might be the root directory of your web, for example /var/www under Debian)
$ cd /var/www
  • Get archive of last version
$ wget http://www.dolibarr.org/files/dolibarr.tgz
  • Uncompress the archive
$ tar xvfz dolibarr.tgz
  • Copy all new extracted files (the one uncompressed into directory dolibarr-x.y.z) to the directory where you put your old Dolibarr version. This will overwrite old files with new ones without removing files specifics to your installation (like conf.php file or complementary non official installed modules).
$ cp -r dolibarr-x.y.z/* dolibarr
  • If no error, you can now remove the directory of source files
$ rm -fr dolibarr-x.y.z
  • Now call the install/ page of Dolibarr in your browser
http://127.0.0.1/dolibarr/install/
and choose Update in suggested menu.
or
Run the two upgrade processes from command line:
$ cd htdocs/install
$ php upgrade.php oldx.oldy.oldz x.y.z > output.html
$ php upgrade2.php oldx.oldy.oldz x.y.z > output2.html
Note: z must be "0" because only major versions have a migration script to run.
Return code will be 0 if success, 1 if error (if this happens, see file output.html or output2.html).
Note: If you have a message that tell the install process is locked by a file, remove the file install.lock stored in Dolibarr root directory.
  • For security reason, once setup is finished, you should create a file install.lock into Dolibarr documents directory. This will lock the call of the install process again (you will have to remove this file for future upgrades). If this is not done, Dolibarr will show you a warning once logged with an administrator user.
$ echo > documents/install.lock
$ chmod 444 documents/install.lock

No comments:

Post a Comment