如何在 Ubuntu 22.04 LTS 上安装 Dolibarr

Linux命令 Edge插件网 2年前 (2023-03-09) 471次浏览 已收录 0个评论

Dolibarr是一种开源企业资源规划(ERP)和客户关系管理(CRM)软件,可供中小型企业使用。它是一个基于 Web 的应用程序,旨在管理和自动化各种业务流程,包括财务管理、项目管理、库存管理等。如何在 Ubuntu 22.04 LTS 上安装 Dolibarr

在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 Dolibarr

第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt

<span class="pln">sudo apt update
sudo apt upgrade</span>

第 2 步。在 Ubuntu 22.04 上安装 LEMP Stack。

在开始本教程之前,必须在服务器上安装 LEMP 服务器。如果您没有安装 LEMP 堆栈,您可以按照我们的指南进行操作 此处.

第 3 步。在 Ubuntu 22.04 上安装 Dolibar。

默认情况下,Dolibar 在 Ubuntu 22.04 基础存储库中不可用。现在运行以下命令,从 Ubuntu 系统的 GitHub 页面下载最新的稳定版 Dolibar:

<span class="pln">wget https</span><span class="pun">:</span><span class="com">//github.com/Dolibarr/dolibarr/archive/refs/tags/16.0.3.zip</span>

接下来,创建一个 Dolibar 目录并将下载的文件解压缩到该目录中:

<span class="pln">mkdir </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">dolibarr
unzip </span><span class="lit">16.0</span><span class="pun">.</span><span class="lit">3.zip</span> <span class="pun">-</span><span class="pln">d </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">dolibarr</span>

我们需要更改一些文件夹权限:

<span class="pln">chown </span><span class="pun">-</span><span class="pln">R www</span><span class="pun">-</span><span class="pln">data</span><span class="pun">:</span><span class="pln">www</span><span class="pun">-</span><span class="pln">data </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">dolibarr</span><span class="pun">/</span>

第 4 步。配置 MariaDB。

默认情况下,MariaDB 未强化。您可以使用脚本保护 MariaDB。您应该仔细阅读并在每个步骤下方仔细阅读,这将设置root密码,删除匿名用户,禁止远程root登录,并删除测试数据库和对安全MariaDB的访问权限:mysql_secure_installation

<span class="pln">mysql_secure_installation</span>

像这样配置它:

<span class="pun">-</span> <span class="typ">Set</span><span class="pln"> root password</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> anonymous users</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Disallow</span><span class="pln"> root login remotely</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> test database </span><span class="kwd">and</span><span class="pln"> access to it</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Reload</span><span class="pln"> privilege tables now</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y</span>

接下来,我们需要登录 MariaDB 控制台并为 Dolibar 创建一个数据库。运行以下命令:

<span class="pln">mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>

这将提示您输入密码,因此请输入您的MariaDB root密码并按Enter键。登录到数据库服务器后,您需要为Dolibar安装创建一个数据库:

<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE DATABASE dolibarr</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE USER </span><span class="str">'dolibarr'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pln"> IDENTIFIED BY </span><span class="str">'Your-Strong-Password'</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> GRANT ALL PRIVILEGES ON dolibarr</span><span class="pun">.*</span><span class="pln"> TO </span><span class="str">'dolibarr'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> FLUSH PRIVILEGES</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> EXIT</span><span class="pun">;</span>

有关安装 MariaDB 的其他资源,请阅读以下帖子:

  • 如何在 Ubuntu Linux √ 上安装 MariaDB

第5步。创建 nginx 虚拟主机。

现在我们为Dolibar创建一个Nginx虚拟主机配置文件:

<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">dolibar</span><span class="pun">.</span><span class="pln">conf</span>

添加以下行:

<span class="pln">server </span><span class="pun">{</span><span class="pln">
 listen      </span><span class="lit">80</span><span class="pun">;</span><span class="pln">
 server_name your</span><span class="pun">-</span><span class="pln">domain</span><span class="pun">.</span><span class="pln">com</span><span class="pun">;</span><span class="pln">
 root        </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">dolibarr</span><span class="pun">;</span><span class="pln">
 index       index</span><span class="pun">.</span><span class="pln">php</span><span class="pun">;</span><span class="pln">

 charset utf</span><span class="pun">-</span><span class="lit">8</span><span class="pun">;</span><span class="pln">
 gzip on</span><span class="pun">;</span><span class="pln">
 gzip_types text</span><span class="pun">/</span><span class="pln">css application</span><span class="pun">/</span><span class="pln">javascript text</span><span class="pun">/</span><span class="pln">javascript application</span><span class="pun">/</span><span class="pln">x</span><span class="pun">-</span><span class="pln">javascript image</span><span class="pun">/</span><span class="pln">svg</span><span class="pun">+</span><span class="pln">xml text</span><span class="pun">/</span><span class="pln">plain text</span><span class="pun">/</span><span class="pln">xsd text</span><span class="pun">/</span><span class="pln">xsl text</span><span class="pun">/</span><span class="pln">xml image</span><span class="pun">/</span><span class="pln">x</span><span class="pun">-</span><span class="pln">icon</span><span class="pun">;</span><span class="pln">
 location </span><span class="pun">/</span> <span class="pun">{</span><span class="pln">
  try_files $uri $uri</span><span class="pun">/</span> <span class="pun">/</span><span class="pln">index</span><span class="pun">.</span><span class="pln">php</span><span class="pun">?</span><span class="pln">$query_string</span><span class="pun">;</span>
 <span class="pun">}</span><span class="pln">
 location </span><span class="pun">/</span><span class="pln">api</span><span class="pun">/</span><span class="pln">v0 </span><span class="pun">{</span><span class="pln">
  try_files $uri $uri</span><span class="pun">/</span> <span class="pun">/</span><span class="pln">api_v0</span><span class="pun">.</span><span class="pln">php</span><span class="pun">?</span><span class="pln">$query_string</span><span class="pun">;</span>
 <span class="pun">}</span><span class="pln">
 location </span><span class="pun">~</span><span class="pln"> \.php </span><span class="pun">{</span><span class="pln">
  include fastcgi</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">;</span><span class="pln">
  fastcgi_split_path_info </span><span class="pun">^(.+</span><span class="pln">\.php</span><span class="pun">)(/.+)</span><span class="pln">$</span><span class="pun">;</span><span class="pln">
  fastcgi_pass unix</span><span class="pun">:</span><span class="str">/var/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">php8</span><span class="pun">.</span><span class="lit">1</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">sock</span><span class="pun">;</span>
 <span class="pun">}</span><span class="pln">
 location </span><span class="pun">~</span> <span class="pun">/</span><span class="pln">\.ht </span><span class="pun">{</span><span class="pln">
  deny all</span><span class="pun">;</span>
 <span class="pun">}</span>
<span class="pun">}</span>

保存并关闭文件,然后使用以下命令重新启动 Nginx 服务:

<span class="pln">nginx </span><span class="pun">-</span><span class="pln">t
sudo systemctl restart nginx</span>

有关安装和管理 Nginx 的其他资源,请阅读下面的帖子:

  • 如何在 Ubuntu Linux √ 上安装 Nginx

第 6 步。配置防火墙。

现在我们使用 Dolibar 设置了一个简单防火墙 (UFW),以允许在默认 Web 端口 80 上进行公共访问:

<span class="pln">sudo ufw allow </span><span class="typ">OpenSSH</span><span class="pln">
sudo ufw allow </span><span class="str">'Nginx Full'</span><span class="pln">
sudo ufw enable</span>

步骤 7.访问多利巴网页界面。

成功安装后,打开您的网络浏览器并使用 URL 访问 Dolibar Web UI。您将被重定向到以下页面:http://your-domain.com

如何在 Ubuntu 22.04 LTS 上安装 Dolibarr

感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 Dolibar 和 LEMP 堆栈。如需更多帮助或有用信息,我们建议您查看 Dolibar 官方网站


Edge插件网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何在 Ubuntu 22.04 LTS 上安装 Dolibarr
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址