CentOs7 LAMP Drupal安装记录

2/13/2017来源:经验技巧人气:1920

1.重设ip

先使用DHCP

在/etc/sysconfig/network-scripts/ifcfg-eno***中加入 

ONBOOT=YES

BOOTPROTO=DHCP

# systemctl restart network

2.更新yum的源为国内源

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

# yum clean all 

# yum makecache

3.安装和更新一些必要工具

yum install net-tools make gcc kernel-devel ntsysv tree links wget

4.安装Apache

yum install httpd

修改配置文件

vi /etc/httpd/conf/httpd.conf

ServerSignature On#添加,在错误页中显示Apache的版本,Off为不显示

#AddHandler cgi-script .cgi #修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)

AllowOverride None #修改为:AllowOverride All (允许.htaccess

AddDefaultCharset UTF-8 #修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)

#Options Indexes FollowSymLinks #修改为 Options FollowSymLinks(不在浏览器上显示树状目录结构)

DirectoryIndex index.html#修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php(设置默认首页文件,增加index.php)

MaxKeepAliveRequests500#添加MaxKeepAliveRequests 500 (增加同时连接数)

重启httpd

systemctl restart httpd.service

增加自启动

systemctl enable httpd.service

5.增加防火墙

firewall-cmd--permanent--zone=public--add-service=http

firewall-cmd--permanent--zone=public--add-service=https

firewall-cmd--reload

firewall-cmd --list-all

6.安装MariaDB

更新epel

rpm--import /etc/pki/rpm-gpg/RPM-GPG-KEY*

yum-y install epel-release

yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service

MySQL_secure_installation

7.安装PHP7

删除之前的旧版本

# yum remove php* php-common

设置yum 源:

# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

安装php7

# yum install php70w

# php -v

# systemctl restart httpd.service

获得支持

#yum install php70w-dba.x86_64 php70w-devel.x86_64 php70w-embedded.x86_64 php70w-enchant.x86_64 php70w-fpm.x86_64 php70w-gd.x86_64 php70w-imap.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysqlnd.x86_64 php70w-odbc.x86_64 php70w-opcache.x86_64 php70w-pdo.x86_64 php70w-pdo_dblib.x86_64 php70w-pear.noarch php70w-pecl-apcu.x86_64 php70w-pecl-apcu-devel.x86_64 php70w-pecl-imagick.x86_64 php70w-pecl-imagick-devel.x86_64 php70w-pecl-mongodb.x86_64 php70w-pecl-redis.x86_64 php70w-pecl-xdebug.x86_64 php70w-pgsql.x86_64 php70w-xml.x86_64 php70w-xmlrpc.x86_64 php70w-intl php70w-bcmath.x86_64 -y

8.安装 phpMyAdmin

#yum install phpMyAdmin

#vi /etc/httpd/conf.d/phpMyAdmin.conf

<Directory /usr/share/phpMyAdmin/>

Options none

AllowOverrideLimit

Require all granted

</Directory>

将phpMyAdmin的认证cookie修改为http

# vi /etc/phpMyAdmin/config.inc.php

$cfg['Servers'][$i]['auth_type']     = 'http';

9安装Drupal

在安装时报文件和目录不可写,主是要selinux进行了控制,先查看下不可写目录与文件的值:

ls -lZ 

-rwxr--r--. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 default.settings.php drwxrwxrwx. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 files -rwxrwxrwx. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 settings.php

需要增加以下命令:

 chcon -t httpd_sys_content_rw_t sites/default/  chcon -t httpd_sys_content_rw_t sites/default/settings.php  chcon -t httpd_sys_content_rw_t sites/default/files

完成Drupal安装。