CentOS 7.x 安装drupal 8

CentOS 7.x 安装drupal 8

1.drupal 8.x 需求


类型 需求
Database 1.MySQL 5.5.3/MariaDB 5.5.20/Percona Server 5.5.8 or higher with PDO and an InnoDB-compatible primary storage engine,

2.PostgreSQL 9.1.2 or higher with PDO,

3.SQLite 3.6.8 or higher

PHP PHP 5.5.9 or higher

官方需求链接


2.部署LAMP(Linux+Apache+Mysql+PHP)


更新系统安装包(CentOS)[Option]

# yum update

安装Apache

# yum install httpd

apache设置默认启动[Option]

# systemctl start httpd
# systemctl enable httpd 

apache浏览器访问

在浏览器中输入网址后可以看到测试页面.  Testing…….

安装MariaDB

# yum install mariadb-server mariadb 

设置MariaDB自动运行

# systemctl start mariadb
# systemctl enable mariadb 

初始化MariaDB

# /usr/bin/mysql_secure_installation 

【以上参考:CentOS 7 install LAMP

安装PHP


drupal 8.x要求php在5.5.9以上,默认的centOS 7 安装5.4,5.5的版本放在webtatic上【referrence

安装扩展包

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

安装php相关包

# yum install php55w php55w-opcache php55w-gd php55w-mbstring php55w-mysqlnd php55w-pdo php55w-opcache php55w-xml

上述为drupal必须安装的包:

类型 说明
php55w 必须,版本5.5.35
php55w-cli 必须
php55w-common 必须
php55w-gd 必须,drupal 8要求
php55w-mbstring 必须,drupal 8要求,处理unicode字符
php55w-mysqlnd 必须,drupal 8要求,链接mariadb
php55w-opcache 必须,缓存
php55w-pdo 必须,drupal 8要求,数据库
php55w-xml 必须

测试php安装

# php -v
PHP 5.5.35 (cli) (built: May  1 2016 11:44:25)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

测试apache

##重启apache
# systemctl restart httpd

3.下载安装drupal 8.x


下载

## 1.wget下载
# wget https://ftp.drupal.org/files/projects/drupal-8.4.2.tar.gz
## 2.解压缩到apache
# tar xvfz drupal-8.4.2.tar.gz -C /var/www/html
### 3.重命名
# cd /var/www/html
# mv drupal-8.4.2 drupal
## 4.修改权限
# chown -R apache:apache /var/www/html/drupal/
## 5.复制配置文件
# cd /var/www/html/drupal/sites/default
# cp -p default.settings.php settings.php

新建数据库

# mysql -u root -p
>create database drupal_db;
>CREATE USER db_user@localhost IDENTIFIED BY 'Durpal@123#';
>GRANT ALL PRIVILEGES ON drupal_db.* TO db_user@localhost;
>FLUSH PRIVILEGES;
>exit;

打开浏览器http://your.ip/drupal

 

 

【Referrence】  1.http://www.linuxtechi.com/how-to-install-drupal-8-on-centos-7  2.https://www.linode.com/docs/websites/cms/install-and-configure-drupal-8


常见FAQ:


clean URL配置:

## 查看apache是否有rewrite_module
# apachectl -M |grep rewrite
>rewrite_module (shared)
## 配置 /etc/httpd/conf/httpd.conf
# vim /etc/httpd/conf/httpd.conf
## 在最后添加:
LoadModule rewrite_module modules/mod_rewrite.so
## 修改AllowOverride
<Directory "/var/www/html/drupal">   
    AllowOverride All
    Require all granted
</Directory>
##保存退出

重启apache服务:

systemctl restart httpd

发表评论