进入CentOS7系统
一 安装 Apache HTTP
yum install httpd
2)启动服务,开启mod_rewrite模块
//进行httpd.conf
vi /etc/httpd/conf/httpd.conf
//定位到AllowOverride None把None修改为All
AllowOverride None
//启动服务
systemctl start httpd.service
二 安装 MySql
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm yum install mysql mysql-server mysql-libs mysql-server
2)设置sql服务开机自动启动
systemctl enable mysql.service
3)启动sql服务
systemctl restart mysql.service
4)进入mysql,首次进入默认密码无,直接回车即可
mysql -u root -p
5)修改密码
//查看所有数据库 show databases; //使用mysql数据库 use mysql; //修改密码 update user set password=password('新密码') where user='root'; //刷新用户权限 flush privileges;
6)创建一个wordpress数据库
create database wordpress;
三 安装 PHP
以及相关 PHP
组件
yum -y install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl
2)安装调试phpmyadmin
//安装所在的软件源 yum -y install epel-release //安装phpmyadmin yum -y install phpmyadmin //启动phpmyadmin服务 systemctl restart httpd.service
四 下载安装 WordPress
//在临时目录下创建一个文件存放 mkdir /tmp/wp //进入创建的文件目录 cd /tmp/wp //下载wordpress wget http://wordpress.org/latest.zip
2)解压文件
unzip -q latest.zip -d /var/www/html/
3)更改wordpree权限
chown -R apache:apache /var/www/html/wordpress chmod -R 777 /var/www/html/wordpress
4)创建一个可以上传的目录upload,并将属主改为apache
mkdir -p /var/www/html/wordpress/wp-content/uploads chown -R :apache /var/www/html/wordpress/wp-content/uploads
5)修改配置文件,以便可以访问数据库,wp-config.php中用户名和密码需要更改
cd /var/www/html/wordpress/ mkdir wp-config.php vim wp-config.php //插入类容如下 <?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use the web site, you can * copy this file to "wp-config.php" and fill in the values. * * This file contains the following configurations: * * * MySQL settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://codex.wordpress.org/Editing_wp-config.php * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', '用户名'); /** MySQL database password */ define('DB_PASSWORD', '密码'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8mb4'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define('AUTH_KEY', 'Qch&gb#c@7Uy3C8QuVa0+T9rOcy>CeLft/dZh>]_<78b)fXY/k-1{ctA$A81jCrS'); define('SECURE_AUTH_KEY', 'Bmq3kgkmWe/eR([N#k)rkX8YB+dG5NlCy{Dkzk:F=LFN$PcVfGcKAsGRjcM^YUF4'); define('LOGGED_IN_KEY', 'h1-2#zc]oy]{GVsrvR4[}X>}/=EyW|N*~.;:O:.07P@U#SdIp`(cOP^oT={[dgy@'); define('NONCE_KEY', 'xWVnU!.|`9_)Vx/yB(fb$fJH+fV:7OoGV#0QwE3x|+,G=u8P)Pmv=w}}3El| 7pN'); define('AUTH_SALT', '0ZV@k69Ghs{Zt@*`F(IzEVhsRdm9[wPf2.sy0aX{4f~%_o 2!:@9f=u>C*t/^o^i'); define('SECURE_AUTH_SALT', 'T)][P8^m!~o|:}fQ)zjX%oLMJp+7& 4h4botpk.xhwc&0l ?g t$.5O[RRP(N@.]'); define('LOGGED_IN_SALT', '5t%TV+jFB3YUU3`yZ711`F BM-k{.s8Fkz>mFOixRB?UiRx.A/rtv1NfsLr`.3F@'); define('NONCE_SALT', ')@Z:O/M=>WpL4iUR]w$aTS-)LY`4~<~fTsa1MnK^=3 c:xK1WUB<0LygnfRG9)$1'); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the Codex. * * @link https://codex.wordpress.org/Debugging_in_WordPress */ define('WP_DEBUG', false); /* That's all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
6)浏览器输入http://http://服务器地址/wordpress 后就可以进行最后的登陆安装
7)创建.htaccess文件和编辑.htaccess文件
//创建 touch /var/www/html/wordpress/.htaccess //编辑 vim /var/www/html/wordpress/.htaccess //编辑内容如下,如果存在就不需要添加 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L]</IfModule> //修改权限 chmod 664 /data/www/default/wordpress/.htaccess