CentOS 7搭建tengine+php+mariadb环境并安装discuz论坛
更新:HHH   时间:2023-1-7


 

一、安装tengine+php+mariadb环境

 

1、配置网络

nmcli c del 'System eth0'  # 删除网络

nmcli c add con-name myeth0 ifname eth0 typeethernet ip4 172.16.10.133/24 gw4 172.16.10.254     #配置IP地址以及网关

nmcli c mod myeth0 ipv4.dns"223.5.5.5,223.6.6.6" #设置DNS服务器

 

systemctl disable nfs.target   #关闭不需要的服务

 

systemctl disable iscsid.socket #关闭不需要的服务

 

systemctl disable iscsiuio.socket#关闭不需要的服务

 

systemctl disable firewalld   #关闭不需要的服务

 

 

sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config

查询selinux是否关闭:sestatus

检查网络连通性ping www.sohu.com

重启系统reboot

 

2、安装PHP环境

yum install -y php.x86_64 php-bcmath.x86_64php-cli.x86_64 php-common.x86_64 php-dba.x86_64 php-embedded.x86_64 php-fpm.x86_64php-gd.x86_64 php-intl.x86_64 php-mbstring.x86_64 php-mysql.x86_64php-pdo.x86_64 php-pear.noarch php-pspell.x86_64 php-recode.x86_64php-soap.x86_64 php-xml.x86_64 php-pecl-memcache.x86_64

 

sed -i 's/apache/nginx/g'  /etc/php-fpm.d/www.conf

 

systemctl enable php-fpm   #开启系统自启动

systemctl start php-fpm    #开启服务

 

3、安装Mariadb数据库(Mysql的分支)

yum install -y mariadb-server mariadb-libsmariadb

systemctl enable mariadb

systemctl start mariadb

systemctl status mariadb  #查看服务启动状态

 

 

4、安装Tengine环境 

cd

wget   (安装wget yum -y installwget)   http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-2.noarch.rpm

rpm -ivh epel-release-7-2.noarch.rpm

yum -y install GeoIP gd  gperftools-libs

rpm -ivhtengine-1.5.2-1.el7.centos.x86_64.rpm

chgrp nginx /var/lib/php/session/

systemctl enable nginx

systemctl start nginx

   

 

5、检查端口 yum -yinstall net-tools #安装netstat,ifconfig

netstat -lnp|egrep '(80|9000|3306)'

应该看到下面3端口在监听网络

[root@vm-centos7 ~]# netstat -lnp|egrep'(80|9000|3306)'

tcp       0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      1425/php-fpm: maste

tcp       0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1098/mysqld        

tcp       0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1392/nginx: master 

 

nginx -t 检测程序是否正常

设置网站权限 chown -R nginx:nginx /srv/www/

如果有问题请加QQ:116116130 备注:centos 7 -51cto

返回web开发教程...