共计 5174 个字符,预计需要花费 13 分钟才能阅读完成。
Drupal 是一个开源,灵活,高度可拓展和安全的内容管理系统 Content Management System(CMS),使用户轻松的创建网站。
它可以使用模块拓展,使用户将内容管理转换为强大的数字解决方案。
Drupal 运行在诸如 Apache、IIS、Lighttpd、Cherokee、Nginx 的 Web 服务器上,后端数据库可以使用 MySQL、MongoDB、MariaDB、PostgreSQL、MSSQL Server。
在这篇文章中,我们会展示在 RHEL 7/6、CentOS 7/6 和 Fedora 20-25 发行版上使用 LAMP 架构,如何手动安装和配置 Drupal 8。
- Apache 2.x (推荐)
- PHP 5.5.9 或 更高 (推荐 PHP 5.5)
- MySQL 5.5.3 或 MariaDB 5.5.20 与 PHP 数据对象 (PDO) 支持
安装过程中,我使用 drupal.tecmint.com 作为网站主机名,IP 地址为 192.168.0.104。你的环境也许与这些设置不同,因此请适当做出更改。
# yum install httpd
------------- 通过 SystemD - CentOS/RHEL 7 和 Fedora 22+ ------------------- | |
# systemctl start httpd | |
# systemctl enable httpd | |
------------- 通过 SysVInit - CentOS/RHEL 6 和 Fedora ---------------------- | |
# service httpd start |
# chkconfig –level 35 httpd on
------------ 通过 Firewalld - CentOS/RHEL 7 and Fedora 22+ ------------- | |
# firewall-cmd --permanent --zone=public --add-service=http | |
# firewall-cmd --permanent --zone=public --add-service=https | |
# firewall-cmd --reload |
———— 通过 IPtables – CentOS/RHEL 6 and Fedora 22+ ————- # iptables -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT # iptables -A INPUT -p tcp -m tcp –dport 443 -j ACCEPT # service iptables save # service iptables restart
Apache 默认页面
# yum install php php-mbstring php-gd php-xml php-pear php-fpm php-mysql php-pdo php-opcache
重要: 假如你想要安装 PHP7,你需要增加以下仓库:EPEL 和 Webtactic 才可以使用 yum 安装 PHP7.0:
------------- Install PHP 7 in CentOS/RHEL and Fedora ------------- | |
# echo "" > /var/www/html/info.php
然后重启 HTTPD 服务器,在浏览器地址栏输入 http://server_IP/info.php。
# systemctl restart httpd
或 # service httpd restart
验证 PHP 信息
要安装 MariaDB 数据库,你需要添加 官方 MariaDB 库 到 /etc/yum.repos.d/MariaDB.repo 中,如下所示。
[mariadb] | |
name = MariaDB | |
baseurl = http://yum.mariadb.org/10.1/centos7-amd64 | |
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB | |
gpgcheck=1 |
当仓库文件准备好后,你可以像这样安装 MariaDB:
# yum install mariadb-server mariadb
------------- 通过 SystemD - CentOS/RHEL 7 and Fedora 22+ ------------- | |
# systemctl start mariadb | |
# systemctl enable mariadb | |
------------- 通过 SysVInit - CentOS/RHEL 6 and Fedora ------------- | |
# service mysqld start | |
# chkconfig --level 35 mysqld on |
# mysql_secure_installation
MySQL 安全安装
# tar -zxvf drupal-8.2.6.tar.gz | |
# mv drupal-8.2.6 /var/www/html/drupal |
# cd /var/www/html/drupal/sites/default/ | |
# cp default.settings.php settings.php | |
# chown -R apache:apache /var/www/html/drupal/ |
# chcon -R -t httpd_sys_content_rw_t /var/www/html/drupal/sites/
# mysql -u root -p | |
Enter password: | |
MySQL Shell | |
Welcome to the MariaDB monitor. Commands end with ; or /g. | |
Your MySQL connection id is 12 | |
Server version: 5.1.73 Source distribution | |
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. | |
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement. | |
**MySQL [(none)]> create database drupal;** | |
Query OK, 1 row affected (0.00 sec) | |
**MySQL [(none)]> create user ravi@localhost identified by 'tecmint123';** | |
Query OK, 0 rows affected (0.00 sec) | |
**MySQL [(none)]> grant all on drupal.* to ravi@localhost;** | |
Query OK, 0 rows affected (0.00 sec) | |
**MySQL [(none)]> flush privileges;** | |
Query OK, 0 rows affected (0.00 sec) | |
**MySQL [(none)]> exit** | |
Bye |
Drupal 安装语言
Drupal 安装配置文件
验证 Drupal 需求
现在在你的 Apache 配置下启用 Clean URL 的 Drupal。
# vi /etc/httpd/conf/httpd.conf
确保为默认根文档目录 /var/www/html 设置 AllowOverride All,如下图所示:
在 Drupal 中启用 Clean URL
当填写完所有信息点击保存并继续。
Drupal 数据库配置
若上述设置正确,Drupal 站点安装应该完成了,如下图界面。
Drupal 安装
站点名称 – TecMint Drupal Site | |
站点邮箱地址 – admin@tecmint.com | |
用户名 – admin | |
密码 – ########## | |
用户的邮箱地址 – admin@tecmint.com | |
默认国家 – India | |
默认时区 – UTC |
设置适当的值后,点击保存并继续完成站点安装过程。
Drupal 站点配置
Drupal 站点面板
现在你可以点击增加内容,创建示例网页内容。
选项: 有些人使用 MySQL 命令行管理数据库不舒服,可以从浏览器界面 安装 PHPMYAdmin 管理数据库
浏览 Drupal 文档 : https://www.drupal.org/docs/8
就这样! 在这个文章,我们展示了在 CentOS 7 上如何去下载、安装和使用基本配置来设置 LAMP 以及 Drupal 8。欢迎就这个教程提供反馈,或提供给我们一些相关信息。
