千家信息网

LAMP 编译安装 +wordpress+discuz

发表于:2024-10-04 作者:千家信息网编辑
千家信息网最后更新 2024年10月04日,#软件下载#开源博客Wordpress 下载地址:https://cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gz#PHP 7 下载地址:http://cn2
千家信息网最后更新 2024年10月04日LAMP 编译安装 +wordpress+discuz


#软件下载

#开源博客Wordpress 下载地址:https://cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gz

#PHP 7 下载地址:http://cn2.php.net/distributions/php-7.1.4.tar.gz

#apache 下载地址: http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.25.tar.gz

#数据库 Mariadb 下载地址:系统镜像(本次采取yum 安装, 编译安装 参考:Mysql 5.7.17 编译安装)


#系统环境

[root@KVM_1 ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)[root@KVM_1 ~]# ip addr show eno33554960 3: eno33554960:  mtu 1500 qdisc pfifo_fast state UP qlen 1000    link/ether 00:0c:29:84:b7:60 brd ff:ff:ff:ff:ff:ff    inet 192.168.174.134/24 brd 192.168.174.255 scope global dynamic eno33554960       valid_lft 1779sec preferred_lft 1779sec    inet6 fe80::20c:29ff:fe84:b760/64 scope link        valid_lft forever preferred_lft forever


#关闭防火墙和selinux

[root@KVM_1 ~]# systemctl stop firewalld[root@KVM_1 ~]# setenforce 0


#YUM设置

[root@KVM_1 ~]# cat /etc/yum.repos.d/local.repo [local]name=localbaseurl=file:///mnt/cdromgpgcheck=0enabled=1


apache编译安装

#下载软件(自行操作)

[root@KVM_1 ~]# lshttpd-2.4.25.tar.gz  php-7.1.4.tar.gz  wordpress-4.7.4-zh_CN.tar.gz[root@KVM_1 ~]# tar -xf  httpd-2.4.25.tar.gz[root@KVM_1 ~]# cd httpd-2.4.25/#安装依赖包[root@KVM_1 httpd-2.4.25]# yum install -y net-tools  pcre-devel zlib-devel apr apr-devel  apr-util  apr-util-devel gcc-c++#编译 [root@KVM_1 httpd-2.4.25]# ./configure --prefix=/usr/local/apache  --with-mysql=/usr/share/mysql  --enable-module=so  --enable-shared=max --enable-rewrite#出现以下结果表示编译检查成功configure: summary of build options:    Server Version: 2.4.25    Install prefix: /usr/local/apache    C compiler:     gcc -std=gnu99    CFLAGS:           -pthread    LDFLAGS:             LIBS:               CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE    C preprocessor: gcc -E    #编译安装[root@KVM_1 httpd-2.4.25]# make && make install


#安装数据库

#本次采用yum安装 (编译安装可参考 Mysql 5.7.17 编译安装)

[root@KVM_1 ~]# yum install -y mariadb mariadb-server[root@KVM_1 ~]# systemctl start mariadb


#初始化数据库

[root@KVM_1 ~]# mysql_secure_installation /usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not foundNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the currentpassword for the root user.  If you've just installed MariaDB, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation.Set root password? [Y/n] y            #选择 yNew password:                         #设置密码 123456Re-enter new password:                #设置密码 123456Password updated successfully!Reloading privilege tables.. ... Success!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem.  This is intended only for testing, and to make the installationgo a bit smoother.  You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] y      #选择 y ... Success!Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n        #选择 n ... skipping.By default, MariaDB comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] y     #选择 y - Dropping test database... ... Success! - Removing privileges on test database... ... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] y      #选择 y ... Success!Cleaning up...All done!  If you've completed all of the above steps, your MariaDBinstallation should now be secure.Thanks for using MariaDB!


#创建Wordpress数据库

[root@KVM_1 ~]# mysql -uroot -p123456Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 9Server version: 5.5.44-MariaDB MariaDB ServerCopyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> create database wordpressdb;Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> create user 'wordpressuser'@'localhost' identified by '123456';Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> grant all on wordpressdb.* to 'wordpressuser'@'localhost';Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> grant all on wordpressdb.* to 'wordpressuser'@'%' ;Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> exitBye


#PHP7编译安装

#安装PHP依赖 libmcrypt 下载地址ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.6.tar.gz

#下载libmcrypt[root@KVM_1 ~]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.6.tar.gz[root@KVM_1  ~]# tar -xf libmcrypt-2.5.6.tar.gz [root@KVM_1 ~]# cd libmcrypt-2.5.6/[root@KVM_1 libmcrypt-2.5.6]# ./configure [root@KVM_1 libmcrypt-2.5.6]# make && make install


#软件下载(自行操作)

[root@KVM_1 ~]# ls httpd-2.4.25.tar.gz  php-7.1.4.tar.gz  wordpress-4.7.4-zh_CN.tar.gz   httpd-2.4.25           [root@KVM_1 ~]# tar -xf php-7.1.4.tar.gz [root@KVM_1 ~]# cd php-7.1.4/[root@KVM_1  php-7.1.4]# yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel[root@KVM_1  php-7.1.4]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache/bin/apxs \--with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql \--enable-fpm --with-gd --with-iconv --with-zlib --enable-xml \--enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex \--enable-exif --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl \--enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear \--with-gettext --enable-session --with-curl --with-jpeg-dir \--with-freetype-dir --enable-opcache --enable-fileinfo#出现以下情况表示编译检查成功+--------------------------------------------------------------------+| License:                                                           || This software is subject to the PHP License, available in this     || distribution in the file LICENSE.  By continuing this installation || process, you are bound by the terms of this license agreement.     || If you do not agree with the terms of this license, you must abort || the installation process at this point.                            |+--------------------------------------------------------------------+Thank you for using PHP.config.status: creating php7.specconfig.status: creating main/build-defs.hconfig.status: creating scripts/phpizeconfig.status: creating scripts/man1/phpize.1config.status: creating scripts/php-configconfig.status: creating scripts/man1/php-config.1config.status: creating sapi/cli/php.1config.status: creating sapi/fpm/php-fpm.confconfig.status: creating sapi/fpm/www.confconfig.status: creating sapi/fpm/init.d.php-fpmconfig.status: creating sapi/fpm/php-fpm.serviceconfig.status: creating sapi/fpm/php-fpm.8config.status: creating sapi/fpm/status.htmlconfig.status: creating sapi/cgi/php-cgi.1config.status: creating ext/phar/phar.1config.status: creating ext/phar/phar.phar.1config.status: creating main/php_config.hconfig.status: executing default commands#编译安装[root@KVM_1  php-7.1.4]# make && make install


#注:此处同时开启了 --enable-fpm 和 --with-apxs2

# --with-apxs2 是直接把php编译到apache的模块中去 ,apachectl -M 可以查看被加载的模块

# --enable-fpm 是开启php-fpm

#如果只想使用php-fpm 可以取消--with-apxs2选项

#参数详解 http://www.jianshu.com/p/0a79847c8151

#方便起见,本文没有采用php-fpm



#修改http配置文件以支持php

[root@KVM_1 ~]# vim /usr/local/apache/conf/httpd.conf#将第254行修改为如下值     DirectoryIndex index.php index.html #第392行增加如下值  AddType application/x-httpd-php .php


#开启服务

[root@KVM_1 ~]# /usr/local/apache/bin/apachectl -k startAH00557: httpd: apr_sockaddr_info_get() failed for KVM_1AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message[root@KVM_1 ~]# 此处的两个警告产生的原因是 没有设置 ServerName 和 没有在 /etc/hosts 设置主机名与ip的对应关系 [root@KVM_1 ~]# vim /usr/local/apache/conf/httpd.conf#修改第196行 改为如下值ServerName localhost:80[root@KVM_1 ~]# vim /etc/hosts[root@KVM_1 ~]# cat /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.174.134 KVM_1[root@KVM_1 ~]# /usr/local/apache/bin/apachectl -k restart


#添加php文件

[root@KVM_1 ~]# vim /usr/local/apache/htdocs/index.php[root@KVM_1  ~]#  rm -f /usr/local/apache/htdocs/index.html  [root@KVM_1 ~]# cat /usr/local/apache/htdocs/index.php[root@KVM_1 ~]# chown -R daemon:daemon /usr/local/apache


#测试



#设置虚拟主机

[root@KVM_1 ~]# vim /usr/local/apache/conf/httpd.conf#取消第479行的注释(或者在最后一行增加如下配置)Include conf/extra/httpd-vhosts.conf[root@KVM_1 ~]# vim /usr/local/apache/conf/extra/httpd-vhosts.conf #添加如下配置(删除原有配置)DocumentRoot "/usr/local/apache/htdocs/blog"ServerName "blog.chauncey.com"AllowOverride NoneRequire all granted[root@KVM_1 ~]# mkdir /usr/local/apache/htdocs/blog


#安装开源博客 Wordpress

#软件下载(自行操作)

[root@KVM_1 ~]# lsanaconda-ks.cfg  httpd-2.4.25.tar.gz  libmcrypt-2.5.6.tar.gz  php-7.1.4.tar.gz  wordpress-4.7.4-zh_CN.tar.gzhttpd-2.4.25     libmcrypt-2.5.6      php-7.1.4     [root@KVM_1 ~]# tar -xf wordpress-4.7.4-zh_CN.tar.gz [root@KVM_1 ~]# cp -rf wordpress/* /usr/local/apache/htdocs/blog/[root@KVM_1 ~]# chown -R daemon:daemon /usr/local/apache/htdocs/blog#语法检查[root@KVM_1 ~]# /usr/local/apache/bin/apachectl -tSyntax OK#开启服务[root@KVM_1 ~]# /usr/local/apache/bin/apachectl -k start[root@KVM_1 ~]# netstat -lntup | grep 80tcp        0      0 192.168.174.134:80      0.0.0.0:*               LISTEN      3068/httpd          [root@KVM_1 ~]#

#设置DNS解析

#window设置hosts文件(C:\Windows\System32\drivers\etc\hosts)增加一行解析 #Linux设置hosts (/etc/hosts)



#输入blog.chauncey.com


#填写相关数据



#填写相关数据


#安装完成,wordpress十分强大,插件丰富,可以去腾讯云或者阿里云买一台云主机,来搭建自己的个人博客。




#登陆密码忘记 找回方法:

WordPress恢复密码PHP文件 下载地址:https://www.freehao123.com/dl-wordpress-password-php/

上传到 wordpress根目录下面 /usr/local/apache/htdocs/blog


访问














#Discuz!论坛安装

#软件下载 下载地址:http://www.discuz.net/forum-10-1.html


#创建Discuz!数据库

[root@KVM_1 ~]# mysql -uroot -p123456Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 80Server version: 5.5.44-MariaDB MariaDB ServerCopyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> create database discuz;Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> create user 'discuzuser'@'localhost' identified by '123456';Query OK, 0 rows affected (0.01 sec)MariaDB [(none)]> grant all on discuz.* to 'discuzuser'@'localhost';Query OK, 0 rows affected (0.01 sec)MariaDB [(none)]> grant all on discuz.* to 'discuzuser'@'%';Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> exitBye


#上传软件

[root@KVM_1 ~]# wget http://download.comsenz.com/DiscuzX/3.3/Discuz_X3.3_SC_GBK.zip [root@KVM_1 ~]# yum install -y unzip[root@KVM_1 ~]# unzip Discuz_X3.3_SC_GBK.zip [root@KVM_1 ~]# mkdir /usr/local/apache/htdocs/bbs/[root@KVM_1 ~]# cp -rf upload/* /usr/local/apache/htdocs/bbs/[root@KVM_1 ~]# chown -R daemon:daemon /usr/local/apache/htdocs/bbs


#增加虚拟主机

[root@KVM_1 ~]# vim /usr/local/apache/conf/extra/httpd-vhosts.conf [root@KVM_1 ~]# cat /usr/local/apache/conf/extra/httpd-vhosts.conf #增加如下配置DocumentRoot "/usr/local/apache/htdocs/bbs"ServerName "bbs.chauncey.com"AllowOverride NoneRequire all granted


#开启服务

#语法检查[root@KVM_1 ~]# /usr/local/apache/bin/apachectl -tSyntax OK[root@KVM_1 ~]# /usr/local/apache/bin/apachectl -k restart


#设置DNS解析

#window设置hosts文件(C:\Windows\System32\drivers\etc\hosts)增加一行解析 #Linux设置hosts (/etc/hosts)


#开始安装


#开始安装


#检查环境


#设置数据库


#安装完成


#测试访问









编译 数据 地址 数据库 软件 文件 检查 选择 配置 主机 密码 软件下载 一行 博客 服务 成功 模块 环境 系统 虚拟主机 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 检验鉴定软件开发 河南数据库安全箱销售价格 数据结构与数据库是讲什么的 武汉网络安全学院规划方案 方舟手游服务器管理员菜单公告 数据通信网络技术电子书 郑州工控软件开发怎么样 向云服务器导入数据库 莱阳安卓软件开发外包公司 数据库中grow by 小白云服务器赚钱 谷歌服务器连接电脑 网站服务器租用 价格 hp服务器分类 db2数据库培训 北京 软件开发和网页哪个好 泽农网络技术工作室 服务器里的内存是什么意思 2021年广西网络安全知识题库 关于java软件开发 期货公司的服务器一般在哪里 联想刀片服务器管理IP 上海项目软件开发定制大概费用 我的世界服务器延迟用啥表示 网络安全认证考试成绩查询 耐磨是用来描述数据库的什么 学习计算机网络技术要用电脑吗 福建网络安全知识竞赛 温州模具厂erp软件开发 金控集团软件开发题目
0