前言:

WordPress是基于PHP和MYSQL编成的一套博客系统,因此一般会选择LAMP环境来让它最稳定地运行,

这里的LAMP指的是Linux、Apache、MySQL、PHP,我们我的阿里云服务器(二) - 安装LAMP已经介绍过了。

服务器配置(因为处于学习,所以几乎选了最破的配置了):

1、CPU:单核

2、内存:512M

3、系统盘:Linux送20G,Ubuntu 12.04 64位系统

4、数据盘:10G

5、公网带宽:1M

一、下载WorkPress

WorkPress在www.wordpress.org的网站上面可以下载最新的程序,我们需要把它下载下来,

然后放在apache的目录中就可以了。

首先,使用wget命令:

wget -c http://wordpress.org/latest.tar.gz

这个命令,将lastest.tar.gz下载到当前所在目录,

我们可以使用pwd命令查看当前,所在目录。

然后,使用ls命令查看文件。

pwd    #查看所在目录,一般是root
ls /root #查看下载到的文件,可以看到latest.tar.gz

二、解压

因为都是在当前目录,所以直接tar解压即可。

使用命令:

tar -xvzf latest.tar.gz

其中:

x 解压缩
v 显示文件名
z 使用 gzip 压缩解压缩
f 基于文件
 
那么,wordpress就被解压到/root/wordpress中了。
 

三、添加到apache中

将解压好的文件,复制到apache目录中即可。
cp -rf wordpress /var/www
-r 给出的源文件是一目录文件,此时cp将递归复制该目录下所有的子目录和文件。此时目标文件必须为一个目录名。
-f 删除已经存在的目标文件而不提示。

四、添加数据库

我们需要给wordpress建一个数据库,然后配置给wordpress进行使用。

下面代码,创建一个名字为wordpress的数据库。

mysql -u user -p
Enter password: create database wordpress;

五、修改配置

我们需要手动配置wordpress对于mysql数据库的部分,wordpress才可以正常使用。

我们刚才已经把数据库创建好了,下面填入有些部分就可以了。

<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @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', 'usert'); /** MySQL database password */
define('DB_PASSWORD', 'password'); /** MySQL hostname */
define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8'); /** 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', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here'); /**#@-*/ /**
* 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_'; /**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
* language support.
*/
define('WPLANG', ''); /**
* 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.
*/
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');

大功告成,现在访问http://服务器所在Ip或域名/wordpress。

成功显示,那么我们就搞定了。

六、其他

1、代码语法高亮

安装插件SyntaxHighlighter Evolved。然后在写博文时对代码添加标签即可。

Shortcode Parameters

These are the parameters you can pass to the shortcode and what they do. For the booleans (i.e. on/off), pass true/1 or false/0.

lang or language — The language syntax to highlight with. You can alternately just use that as the tag, such as [php]code[/php].

Click here for a list of valid tags (under "aliases").
autolinks — Toggle automatic URL linking.
classname — Add an additional CSS class to the code box.
collapse — Toggle collapsing the code box by default, requiring a click to expand it. Good for large code posts.
firstline — An interger specifying what number the first line should be (for the line numbering).
gutter — Toggle the left-side line numbering.
highlight — A comma-sperated list of line numbers to highlight. You can also specify a range. Example: 2,5-10,12
htmlscript — Toggle highlighting any extra HTML/XML. Good for when you're mixing HTML/XML with another language, such as having PHP inside an HTML web page.

The above preview has it enabled for example. This only works with certain languages.
light — Toggle light mode which disables the gutter and toolbar all at once.
padlinenumbers — Controls line number padding. Valid values are false (no padding), true (automatic padding), or an integer (forced padding).
title (v3 only) — Sets some text to show up before the code. Very useful when combined with the collapse parameter.
toolbar — Toggle the toolbar (buttons in v2, the about question mark in v3)
wraplines (v2 only) — Toggle line wrapping.
Some example shortcodes:

[php]your code here[/php]
[css autolinks="false" classname="myclass" collapse="false" firstline="1" gutter="true" highlight="1-3,6,9" htmlscript="false"

light="false" padlinenumbers="false" smarttabs="true" tabsize="4" toolbar="true" title="example-filename.php"]your code here[/css]
[code lang="js"]your code here[/code]
[sourcecode language="plain"]your code here[/sourcecode]

举例:

[c]c语言代码[/c]

[php]php代码[/php]

有一些没有,例如xaml,可以用xml替换

[xml]类xml代码[/xml]

问题一、上传附件失败

错误提示:Unable to create directory wp-content/uploads/2013/...

解决办法:在wp-content/目录下,建立uploads目录,然后提升uploads目录权限。

mkdir /var/www/wordpresss/wp-content/uploads
chmod 777 -R /var/www/wordpress/wp-content/uploads

解决问题。

问题二、安装主题失败

在安装的过程中,一直出现can not create directory /var/www/wordpress/wp-content/uploads/../themes等错误。

虽然chmod 777 /var/www/wordpress/wp-content,但是没有效果。

解决办法:

mkdir /var/www/wordpress/wp-content/themes
chmod 777 -R /var/www/wordpress/wp-content/themes

也不知道为什么,反正这样自己创建这个目录后,就好了。

这篇博文是本人的研究总结,分享给有需要的人。

[我的阿里云服务器] —— WorkPress的更多相关文章

  1. 阿里云服务器上配置并使用: PHP + Redis + Mysql 从配置到使用

    (原创出处为本博客,http://www.cnblogs.com/linguanh/) 目录: 一,下载 二,解压 三,配置与启动 四,测试 Redis 五,配置 phpRedis 扩展 六,综合测试 ...

  2. 分享阿里云推荐码 IC1L2A,购买服务器可以直接打9折,另附阿里云服务器部署ASP.NET MVC5关键教程

    阿里云推荐码为:IC1L2A 阿里云还是不错滴. 以windows server 2008 R2为例,介绍如何从全新的服务器部署MVC5 站点. 新购买的阿里云服务器是没有IIS的,要安装IIS: 控 ...

  3. 结合阿里云服务器,使用FTP上传和下载文件,出现的问题和解决方案

    一.FTP出现的问题 二.在网上找的方案 如果使用FileZilla默认设置连接ftp服务器的话可能会报以下错误: 错误: 无法建立数据连接:ECONNREFUSED - Connection ref ...

  4. 阿里云服务器上开启linux远程桌面连接

    一.说明: 本文的目的是实现在windows机器上利用远程桌面连接来访问远程的linux桌面. 这里使用的是阿里云服务器,操作系统为Centos6.5. 二.基本步骤: 1.首先保证服务器已经安装完毕 ...

  5. 在阿里云服务器(ECS)上从零开始搭建nginx服务器

    本文介绍了如何在阿里云服务器上从零开始搭建nginx服务器.阿里云服务器(ECS)相信大家都不陌生,感兴趣的同学可以到http://www.aliyun.com/product/ecs去购买,或到体验 ...

  6. javaWeb项目部署到阿里云服务器步骤

    记录web项目部署到阿里云服务器步骤 (使用 web项目.阿里云服务器.Xftp.Xshell),敬请参考和指正 1.将要部署的项目打包成WAR文件格式,可以在MyEclipse.Eclipse都可以 ...

  7. 阿里云服务器Linux CentOS安装配置(零)目录

    阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...

  8. 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署

    阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...

  9. 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定

    阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...

随机推荐

  1. sqlserver暂时禁用触发器进行update

    --1.禁用某个表上的所有触发器 ALTER TABLE tbname DISABLE TRIGGER all go --2.执行update语句 update tbname set .... go ...

  2. Explain 执行计划 和 SQL优化

    Explain 介绍 在分析查询性能时,考虑EXPLAIN关键字同样很管用.EXPLAIN关键字一般放在SELECT查询语句的前面,用于描述MySQL如何执行查询操作.以及MySQL成功返回结果集需要 ...

  3. 解决tomcat使用时catalina.out过大的问题

    在项目上线之前需要做很多事情,其中最容易忘记的就是禁用不必要的日志和调整必要的参数. 调整参数这里主要指的是最大连接数,最小等待时间,虚拟机内存等. 而这里重点要提出的是,你需要禁用tomcat中不必 ...

  4. 使用Codis-Admin命令配置环境

    前提条件:由于22.35.60服务器各自配置了Codis-Service主机,所以22.35.60对应的ip和端口要求能通信和互信访问,为下面通过60的dashboard配置22.35.60实现分组. ...

  5. linux查看系统的硬件信息【转】

    linux查看系统的硬件信息,并不像windows那么直观,这里我罗列了查看系统信息的实用命令,并做了分类,实例解说. cpu lscpu命令,查看的是cpu的统计信息. blue@blue-pc:~ ...

  6. 利用nginx解决跨域问题

    访问我的博客 前言 最近遇到了跨域问题,结合之前[微信支付开发本地接收异步通知回调]的经验,利用 Nginx 实现了跨域. 公司之前为了解决跨域问题,用的是 iFrame,反正对于只做后端的我而言,觉 ...

  7. tomcat 虚拟目录

    在webapps同级目录 下建立一个webapps_abc的目录,将网站根目录abc文件夹放入webapps_abc目录下: 找到conf目录下的,server.xml文件,在service节点下添加 ...

  8. CentOS Java C JNI

    使用JNI调用本地代码,整个开发流程主要包括以下几个步骤: 1.创建一个Java类(IntArray.java): 2.使用javac编译该类(生成IntArray.class): 3.使用javah ...

  9. C# 例子1

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  10. 【IT笔试面试题整理】丑数

    [试题描述]我们把只包含因子2.3和5的数称作丑数.求按从到大的顺序的第1500个丑数.例如6,8是丑数,而14不是,因为它包含因子7.习惯上把1当作第一个丑数. 根据丑数的定义,丑数应该是另一个丑数 ...