Installation - Upgrade

From Dolibarr ERP CRM Wiki
(Redirected from Installation / Upgrade)
Jump to navigation Jump to search

The following documentation describes processes to install or upgrade Dolibarr on a Windows, MAC OS or Unix like platform.


Install Dolibarr

This chapter describe different available methods to install Dolibarr for the first time (from the most simple to the manual one). See next chapter for upgrades.

Installation on your dedicated computer/server (installation "On Premise")

Logo windows.png Manually or with DoliWamp

- Prerequisite: Windows

- Level: Non experienced users

This process works only for Windows users and is recommended for user with no computer knowledge. If you have experience with Apache, PHP and Mysql installation, next chapter is better for you.

If you have time and want to learn how to install an Apache, PHP and MariaDB web server, see the Manual installation on Windows page for step-by-step instructions.

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 at Sourceforge mirror

  • 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 little computer knowledge. If you are experienced with Apache, PHP and Mysql installation, the chapter 'with standard package' 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 knowledge. If you have experience 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 .zip package or from git)

- 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 knowledge.

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.6.0+ (requires functions like DateTimeZone.getOffset, php-intl) and a database server (MySQL 5.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:
Preparation of MySQL or MariaDB database

For Linux users, if you have just installed a MySQL or MariaDB 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 the connection with the new couple user/password works, launch the command

mysql -u root -p

And type your password newrootpass then \q to quit if the connection has been successful.

Preparation of PostgreSQL database

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 -U postgres -d template1
alter user dolibarrowner with password 'dolibarrownerpass';
ALTER USER dolibarrowner WITH SUPERUSER;
ALTER USER dolibarrowner WITH CREATEDB;
ALTER USER dolibarrowner WITH CREATEROLE;
\du
\q
exit
sudo /etc/init.d/postgresql restart

You can test a connection with this user with command

psql -h localhost -p 5432 -d postgres -U dolibarrowner -W
\du
\l

And type your dolibarrownerpass as password and \q to quit if connection is ok.

Install Dolibarr files on the web server
  • Go into the directory where to install Dolibarr (the web root directory defined for your web server virtual host. Example of setup of virtual host are available on this page).
  1. For Debian and Ubuntu families, it is generally: /var/www (newer versions: /var/www/html)
  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 from zip file
    $ wget http://www.dolibarr.org/files/dolibarr.zip
    
    Uncompress archive
    $ unzip dolibarr.zip
    
    or from git repository
    $ git clone --depth 1 -b X.Y http://github.com/Dolibarr/dolibarr.git dolibarr
    
    Replace X.Y with the version you want to get. Remove "--depth 1" if you don't mind downloading the entire history of the project (programmers may find it useful but end users probably won't).
  • 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 permissions 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 the web server user as owner (for instance 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
    
    Note: For Ubuntu no need of htdocs, you just have to make dolibarr root by placing all files and folders of htdocs in /var/www/dolibarr then from browser do <MyIP>/dolibarr/index.php (see this discussion as reference to this addendum [1])
  • 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 recommended to use a directory outside of your directory of web pages, for example - "/var/lib/dolibarr/documents"
    $ mkdir -p /var/lib/dolibarr/documents ; chown www-data /var/lib/dolibarr/documents
    
  • Now call your browser to point to the main page
    http://127.0.0.1/dolibarr/htdocs/
    
    or if you didn't create the htdocs directory
    http://127.0.0.1/dolibarr/
    
  • 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 document 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/lib/dolibarr/documents/install.lock; chmod go-w /var/lib/dolibarr/documents;
    


Additional information on setting up a Debian or Ubuntu server

If you are planning to configure a Debian or Ubuntu server for Dolibarr to provide the aforementioned prerequisites, there are detailed step-by-step instructions available in German:



Installation on a shared Web Hosting Provider (without terminal/SSH 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:

- Prerequisites: 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 knowledge. 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(recommended) or PostGreSQL) that works correctly.

Warning.png Warning, check that code page of PHP server and database server are same (utf8_general_ci recommended).

  • 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 from here and uncompress it locally.
  • Create a folder named dolibarr inside your web root directory(usually called public_html) and upload all content of htdocs directory to it. You can use an FTP client like Filezilla.
  • 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.
  • Using your browser point to the main page index.php e.g. dolibarr.mydomain.com/index.php
  • Follow instructions of setup steps until end of install process.
  • For security reason, it's strongly recommended, once setup is finished, to create a file named install.lock into documents 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.



Installation 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.


Installation using Docker

For admins with Docker experience, it is possible to use the docker build files located in the source repo here: https://github.com/Dolibarr/dolibarr/tree/develop/build

git clone https://github.com/Dolibarr/dolibarr/
cd ./dolibarr
git checkout tags/<desiredrelease>
cd build/docker
docker-compose up



Read the README carefully. As of version 12+ it recommends to use the built in docker files for development only, while an outside repo: https://hub.docker.com/r/tuxgasy/dolibarr is recommended for production environments.

Setup

First setup

See page Setup.

Setup a LDAP connection

If you want to use a LDAP: See Install and configure OpenLDAP.


Import external data

For this operation, read page Mass imports.


Upgrade Dolibarr

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


Note (optional):

It's better to delete old program files before installing the new ones: old files can remain, causing bug and malfunctions.

Before deleting, remember to save what you have customized in your installation:

  • your data (documents folder and database)
  • /custom if you have external modules -> be sure your external modules are compatible with the new version before updating !
  • /conf/conf.php : main parameter of dolibarr
  • your customized models and/or customized php scripts (it's recommended to report your modification in the new files cause yours are based on old version)


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

  • First make a backup of your current installation
  • 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)

  • First make a backup of your current installation
  • Process to upgrade using Debian/Ubuntu package is the same as the install process (see previous chapters), so it is as easy as installing a package.


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

  • First make a backup of your current installation
  • Process to upgrade using rpm package is the same as the install process, so it is as easy as installing a package (see previous chapters).


Gnu.png With Dolibarr (standard .zip package or from Git)

This is tutorial to use when using standard distribution for a manual upgrade.

  • First make a backup of your current installation
  • 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
    

For installation that used the zip file

  • Get archive of last version
    $ wget https://www.dolibarr.org/files/dolibarr.zip
    
  • Uncompress the archive
    $ unzip dolibarr.zip
    
  • 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 open your Dolibarr in your browser. It should open automatically the install/ and choose Update in suggested menu.

For installation that used GIT

  • If you already cloned the repo simply upgrade by checking out a version tag like so:
    $ git checkout 13.0
    $ git pull origin 13.0
    
  • Now open your Dolibarr in your browser. It should open automatically the install/ page. Choose Update in the suggested options.

Notes on the Upgrade

  • 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 reasons, 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
    
  • If you want to script the database upgrade process (to avoid the upgrade process from web browser), you can run the 3 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
    $ php step5.php oldx.oldy.oldz x.y.z > output3.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, output2.html or output3.html).

Related videos

Install on local : (vocal in french but subtitles are available and review in this language)

Install on server Infomaniak : (vocal in french but subtitles are available and review in this language)

Installation and migration to V15 on local : (vocal in french but subtitles are available and review in this language)