RHEL7搭建LAMP环境并安装Discuz论坛
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RHEL7搭建LAMP环境并安装Discuz论坛相关的知识,希望对你有一定的参考价值。
一、安装httpd
[[email protected] ~]# yum install httpd
Loaded plugins: product-id, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-40.el7 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-40.el7 for package: httpd-2.4.6-40.el7.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-40.el7.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-40.el7 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================
Package Arch Version Repository Size
===========================================================================================
Installing:
httpd x86_64 2.4.6-40.el7 local 1.2 M
Installing for dependencies:
httpd-tools x86_64 2.4.6-40.el7 local 82 k
mailcap noarch 2.1.41-2.el7 local 31 k
Transaction Summary
===========================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 1.3 M
Installed size: 3.9 M
Is this ok [y/d/N]: y
Downloading packages:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 451 kB/s | 1.3 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : httpd-tools-2.4.6-40.el7.x86_64 1/3
Installing : mailcap-2.1.41-2.el7.noarch 2/3
Installing : httpd-2.4.6-40.el7.x86_64 3/3
Verifying : mailcap-2.1.41-2.el7.noarch 1/3
Verifying : httpd-tools-2.4.6-40.el7.x86_64 2/3
Verifying : httpd-2.4.6-40.el7.x86_64 3/3
Installed:
httpd.x86_64 0:2.4.6-40.el7
Dependency Installed:
httpd-tools.x86_64 0:2.4.6-40.el7 mailcap.noarch 0:2.1.41-2.el7
Complete!
[[email protected] ~]#
二、安装php
[[email protected] ~]# yum install php*
Loaded plugins: product-id, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-36.el7_1 will be installed
---> Package php-cli.x86_64 0:5.4.16-36.el7_1 will be installed
---> Package php-common.x86_64 0:5.4.16-36.el7_1 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-36.el7_1.x86_64
---> Package php-gd.x86_64 0:5.4.16-36.el7_1 will be installed
--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: php-gd-5.4.16-36.el7_1.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: php-gd-5.4.16-36.el7_1.x86_64
--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-36.el7_1.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-5.4.16-36.el7_1.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.4.16-36.el7_1.x86_64
---> Package php-ldap.x86_64 0:5.4.16-36.el7_1 will be installed
---> Package php-mysql.x86_64 0:5.4.16-36.el7_1 will be installed
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: php-mysql-5.4.16-36.el7_1.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: php-mysql-5.4.16-36.el7_1.x86_64
---> Package php-odbc.x86_64 0:5.4.16-36.el7_1 will be installed
--> Processing Dependency: libodbc.so.2()(64bit) for package: php-odbc-5.4.16-36.el7_1.x86_64
---> Package php-pdo.x86_64 0:5.4.16-36.el7_1 will be installed
---> Package php-pear.noarch 1:1.9.4-21.el7 will be installed
---> Package php-pecl-memcache.x86_64 0:3.0.8-4.el7 will be installed
---> Package php-pgsql.x86_64 0:5.4.16-36.el7_1 will be installed
--> Processing Dependency: libpq.so.5()(64bit) for package: php-pgsql-5.4.16-36.el7_1.x86_64
---> Package php-process.x86_64 0:5.4.16-36.el7_1 will be installed
---> Package php-recode.x86_64 0:5.4.16-36.el7_1 will be installed
--> Processing Dependency: librecode.so.0()(64bit) for package: php-recode-5.4.16-36.el7_1.x86_64
---> Package php-soap.x86_64 0:5.4.16-36.el7_1 will be installed
---> Package php-xml.x86_64 0:5.4.16-36.el7_1 will be installed
---> Package php-xmlrpc.x86_64 0:5.4.16-36.el7_1 will be installed
--> Running transaction check
---> Package libX11.x86_64 0:1.6.3-2.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.3-2.el7 for package: libX11-1.6.3-2.el7.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.3-2.el7.x86_64
---> Package libXpm.x86_64 0:3.5.11-3.el7 will be installed
---> Package libpng.x86_64 2:1.5.13-5.el7 will be installed
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package mariadb-libs.x86_64 1:5.5.44-2.el7 will be installed
---> Package postgresql-libs.x86_64 0:9.2.13-1.el7_1 will be installed
---> Package recode.x86_64 0:3.6-38.el7 will be installed
---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed
---> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-11.el7.x86_64
--> Running transaction check
---> Package libX11-common.noarch 0:1.6.3-2.el7 will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-20.el7 will be installed
---> Package libxcb.x86_64 0:1.11-4.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.11-4.el7.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================
Package Arch Version Repository Size
===========================================================================================
Installing:
php x86_64 5.4.16-36.el7_1 local 1.4 M
php-cli x86_64 5.4.16-36.el7_1 local 2.7 M
php-common x86_64 5.4.16-36.el7_1 local 563 k
php-gd x86_64 5.4.16-36.el7_1 local 126 k
php-ldap x86_64 5.4.16-36.el7_1 local 51 k
php-mysql x86_64 5.4.16-36.el7_1 local 99 k
php-odbc x86_64 5.4.16-36.el7_1 local 64 k
php-pdo x86_64 5.4.16-36.el7_1 local 97 k
php-pear noarch 1:1.9.4-21.el7 local 357 k
php-pecl-memcache x86_64 3.0.8-4.el7 local 67 k
php-pgsql x86_64 5.4.16-36.el7_1 local 84 k
php-process x86_64 5.4.16-36.el7_1 local 54 k
php-recode x86_64 5.4.16-36.el7_1 local 37 k
php-soap x86_64 5.4.16-36.el7_1 local 157 k
php-xml x86_64 5.4.16-36.el7_1 local 124 k
php-xmlrpc x86_64 5.4.16-36.el7_1 local 67 k
Installing for dependencies:
libX11 x86_64 1.6.3-2.el7 local 606 k
libX11-common noarch 1.6.3-2.el7 local 162 k
libXau x86_64 1.0.8-2.1.el7 local 29 k
libXpm x86_64 3.5.11-3.el7 local 54 k
libpng x86_64 2:1.5.13-5.el7 local 212 k
libtool-ltdl x86_64 2.4.2-20.el7 local 49 k
libxcb x86_64 1.11-4.el7 local 189 k
libzip x86_64 0.10.1-8.el7 local 49 k
mariadb-libs x86_64 1:5.5.44-2.el7 local 754 k
postgresql-libs x86_64 9.2.13-1.el7_1 local 230 k
recode x86_64 3.6-38.el7 local 718 k
t1lib x86_64 5.1.2-14.el7 local 166 k
unixODBC x86_64 2.3.1-11.el7 local 413 k
Transaction Summary
===========================================================================================
Install 16 Packages (+13 Dependent packages)
Total download size: 9.5 M
Installed size: 34 M
Is this ok [y/d/N]: y
Downloading packages:
-------------------------------------------------------------------------------------------
Total 16 MB/s | 9.5 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libzip-0.10.1-8.el7.x86_64 1/29
Installing : php-common-5.4.16-36.el7_1.x86_64 2/29
Installing : php-pdo-5.4.16-36.el7_1.x86_64 3/29
Installing : php-cli-5.4.16-36.el7_1.x86_64 4/29
Installing : php-process-5.4.16-36.el7_1.x86_64 5/29
Installing : php-xml-5.4.16-36.el7_1.x86_64 6/29
Installing : 1:php-pear-1.9.4-21.el7.noarch 7/29
Installing : 1:mariadb-libs-5.5.44-2.el7.x86_64 8/29
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
Installing : libXau-1.0.8-2.1.el7.x86_64 9/29
Installing : libxcb-1.11-4.el7.x86_64 10/29
Installing : libX11-common-1.6.3-2.el7.noarch 11/29
Installing : libX11-1.6.3-2.el7.x86_64 12/29
Installing : t1lib-5.1.2-14.el7.x86_64 13/29
Installing : libXpm-3.5.11-3.el7.x86_64 14/29
Installing : 2:libpng-1.5.13-5.el7.x86_64 15/29
Installing : recode-3.6-38.el7.x86_64 16/29
Installing : libtool-ltdl-2.4.2-20.el7.x86_64 17/29
Installing : unixODBC-2.3.1-11.el7.x86_64 18/29
Installing : postgresql-libs-9.2.13-1.el7_1.x86_64 19/29
Installing : php-pgsql-5.4.16-36.el7_1.x86_64 20/29
Installing : php-odbc-5.4.16-36.el7_1.x86_64 21/29
Installing : php-recode-5.4.16-36.el7_1.x86_64 22/29
Installing : php-gd-5.4.16-36.el7_1.x86_64 23/29
Installing : php-mysql-5.4.16-36.el7_1.x86_64 24/29
Installing : php-pecl-memcache-3.0.8-4.el7.x86_64 25/29
Installing : php-5.4.16-36.el7_1.x86_64 26/29
Installing : php-ldap-5.4.16-36.el7_1.x86_64 27/29
Installing : php-soap-5.4.16-36.el7_1.x86_64 28/29
Installing : php-xmlrpc-5.4.16-36.el7_1.x86_64 29/29
Verifying : postgresql-libs-9.2.13-1.el7_1.x86_64 1/29
Verifying : libtool-ltdl-2.4.2-20.el7.x86_64 2/29
Verifying : php-5.4.16-36.el7_1.x86_64 3/29
Verifying : recode-3.6-38.el7.x86_64 4/29
Verifying : libxcb-1.11-4.el7.x86_64 5/29
Verifying : php-process-5.4.16-36.el7_1.x86_64 6/29
Verifying : php-pecl-memcache-3.0.8-4.el7.x86_64 7/29
Verifying : php-ldap-5.4.16-36.el7_1.x86_64 8/29
Verifying : 2:libpng-1.5.13-5.el7.x86_64 9/29
Verifying : php-soap-5.4.16-36.el7_1.x86_64 10/29
Verifying : php-cli-5.4.16-36.el7_1.x86_64 11/29
Verifying : php-xml-5.4.16-36.el7_1.x86_64 12/29
Verifying : php-mysql-5.4.16-36.el7_1.x86_64 13/29
Verifying : libX11-common-1.6.3-2.el7.noarch 14/29
Verifying : t1lib-5.1.2-14.el7.x86_64 15/29
Verifying : unixODBC-2.3.1-11.el7.x86_64 16/29
Verifying : libXpm-3.5.11-3.el7.x86_64 17/29
Verifying : php-odbc-5.4.16-36.el7_1.x86_64 18/29
Verifying : php-gd-5.4.16-36.el7_1.x86_64 19/29
Verifying : php-recode-5.4.16-36.el7_1.x86_64 20/29
Verifying : php-common-5.4.16-36.el7_1.x86_64 21/29
Verifying : libXau-1.0.8-2.1.el7.x86_64 22/29
Verifying : php-pdo-5.4.16-36.el7_1.x86_64 23/29
Verifying : php-pgsql-5.4.16-36.el7_1.x86_64 24/29
Verifying : 1:mariadb-libs-5.5.44-2.el7.x86_64 25/29
Verifying : libzip-0.10.1-8.el7.x86_64 26/29
Verifying : libX11-1.6.3-2.el7.x86_64 27/29
Verifying : php-xmlrpc-5.4.16-36.el7_1.x86_64 28/29
Verifying : 1:php-pear-1.9.4-21.el7.noarch 29/29
Installed:
php.x86_64 0:5.4.16-36.el7_1 php-cli.x86_64 0:5.4.16-36.el7_1
php-common.x86_64 0:5.4.16-36.el7_1 php-gd.x86_64 0:5.4.16-36.el7_1
php-ldap.x86_64 0:5.4.16-36.el7_1 php-mysql.x86_64 0:5.4.16-36.el7_1
php-odbc.x86_64 0:5.4.16-36.el7_1 php-pdo.x86_64 0:5.4.16-36.el7_1
php-pear.noarch 1:1.9.4-21.el7 php-pecl-memcache.x86_64 0:3.0.8-4.el7
php-pgsql.x86_64 0:5.4.16-36.el7_1 php-process.x86_64 0:5.4.16-36.el7_1
php-recode.x86_64 0:5.4.16-36.el7_1 php-soap.x86_64 0:5.4.16-36.el7_1
php-xml.x86_64 0:5.4.16-36.el7_1 php-xmlrpc.x86_64 0:5.4.16-36.el7_1
Dependency Installed:
libX11.x86_64 0:1.6.3-2.el7 libX11-common.noarch 0:1.6.3-2.el7
libXau.x86_64 0:1.0.8-2.1.el7 libXpm.x86_64 0:3.5.11-3.el7
libpng.x86_64 2:1.5.13-5.el7 libtool-ltdl.x86_64 0:2.4.2-20.el7
libxcb.x86_64 0:1.11-4.el7 libzip.x86_64 0:0.10.1-8.el7
mariadb-libs.x86_64 1:5.5.44-2.el7 postgresql-libs.x86_64 0:9.2.13-1.el7_1
recode.x86_64 0:3.6-38.el7 t1lib.x86_64 0:5.1.2-14.el7
unixODBC.x86_64 0:2.3.1-11.el7
Complete!
[[email protected] ~]#
三、编译安装mysql
参考《编译安装mysql5.7.13》
四、修改httpd配置文件、开启http服务和80端口
修改 vi /etc/httpd/conf/httpd.conf
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php forum.php
</IfModule>
[[email protected] upload]# systemctl start httpd
[[email protected] upload]# netstat -an | grep 80
tcp6 0 0 :::80 :::* LISTEN
unix 2 [ ] DGRAM 19805
unix 3 [ ] STREAM CONNECTED 18042
[[email protected] upload]# firewall-cmd --add-port=80/tcp --zone=public --permanent
success
[[email protected] upload]#
五、上传并安装Discuz论坛
5.1配置selinux和对应目录权限(解决上图问题)
[[email protected] ~]# cd /var/www/
[[email protected] www]# chcon -R -t httpd_sys_content_t html/
[[email protected] ~]# setsebool -P httpd_unified=1
[[email protected] ~]# setsebool -P httpd_enable_ftp_server=1
[[email protected] ~]# setsebool -P httpd_enable_homedirs=1
[[email protected] ~]# chown -R apache.apache /var/www/html/config/
[[email protected] ~]# chown -R apache.apache /var/www/html/data/
[[email protected] ~]# chown -R apache.apache /var/www/html/uc_client/
[[email protected] ~]# chown -R apache.apache /var/www/html/uc_server/
[[email protected] ~]#
5.2继续安装Discuz
5.3解决selinux引起的mysql数据库连接问题
更改seLinux bool值
setsebool -P httpd_can_network_connect_db=1
5.3安装成功
六、设置httpd开机自启动
[[email protected] ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[[email protected] ~]#
本文出自 “高家大少的技术库” 博客,请务必保留此出处http://gaopengju.blog.51cto.com/12830710/1947593
以上是关于RHEL7搭建LAMP环境并安装Discuz论坛的主要内容,如果未能解决你的问题,请参考以下文章