自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何在RHEL、CentOS及Fedora上安裝Drupal 8

系統(tǒng) Linux 系統(tǒng)運維
Drupal 是一個開源,靈活,高度可拓展和安全的內(nèi)容管理系統(tǒng)Content Management System(CMS),使用戶輕松的創(chuàng)建網(wǎng)站。

如何在RHEL、CentOS及Fedora上安裝Drupal 8

Drupal 是一個開源,靈活,高度可拓展和安全的內(nèi)容管理系統(tǒng)Content Management System(CMS),使用戶輕松的創(chuàng)建網(wǎng)站。

它可以使用模塊拓展,使用戶將內(nèi)容管理轉換為強大的數(shù)字解決方案。

Drupal 運行在諸如 Apache、IIS、Lighttpd、Cherokee、Nginx 的 Web 服務器上,后端數(shù)據(jù)庫可以使用 MySQL、MongoDB、MariaDB、PostgreSQL、MSSQL Server。

在這篇文章中, 我們會展示在 RHEL 7/6、CentOS 7/6 和 Fedora 20-25 發(fā)行版上使用 LAMP 架構,如何手動安裝和配置 Drupal 8。

Drupal 需求:

  1. Apache 2.x (推薦)
  2. PHP 5.5.9 或 更高 (推薦 PHP 5.5)
  3. MySQL 5.5.3 或 MariaDB 5.5.20 與 PHP 數(shù)據(jù)對象(PDO) 支持

安裝過程中,我使用 drupal.tecmint.com 作為網(wǎng)站主機名,IP 地址為 192.168.0.104。你的環(huán)境也許與這些設置不同,因此請適當做出更改。

步驟 1:安裝 Apache Web 服務器

1、 首先我們從官方倉庫開始安裝 Apache Web 服務器。

# yum install httpd

2、 安裝完成后,服務開始是被禁用的,因此我們需要手動啟動它,同時讓它下次系統(tǒng)啟動時自動啟動,如下: 

  1. -------------  通過 SystemD - CentOS/RHEL 7 和 Fedora 22+ ------------------- 
  2. # systemctl start httpd  
  3. # systemctl enable httpd 
  4. -------------  通過 SysVInit - CentOS/RHEL 6 和 Fedora ---------------------- 
  5. # service httpd start 
  6. # chkconfig --level 35 httpd on 

3、 接下來,為了允許通過 HTTP 和 HTTPS 訪問 Apache 服務,我們必須打開 HTTPD 守護進程正在監(jiān)聽的 80 和 443 端口,如下所示:

  1. ------------ 通過 Firewalld - CentOS/RHEL 7 and Fedora 22+ -------------  
  2. # firewall-cmd --permanent --zone=public --add-service=http 
  3. # firewall-cmd --permanent --zone=public --add-service=https 
  4. # firewall-cmd --reload 
  5. ------------ 通過 IPtables - CentOS/RHEL 6 and Fedora 22+ -------------  
  6. # iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT 
  7. # iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT 
  8. # service iptables save 
  9. # service iptables restart  

4、 現(xiàn)在驗證 Apache 是否正常工作, 打開瀏覽器在地址欄中輸入 http://server_IP, 輸入你的服務器 IP 地址, 默認 Apache2 頁面應出現(xiàn),如下面截圖所示:

Apache 默認頁面 

Apache 默認頁面

步驟 2: 安裝 Apache PHP 支持

5、 接下來,安裝 PHP 和 PHP 所需模塊。

  1. # 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:

  1. ------------- Install PHP 7 in CentOS/RHEL and Fedora -------------  
  2. # rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
  3. # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 
  4. # yum install php70w php70w-opcache php70w-mbstring php70w-gd php70w-xml php70w-pear php70w-fpm php70w-mysql php70w-pdo 

6、 接下來,要從瀏覽器得到關于 PHP 安裝和配置完整信息,使用下面命令在 Apache 文檔根目錄 (/var/www/html) 創(chuàng)建一個 info.php 文件。

  1. # echo "<?php  phpinfo(); ?>" > /var/www/html/info.php 

然后重啟 HTTPD 服務器 ,在瀏覽器地址欄輸入 http://server_IP/info.php。

  1. # systemctl restart httpd 
  2. 或 
  3. # service httpd restart 

驗證 PHP 信息 

驗證 PHP 信息

步驟 3: 安裝和配置 MariaDB 數(shù)據(jù)庫

7、 請知曉, Red Hat Enterprise Linux/CentOS 7.0 從支持 MySQL 轉為了 MariaDB 作為默認數(shù)據(jù)庫管理系統(tǒng)。

要安裝 MariaDB 數(shù)據(jù)庫, 你需要添加 官方 MariaDB 庫 到 /etc/yum.repos.d/MariaDB.repo 中,如下所示。

  1. [mariadb] 
  2. name = MariaDB 
  3. baseurl = http://yum.mariadb.org/10.1/centos7-amd64 
  4. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB 
  5. gpgcheck=1 

當倉庫文件準備好后,你可以像這樣安裝 MariaDB:

  1. # yum install mariadb-server mariadb 

8、 當 MariaDB 數(shù)據(jù)庫安裝完成,啟動數(shù)據(jù)庫的守護進程,同時使它能夠在下次啟動后自動啟動。

  1. ------------- 通過 SystemD - CentOS/RHEL 7 and Fedora 22+ -------------  
  2. # systemctl start mariadb 
  3. # systemctl enable mariadb 
  4. ------------- 通過 SysVInit - CentOS/RHEL 6 and Fedora -------------  
  5. # service mysqld start 
  6. # chkconfig --level 35 mysqld on 

9、 然后運行 mysql_secure_installation 腳本去保護數(shù)據(jù)庫(設置 root 密碼, 禁用遠程登錄,移除測試數(shù)據(jù)庫并移除匿名用戶),如下所示:

  1. # mysql_secure_installation 

MySQL 安全安裝 

MySQL 安全安裝

步驟 4: 在 CentOS 中安裝和配置 Drupal 8

10、 這里我們使用 wget 命令 下載***版本 Drupal(例如 8.2.6),如果你沒有安裝 wget 和 gzip 包 ,請使用下面命令安裝它們:

  1. # yum install wget gzip 
  2. # wget -c https://ftp.drupal.org/files/projects/drupal-8.2.6.tar.gz 

11、 之后,解壓 tar 文件 并移動 Drupal 目錄到 Apache 文檔根目錄(/var/www/html)。

  1. # tar -zxvf drupal-8.2.6.tar.gz 
  2. # mv drupal-8.2.6 /var/www/html/drupal 

12、 然后,依據(jù) /var/www/html/drupal/sites/default 目錄下的示例設置文件 default.settings.php,創(chuàng)建設置文件 settings.php,然后給 Drupal 站點目錄設置適當權限,包括子目錄和文件,如下所示:

  1. # cd /var/www/html/drupal/sites/default
  2. # cp default.settings.php settings.php 
  3. # chown -R apache:apache /var/www/html/drupal/ 

13、 更重要的是在 /var/www/html/drupal/sites/ 目錄設置 SElinux 規(guī)則,如下:

  1. # chcon -R -t httpd_sys_content_rw_t /var/www/html/drupal/sites/ 

14、 現(xiàn)在我們必須為 Drupal 站點去創(chuàng)建一個用于管理的數(shù)據(jù)庫和用戶。

  1. # mysql -u root -p 
  2. Enter password:  
  3. MySQL Shell 
  4. Welcome to the MariaDB monitor.  Commands end with ; or \g. 
  5. Your MySQL connection id is 12 
  6. Server version: 5.1.73 Source distribution 
  7. Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. 
  8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
  9. **MySQL [(none)]> create database drupal;** 
  10. Query OK, 1 row affected (0.00 sec) 
  11. **MySQL [(none)]> create user ravi@localhost identified by 'tecmint123';** 
  12. Query OK, 0 rows affected (0.00 sec) 
  13. **MySQL [(none)]> grant all on drupal.* to ravi@localhost;** 
  14. Query OK, 0 rows affected (0.00 sec) 
  15. **MySQL [(none)]> flush privileges;** 
  16. Query OK, 0 rows affected (0.00 sec) 
  17. **MySQL [(none)]> exit** 
  18. Bye 

15、 ***,打開地址: http://server_IP/drupal/ 開始網(wǎng)站的安裝,選擇你***的安裝語言然后點擊保存以繼續(xù)。

Drupal 安裝語言 

Drupal 安裝語言

16、 下一步,選擇安裝配置文件,選擇 Standard(標準),點擊保存繼續(xù)。

Drupal 安裝配置文件 

Drupal 安裝配置文件

17、 在進行下一步之前查看并通過需求審查并啟用 Clean URL。

驗證 Drupal 需求 

驗證 Drupal 需求

現(xiàn)在在你的 Apache 配置下啟用 Clean URL 的 Drupal。

  1. # vi /etc/httpd/conf/httpd.conf 

確保為默認根文檔目錄 /var/www/html 設置 AllowOverride All,如下圖所示:

在 Drupal 中啟用 Clean URL 

在 Drupal 中啟用 Clean URL

18、 當你為 Drupal 啟用 Clean URL,刷新頁面從下面界面執(zhí)行數(shù)據(jù)庫配置,輸入 Drupal 站點數(shù)據(jù)庫名,數(shù)據(jù)庫用戶和數(shù)據(jù)庫密碼。

當填寫完所有信息點擊保存并繼續(xù)。

Drupal 數(shù)據(jù)庫配置 

Drupal 數(shù)據(jù)庫配置

若上述設置正確,Drupal 站點安裝應該完成了,如下圖界面。

Drupal 安裝 

Drupal 安裝

19、 接下來配置站點為下面的設置(使用適用你的情況的值):

  • 站點名稱 – TecMint Drupal Site
  • 站點郵箱地址 – admin@tecmint.com
  • 用戶名 – admin
  • 密碼 – ##########
  • 用戶的郵箱地址 – admin@tecmint.com
  • 默認國家 – India
  • 默認時區(qū) – UTC

設置適當?shù)闹岛?,點擊保存并繼續(xù)完成站點安裝過程。

Drupal 站點配置 

Drupal 站點配置

20、下圖顯示的是通過 LAMP 成功安裝的 Drupal 8 站點。

Drupal 站點面板 

Drupal 站點面板

現(xiàn)在你可以點擊增加內(nèi)容,創(chuàng)建示例網(wǎng)頁內(nèi)容。

選項: 有些人使用 MySQL 命令行管理數(shù)據(jù)庫不舒服,可以從瀏覽器界面 安裝 PHPMYAdmin 管理數(shù)據(jù)庫

瀏覽 Drupal 文檔 : https://www.drupal.org/docs/8

就這樣! 在這個文章, 我們展示了在 CentOS 7 上如何去下載、安裝和使用基本配置來設置 LAMP 以及 Drupal 8。 歡迎就這個教程提供反饋,或提供給我們一些相關信息。 

責任編輯:龐桂玉 來源: Linux中國
相關推薦

2017-04-11 13:20:06

CentOSRHELFedora

2020-03-02 14:06:54

CentOS 8FFmpegLinux

2019-12-02 11:50:09

CentOS 8VirtualBoxLinux

2019-10-12 10:24:06

CentOSRHELCockpit

2023-03-16 08:55:51

RHEL 8MiniKube開源

2019-11-14 09:20:15

CentOS 8RHEL 8Nagios Core

2019-12-02 15:45:53

CentOS 8AnsibleLinux

2019-10-14 15:00:12

Centos 8 RHEL 8VNC

2016-11-08 08:51:43

GitLinux開源

2023-11-26 16:23:16

FedoraVSCodium

2015-12-21 13:19:23

CentosRHEL 6.XWetty

2023-05-05 16:20:15

2021-11-28 06:33:24

Discord消息收發(fā)應用 Linux

2023-05-13 17:32:51

2022-10-17 06:34:28

FedoraLinuxRPM Fusion

2021-08-18 11:19:25

FedoraLinuxJava

2019-11-05 11:20:36

CentOS 8RHEL 8Linux

2020-12-28 06:44:45

FedoraLinux RPM文件

2014-10-11 11:30:43

CentOSDocker

2019-09-27 08:52:12

RHELCentOSElastic sta
點贊
收藏

51CTO技術棧公眾號