本教程适用于以下操作系统版本
- Debian 12 (Bookworm)
- Debian 11 (Bullseye)
- Debian 9 (Stretch)
在本页
- 先决条件
- 安装 Apache、MariaDB 和 PHP
- 为 SuiteCRM 创建 MariaDB 数据库
- 安装 SuiteCRM
- 为 SuiteCRM 配置 Apache
- 访问 SuiteCRM Web 界面
- 使用 Let's Encrypt SSL 保护 SuiteCRM
- 结论
SuiteCTM 是一个用 PHP 编写的开源客户关系管理解决方案。它是一个功能齐全且高度可扩展的 CRM 应用程序,可在任何操作系统上运行。当 SugarCRM 决定停止其社区版的开发时,它开始流行起来。它用于制定商业策略、行动和决策。它是 SugarCRM、Salesforce 和 Microsoft 等其他商业 CRM 的替代 CRM 解决方案。
在这篇文章中,我们将向你展示如何在 Debian 11 上使用 Apache 和 Let's Encrypt SSL 安装 SuiteCRM。
先决条件
- 一台运行 Debian 11 的服务器。
- 一个指向你服务器 IP 的有效域名。
- 服务器上已配置 root 密码。
安装 Apache、MariaDB 和 PHP
SuiteCRM 是一个基于 PHP 的应用程序,并使用 MariaDB 作为数据库后端。因此,你需要在服务器上安装 Apache 服务器、MariaDB 数据库服务器、PHP 以及其他必要的 PHP 扩展。你可以使用以下命令安装所有这些:
apt-get install apache2 mariadb-server mariadb-client php php-common php-zip php-mysql php-gd php-curl php-imap php-mbstring php-xml php-json libapache2-mod-php unzip libpcre3 -y
所有软件包安装完成后,编辑 php.ini 文件并更改一些默认设置:
nano /etc/php/7.4/apache2/php.ini
更改以下设置:
memory_limit = 256M post_max_size = 64M upload_max_filesize = 64M
保存并关闭文件,然后重启 Apache 服务以应用更改:
systemctl restart apache2
为 SuiteCRM 创建 MariaDB 数据库
首先,你需要保护 MariaDB 安装并设置 root 密码。你可以通过执行以下脚本来完成:
mysql_secure_installation
按如下所示回答所有问题:
Enter current password for root: Press Set root password? [Y/n] y Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] y Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y
完成后,使用以下命令登录 MariaDB shell:
mysql -u root -p
连接到 MariaDB 后,使用以下命令为 SuiteCRM 创建数据库和用户:
MariadDB [(none)]> CREATE DATABASE suitecrm;
MariaDB [(none)]> CREATE USER 'suitecrm'@'localhost' IDENTIFIED BY 'password';
接下来,使用以下命令授予 SuiteCRM 数据库所有权限:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON suitecrm.* TO 'suitecrm'@'localhost';
接下来,使用以下命令刷新权限并退出 MariaDB shell:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
创建 MariaDB 数据库和用户后,你可以继续下一步。
安装 SuiteCRM
首先,使用 wget 命令下载最新版本的 SuiteCRM:
wget https://suitecrm.com/files/147/SuiteCRM-7.12/578/SuiteCRM-7.12.1.zip
接下来,使用以下命令解压缩下载的文件:
unzip SuiteCRM-7.12.1.zip
接下来,将解压后的目录移动到 Apache 默认根目录:
mv SuiteCRM-7.12.1 /var/www/html/suitecrm
接下来,更改 SuiteCRM 目录的所有权和权限:
chown -R www-data:www-data /var/www/html/suitecrm
chmod -R 755 /var/www/html/suitecrm
完成后,你可以继续下一步。
为 SuiteCRM 配置 Apache
接下来,你需要配置 Apache 以在互联网上托管 SuiteCRM。为此,使用以下命令创建 Apache 虚拟主机配置文件:
nano /etc/apache2/sites-available/suitecrm.conf
添加以下行:
<VirtualHost *:80>
DocumentRoot /var/www/html/suitecrm
ServerName suitecrm.example.com
<Directory /var/www/html/suitecrm>
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/suitecrm-error.log
CustomLog /var/log/apache2/suitecrm-access.log common
</VirtualHost>
保存并关闭文件,然后使用以下命令启用 SuiteCRM 虚拟主机配置文件:
a2ensite suitecrm.conf
接下来,重新加载 Apache 服务以应用配置更改:
systemctl reload apache2
要检查 Apache 服务的状态,请运行以下命令:
systemctl status apache2
你将得到以下输出:
? apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-11-19 16:36:48 UTC; 4s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 16290 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 16296 (apache2)
Tasks: 6 (limit: 4679)
Memory: 15.5M
CPU: 99ms
CGroup: /system.slice/apache2.service
??16296 /usr/sbin/apache2 -k start
??16297 /usr/sbin/apache2 -k start
??16298 /usr/sbin/apache2 -k start
??16299 /usr/sbin/apache2 -k start
??16300 /usr/sbin/apache2 -k start
??16301 /usr/sbin/apache2 -k start
Nov 19 16:36:48 debian11 systemd[1]: Starting The Apache HTTP Server...
配置 Apache Web 服务器后,你可以继续访问 SuiteCRM Web 界面。
访问 SuiteCRM Web 界面
现在,打开你的 Web 浏览器并输入 URL http://suitecrm.example.com 以访问 SuiteCRM Web UI。你应该会看到以下屏幕:

接受许可协议并点击 Next 按钮。你应该会看到以下页面:

确保所有检查都返回 OK,然后点击 Next 按钮继续。你应该会看到 SuiteCRM 配置页面:




提供你的数据库信息、管理员用户详细信息、SMTP 服务器规格、品牌详细信息、站点安全设置,然后点击 Next 按钮。你应该会看到以下页面:

点击 Next 按钮。你应该会看到 SuiteCRM 登录页面:

提供你的管理员用户名、密码并点击 LOG IN 按钮。你应该会在以下屏幕上看到 SuiteCRM 仪表板:

使用 Let's Encrypt SSL 保护 SuiteCRM
配置 Apache 后,建议使用 Let's Encrypt SSL 证书来保护你的网站。为此,你需要在系统中安装 Certbot 客户端。Certbot 是一个易于使用的客户端,它从 Let's Encrypt 获取证书——这是一个由 EFF、Mozilla 等机构发起的开放证书颁发机构——并将其部署到 Web 服务器。使用 Certbot Let's Encrypt 客户端,你可以轻松地为你的域名下载、安装和续订 SSL 证书。
你可以使用以下命令安装 Certbot:
apt-get install certbot python3-certbot-apache -y
Certbot 客户端成功安装后,运行以下命令为你的网站安装 Let's Encrypt SSL:
certbot --apache -d suitecrm.example.com
系统会要求你提供有效电子邮件并接受服务条款,如下所示:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for suitecrm.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/suitecrm-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/suitecrm-le-ssl.conf Enabling available site: /etc/apache2/sites-available/suitecrm-le-ssl.conf
接下来,选择是否将 HTTP 流量重定向到 HTTPS,或配置 Nginx 将所有流量重定向到安全的 HTTPS 访问,如下面的输出所示:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
输入 2 并按 Enter 开始该过程。安装完成后,你应该会得到以下输出:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/suitecrm.conf to ssl vhost in /etc/apache2/sites-available/suitecrm-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://suitecrm.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=suitecrm.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/suitecrm.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/suitecrm.example.com/privkey.pem Your cert will expire on 2022-02-21. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
结论
恭喜!你已在 Debian 11 上成功使用 Apache 和 Let's Encrypt SSL 安装了 SuiteCRM。现在你可以探索 SuiteCRM 的更多功能。如果你有任何问题,请随时问我。