apt-get install apache2<\/pre>\nAfter the installation is complete, enable Apache to start automatically upon server boot with:<\/p>\n
systemctl enable apache2<\/pre>\nWe can also check the status of your Apache service with the following command:<\/p>\n
systemctl status apache2<\/pre>\nOutput:<\/p>\n
\u25cf apache2.service - The Apache HTTP Server\r\nLoaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\r\nDrop-In: \/lib\/systemd\/system\/apache2.service.d\r\n\u2514\u2500apache2-systemd.conf\r\nActive: active (running) since Fri 2019-06-07 09:23:09 CDT; 14min ago\r\nProcess: 702 ExecStart=\/usr\/sbin\/apachectl start (code=exited, status=0\/SUCCESS)\r\nMain PID: 816 (apache2)\r\nTasks: 7 (limit: 2321)\r\nCGroup: \/system.slice\/apache2.service\r\n\u251c\u2500 816 \/usr\/sbin\/apache2 -k start\r\n\u251c\u2500 834 \/usr\/sbin\/apache2 -k start\r\n\u251c\u2500 835 \/usr\/sbin\/apache2 -k start\r\n\u251c\u2500 836 \/usr\/sbin\/apache2 -k start\r\n\u251c\u2500 837 \/usr\/sbin\/apache2 -k start\r\n\u251c\u2500 839 \/usr\/sbin\/apache2 -k start\r\n\u2514\u250025045 \/usr\/sbin\/apache2 -k start<\/pre>\nIf your Apache web server is not started, you can start it with the simple ‘start’ command using systemctl:<\/p>\n
systemctl start apache2<\/pre>\n<\/span>Step 3: Install MySQL and Create a MySQL Database<\/span><\/h2>\nRun the following command to install MySQL 5.7, the latest version available in the official Ubuntu repositories, along with some required MySQL packages:<\/p>\n
sudo apt-get install mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7<\/pre>\nOnce the installation is complete, issue the following command to further improve the security of your MySQL server installation:<\/p>\n
mysql_secure_installation<\/pre>\nWe recommend answering every prompt with \u00a0‘Y’.<\/p>\n
Once this is done, create a new MySQL database and user for the Dolibarr installation.<\/p>\n
Log in to the MySQL console as MySQL user (e.g. root):<\/p>\n
sudo mysql -uroot -p<\/pre>\nRun the following commands to create a new MySQL database, user, and grant privileges for the user to access the database:<\/p>\n
mysql> CREATE DATABASE dolibarr character set UTF8 collate utf8_bin;\r\nmysql> GRANT ALL PRIVILEGES ON dolibarr.* TO 'dolibarr'@'localhost' IDENTIFIED BY 'StrongPassword<\/span>';\r\nmysql> FLUSH PRIVILEGES;\r\nmysql> quit<\/pre>\nRemember to replace StrongPassword<\/code> with an actual strong password.<\/p>\n<\/span>Step 4: Install the Required PHP Packages<\/span><\/h2>\nInstall PHP 7.2 and all of the required PHP extensions:<\/p>\n
apt-get install php7.2 php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-intl php7.2-json php7.2-mbstring php7.2-mysql php7.2-soap php7.2-xml php7.2-xmlrpc php7.2-zip libapache2-mod-php7.2<\/pre>\n<\/span>Step 5: Create a new Apache Configuration File<\/span><\/h2>\nCreate a new Apache configuration file for the domain\/subdomain name that we will be using to access the Dolibarr application. For this tutorial, we will use ‘dolibarr.domain.com<\/span>‘.<\/p>\nvi \/etc\/apache2\/sites-available\/dolibarr.conf<\/pre>\nAdd the following lines:<\/p>\n
<VirtualHost *:80>
\nServerName dolibarr.domain.com<\/span>
\nDocumentRoot \/var\/www\/dolibarr\/htdocs
\nCustomLog ${APACHE_LOG_DIR}\/dolibarr.domain.com<\/span>.access.log combined
\nErrorLog ${APACHE_LOG_DIR}\/dolibarr.domain.com<\/span>.error.log
\n<Directory \/var\/www\/dolibarr>
\nDirectoryIndex index.php
\nOptions -Indexes
\nAllowOverride All
\nOrder allow,deny
\nallow from all
\n<\/Directory>
\n<\/VirtualHost><\/code><\/p>\nDo not forget to replace dolibarr.domain.com<\/span> with your actual domain\/subdomain name. Save and close the Apache configuration file.<\/p>\nCreate a new directory named ‘dolibarr’:<\/p>\n
mkdir -p \/var\/www\/dolibarr<\/pre>\nTo enable the newly created configuration file in Apache, run:<\/p>\n
sudo a2ensite dolibarr<\/pre>\nThen disable the default Apache configuration file using this next line:<\/p>\n
sudo a2dissite 000-default<\/pre>\nAlso, we need to enable the Apache ‘rewrite’ module (if it is not already enabled):<\/p>\n
sudo a2enmod rewrite<\/pre>\nCheck if there are errors with the newly created Apache configuration:<\/p>\n
sudo apachectl -t\r\nSyntax OK<\/pre>\nIf the syntax is OK and there are no errors, we can restart the Apache web service.<\/p>\n
sudo systemctl restart apache2.service<\/pre>\n