您现在的位置是:首页 > cms教程 > WordPress教程WordPress教程
centos7安装wordpress教程步骤方法
傲蕾2025-02-18WordPress教程已有人查阅
导读安装之前:建议安装各种软件一、安装apache测试环境建议关闭防火墙和SELinux1.2.1首先需要创建一个存放网站的目录(文件夹)1.2.2修改apache配置文件(默认配置文件是/etc/httpd/conf/http.conf)
安装之前:建议安装各种软件
测试环境建议关闭防火墙和SELinux
1.1安装apache
1.2.1首先需要创建一个存放网站的目录(文件夹)
2.1安装mariadb
Centos7已经没有自带mysql了,默认自带的是Mariadb
3.1安装PHP
3.1.1 配置源:(或者去官网下载更新的版本上传到服务器)
4.1首先登陆MariaDB为WordPress建立数据库及用户
5.1下载wordpress
5.2修改文件夹权限
打开浏览器输入网址:http://test.cn/wp-admin/index.php 然后初始化配置即可
[root@localhost ~]# yum -y install wget zip unzip net-tools
一、安装apache测试环境建议关闭防火墙和SELinux
1.1安装apache
[root@localhost ~]# yum -y install httpd
1.2配置apache1.2.1首先需要创建一个存放网站的目录(文件夹)
[root@localhost ~]# cd /home/
[root@localhost www]# mkdir test //创建站点目录,这里创建了一个test站点目录
1.2.2修改apache配置文件(默认配置文件是/etc/httpd/conf/http.conf)
[root@localhost conf.d]# cd /etc/httpd/conf/
[root@localhost conf]# vim httpd.conf //增加以下内容,红色部分根据自己的实际情况修改
<VirtualHost *:80>
Serveradmin 123456
ServerName.test.cn
DocumentRoot /home/ /test
<Directory "/home/ /test">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*).htmp$ index.html
</IfModule>
</Directory>
</VirtualHost>
[root@localhost conf]# systemctl start httpd
[root@localhost conf]# systemctl enbale httpd
二、安装mariadb(Mysql)2.1安装mariadb
Centos7已经没有自带mysql了,默认自带的是Mariadb
[root@localhost ~]# yum -y install mariadb-server mariadb
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl enable mariadb
2.2 初始化mariadb,并配置root密码:
[root@localhost ~]# mysql_secure_installation //初始化mariadb并配置数据库的root密码
NOTE: 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 current
password for the root user. If you've just installed MariaDB, and
you 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): (输入原始root密码,默认无,直接回车)
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y (是否设置root密码,一般都需要设置一个密码)
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y (是否移除匿名用户,为了安全建议删除)
... skipping.
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y (是否禁止远程root登陆,为了安全建议禁止)
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y (是否删除测试数据库,为了安全,建议删除)
... skipping.
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y (重新载入)
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@localhost ~]#
三、安装PHP3.1安装PHP
3.1.1 配置源:(或者去官网下载更新的版本上传到服务器)
[root@localhost ~]# rpm -Uvh http://mirror.webtatic.com/yum/el7/epel-release.rpm
[root@localhost ~]# rpm -Uvh http://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3.1.2安装fpm和组件,fpm是php的进程管理器
[root@localhost ~]# yum -y install php56w-fpm //(也可以php70w-fpm,或者更高的版本)
[root@localhost ~]# yum search php //查看php有哪些组件
[root@localhost ~]# yum -y install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 //安装php组件
四、配置WordPress数据库4.1首先登陆MariaDB为WordPress建立数据库及用户
[root@localhost ~]# mysql -u root -p
Enter password: //输入数据库密码进入数据库
MariaDB [(none)]>
MariaDB [(none)]> create database wordpressdb; //新建的数据库为wordpressdb
MariaDB [(none)]> CREATE USER wordpressuser@localhost IDENTIFIED BY '123456'; //新建用户为wordpressuser,密码为123456
MariaDB [(none)]> grant all privileges on wordpressdb.* to wordpressuser@localhost; //并为新建的wordpressuser这个用户赋予@localhost(即本地)的权限
MariaDB [(none)]> flush privileges; //刷新用户权限
MariaDB [(none)]> exit
五、安装WordPress5.1下载wordpress
[root@localhost ~]# cd /home/ /test
[root@localhost test]# wget http://wordpress.org/latest.zip
[root@localhost test]# unzip -q latest.zip
或者可以在windows电脑里面下载好了上传到 /home/ /test这个文件夹5.2修改文件夹权限
[root@localhost test]# chown -R apache:apache /home/ /test
5.3编辑配置文件
[root@localhost ~]# cd /home/ /test/wordpress //进入wordpress解压的目录里面
[root@localhost test]# cp wp-config-sample.php wp-config.php //先把配置文件的原始文件备份一个
[root@localhost test]# vim wp-config.php //修改配置
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpressdb' ); //修改为第四步自己新建数据库的名称
/** MySQL database username */
define( 'DB_USER', 'wordpressuser' ); //修改为第四步自己新建数据库用户的用户名
/** MySQL database password */
define( 'DB_PASSWORD', '123456' ); //修改为第四步自己新建数据库用户的密码
修改后保存退出,并重启服务
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# systemctl restart mariadb.service
六、登陆wordpress打开浏览器输入网址:http://test.cn/wp-admin/index.php 然后初始化配置即可
本文标签:
很赞哦! ()
图文教程
nginx环境下安装wordpress的方法
安装php,支持mysql和fpmphp使用默认配置即可修改nginx配置,/opt/nginx/nginx.conf配置中增加一个虚拟主机重启服务器重启php5-fpm,这一步非常重要
wordpress收费吗,wordpress是免费的吗
wordpress程序本身是不收费的。但是一些wordpress插件是收费插件,当然免费插件也是有的。
wordpress常用判断和调用
wp_options数据表储存网站的一些基本信息调用作者的Gravatar头像:2、可以加上分类目录的别名,例如category-shehui.php 是文章分类目录别名=shehui的模板
wordpress适合做什么类型的网站
wordpress是一个博客程序,也可以做cms,也可以做企业站,关键在于后期如何应用了,具体是什么呢:WordPress是一种使用PHP语言开发的博客平台
相关源码
-
(自适应)蓝色五金制品配件管件pbootcms网站源码下载基于PbootCMS内核开发的五金行业专用模板,采用响应式设计架构,确保产品展示在各类移动设备上的呈现。通过模块化布局与工业风视觉设计,帮助五金企业高效展示产品规格、应用场景及技术支持,建立专业可靠的行业形象。查看源码 -
pbootcms模板(自适应手机版)红色响应式单位机构类网站自适应响应式单位机构网站模板 | PbootCMS内核开发为机构组织设计的响应式网站模板,采用PbootCMS内核开发,支持一键替换行业内容,满足多元化场景需求。查看源码 -
(自适应响应式)html5蓝色智能水表营销型网站pbootcms模板下载PbootCMS内核开发,为智能水表企业打造的营销型网站解决方案,本模板基于PbootCMS内核开发,为智能水表及相关行业企业设计,采用HTML5+CSS3技术构建,具有响应式布局。查看源码 -
(自适应html5)自媒体运营培训教程个人博客pbootcms模板本模板基于PbootCMS系统开发,特别适合自媒体运营培训、知识付费类网站使用。采用响应式设计,能够适配各类终端设备,为内容创作者提供专业的内容展示平台。查看源码 -
(自适应)餐具英文外贸生活用品带下载功能网站模板免费下载为餐具及生活用品外贸企业打造的响应式网站模板,基于PbootCMS内核开发。突出产品展示与多语言支持特性,通过自适应设计确保更好客户在手机、平板、电脑等设备上获得一致浏览体验。查看源码 -
(PC+WAP)生活资讯百科新闻门户类pbootcms网站模板为生活资讯、百科门户类企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5响应式架构,PC与手机端实时数据同步,覆盖全终端用户浏览场景。查看源码
| 分享笔记 (共有 篇笔记) |

