CENTOS VPS 配置 | wordpress環境安裝

一、查看當前硬盤情況

fdisk -l

二、新建分區

fdisk /dev/xvdb

SSH執行以上命令,會提示下方填寫區域(請見有色字)

Command (m for help): n 新建分區 
Command action
 e extended
 p primary partition (1-4) 
p 分區類型 
Partition number (1-4): 1 分區編號
 First cylinder (1-1305, default 1):1
Using default value 1 分區起始位置,默認即可 
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): 1305
結束位置,默認即可 
Command (m for help): t 指定分區格式 
Selected partition 1
Hex code (type L to list codes): 83 設置為Linux分區 
Changed system type of partition 1 to 8e (Linux LVM) 
Command (m for help): w 保存 
The partition table has been altered! 
Calling ioctl() to re-read partition table. Syncing disks.

三、再次執行fdisk命令查看當前分區狀態

fdisk -l
partprobe #若沒有問題則執行此命令寫入內核

四、將分區格式化為ext3

mkfs.ext3 /dev/xvdb1

五、掛載到/home

mount /dev/xvdb1 /home
df -l

六、寫入掛載文件

echo "/dev/xvdb1 /home ext3 defaults 1 3" >> /etc/fstab

SSH執行以上命令,寫入/etc/fstab,開機時自動掛載。
//多IP綁定
編輯文件

/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0:0
onboot=YES
BOOTPROTO=static
IPADDR=1.2.3.4
NETMASK=255.255.255.0
GATEWAY=1.2.3.1
vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
/etc/init.d/networking restart

//配置php環境
1、更新系統內核到最新【可不做】

yum -y update

2、CentOS默認以安裝了apache2.2如果沒有則

yum -y install httpd

apache擴展

yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

3、Web中文亂碼:

/etc/httpd/conf/httpd.conf

AddDefaultCharset UTF-8 改 AddDefaultCharset Off
添加以下文件:

AddCharset us-ascii.ascii .us-ascii
AddCharset ISO-8859-1  .iso8859-1  .latin1
AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
AddCharset ISO-8859-3  .iso8859-3  .latin3
AddCharset ISO-8859-4  .iso8859-4  .latin4
AddCharset ISO-8859-5  .iso8859-5  .cyr .iso-ru
AddCharset ISO-8859-6  .iso8859-6  .arb .arabic
AddCharset ISO-8859-7  .iso8859-7  .grk .greek
AddCharset ISO-8859-8  .iso8859-8  .heb .hebrew
AddCharset ISO-8859-9  .iso8859-9  .latin5 .trk
AddCharset ISO-8859-10  .iso8859-10  .latin6
AddCharset ISO-8859-13  .iso8859-13
AddCharset ISO-8859-14  .iso8859-14  .latin8
AddCharset ISO-8859-15  .iso8859-15  .latin9
AddCharset ISO-8859-16  .iso8859-16  .latin10
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5.Big5   .big5 .b5
AddCharset cn-Big5 .cn-big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251   .win-1251
AddCharset CP866   .cp866
AddCharset KOI8  .koi8
AddCharset KOI8-E  .koi8-e
AddCharset KOI8-r  .koi8-r .koi8-ru
AddCharset KOI8-U  .koi8-u
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-7   .utf7
AddCharset UTF-8   .utf8
AddCharset UTF-16  .utf16
AddCharset UTF-16BE .utf16be
AddCharset UTF-16LE .utf16le
AddCharset UTF-32  .utf32
AddCharset UTF-32BE .utf32be
AddCharset UTF-32LE .utf32le
AddCharset euc-cn  .euc-cn
AddCharset euc-gb  .euc-gb
AddCharset euc-jp  .euc-jp
AddCharset euc-kr  .euc-kr
#Not sure how euc-tw got in - IANA doesn't list it???
AddCharset EUC-TW  .euc-tw
AddCharset gb2312  .gb2312 .gb
AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
AddCharset shift_jis   .shift_jis .sjis

4、虛擬主機,配置文件

vi /etc/hosts

加上www.xxx.com的域名解析
5、配置虛擬站點

vi /etc/httpd/conf.d/vhost.conf
NameVirtualHost x.x.x.x:80
<VirtualHost x.x.x.x:80>
   DocumentRoot /home/wwwroot
   ServerName xxx.com
   ServerAlias  *.xxx.com
   <Directory "/home/wwwroot">
       #  AllowOverride AuthConfig
       #  Options Indexes
       AllowOverride all
       Order Deny,Allow
       Deny from all
       Allow from all
       ErrorDocument    404 /404.php
   </Directory>
   DirectoryIndex index.php
</VirtualHost>

註:多IP情況,NameVirtualHost x.x.x.x:80 不能省略 & 同IP只須定義1次,否則warn…
6、安裝PHP
停止Apache2 的服務

/etc/init.d/httpd stop
yum -y install httpd php
yum -y install php-gd php-xml php-mbstring php-ldap php-pear
/etc/init.d/httpd restart

7、MYSQL安裝

yum -y install mysql mysql-server php-mysql
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

8、啟動服務

/sbin/chkconfig httpd on        [設置apache為自啟動]
/sbin/chkconfig mysqld on       [設置mysqld服務為自啟動]
/sbin/service httpd start       [啟動 httpd 服務]
/sbin/service mysqld start      [啟動mysqld服務]

9、root用戶密碼

mysqladmin -u root password '新密碼'    [設置mysql.root密碼]

讓mysql數據庫更安全
登錄

mysql -u root -p [此時會要求妳輸入剛剛設置的密碼,輸入後回車即可]

mysql -u root -p

mysql -rroot -p密碼
mysql> DROP DATABASE test; [刪除test數據庫]
mysql> DELETE FROM mysql.user WHERE user = “”; [刪除匿名帳戶]
mysql> FLUSH PRIVILEGES; [重載權限]

新建數據庫:

mysql > create database 數據庫名;

新建對應用戶:

my sql > grant all on 數據庫名.* to 用戶名@localhost identified by ‘密碼';

刷新

flush privileges;
quit退出;

安裝wordpress

wget http://cn.wordpress.org/wordpress-3.8.1-zh_CN.tar.gz /home/目錄/

解壓

tar -zxvf wordpress-3.8.1-zh_CN.tar.gz

移動

mv ./wordpress/* /home/目錄/

升級PHP以使用phpmyadmin3.0以上版本
添加源文件 xxx.repo [任意命名,擴展為repo即可]

vi /etc/yum.repos.d/abc.repo

復制

[phpupdate]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

:wq
yum update php

Y.Y
此時可能亂碼.
安裝phpmyadmin

wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.2/phpMyAdmin-3.4.2-all-languages.tar.gz

移到/usr/share

mv phpMyAdmin-3.4.2-all-languages.tar.gz /usr/share

解壓

cd /usr/share
tar xvf phpMyAdmin-3.4.2-all-languages.tar.gz

改名

cd phpMyAdmin-3.4.2-all-languages
mv config.sample.inc.php config.inc.php

編輯config.inc.php

vi config.inc.php

以下內容去掉//

// $cfg['Servers'][$i]['controluser'] = 'pma';?
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';?
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['controluser'] = 'pma'; [把'pma'修改為妳的帳號]
$cfg['Servers'][$i]['controlpass'] = 'pmapass'; [把'pmapass設置為妳的mysql登錄密碼]
$cfg['blowfish_secret'] = ”;  [添加短語密碼例如:$cfg['blowfish_secret'] = 'onohot';] 

[如不設提示:配置文件現在需要1個短語密碼的解決方法]
軟鏈接

sudo ln -s /usr/share/phpMyAdmin-3.4.2-all-languages /home/目錄/phpmyadmin

即可使用目錄下所綁定域名訪問:http://www.xxx.com/phpmyadmin

reboot

配置ssl
安裝mod_ssi

yum install mod_ssl

位置 /etc/httpd/conf.d/ssl.conf 查看以下位置

SSLCertificateFile/etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile/etc/pki/tls/private/localhost.key

進入/etc/pki/tls/private 刪除 rm-f localhost.key
opensslgenrsa 1024 > localhost.key
返回/certs
maketestcert 自動

opensslreq -new -x509 -days 365 -key ../private/localhost.key -outlocalhost.crt 手動
localhost.crt —-ssl.conf指定命名

再次打開/etc/httpd/conf.d/ssl.conf

DocumentRoot “/home/wwwroot”
ServerName xxx.com

重啟apache
至此可用https訪問,IE6少提示警告。
結束
錯誤:缺少 mcrypt 擴展

wget http://www.atomicorp.com/installers/atomic
sh ./atomic
yum  install  php-mcrypt  libmcrypt  libmcrypt-devel
reboot

錯誤:phpMyAdmin 高級功能未全部設置,部分功能不可用

script/create_tables.sql

直接phpmyadmin導入即可sql,重新登入即可。
錯誤:Starting httpd: httpd: apr_sockaddr_info_get() failed for t9235
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

/etc/httpd/conf/httpd.conf
#ServerName www.example.com:80
改為
ServerName localhost:80

錯誤:403

<Directory />
  Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from allow
</Directory>

遞歸更改權限

chmod 777 * -R

快刪目錄

rm -rf [目錄]

極致繁華,不過一掬細砂

生命瞬間 繁華落盡-西藏曼陀羅畫 Medicine Buddha sand mandala



2001年2月26日,Ven. Tenzin Thutop 和Ven. Tenzin Deshek 二個來自尼泊爾和西藏的喇嘛,在紐約Ackiand和Yager畫廊將“修建”一個“藥師佛壇城”,展現亞洲藝術。

一般很少能見到這種場面,
就算你是身處西藏,也是很少見的 26 Feb

材料是一種用於藏醫藥的細沙
而且用這種材料製造出來的作品
可以保持幾百年不褪色 28,Feb

佛是萬物的起源,是世界的中心 28,Feb

在整個的繪製過程中
旁人只覺得是一種創作 1,Feb

但對於佛家來說,這是一種修行 2,,May

細沙如何彙聚成世界

圍繞在佛周圍的芸芸眾生
每一種生命都躍然沙上 5,May

不外傳的特製作畫工作 5,May

繁華初現 佛澤四方 6,May

越來越多人關注他們的創作 8,May

你是否看到了繁華背後的脆弱? 9,May

逐步顯現的最後的聖堂 12,May

延續的人生,膨脹的世界 14,May

瑰麗的畫卷,以一種強迫的姿態
佔據每一個人的視界和心靈
及至靈魂 20,May

精緻得難一置信的細節 20,May

自始至終一絲不荀的創作者 21,May

完美的畫面,繁華的世界
多看一會兒吧,記住它 8,Jun

最後完成的作品,英文叫做:mandala

意思是:時間記錄了一切

我們只能是做過這件事情,留下一點痕跡

但這些只是一瞬間的精彩 8,Jun

生命亦是如此 8,Jun

七八十年晃眼而過 8,Jun

回頭看看只有那麼一點痕跡 8,Jun

人死前的就瞬間一定很複雜 8,Jun

那麼,然後呢? 8,Jun

看看四周人們的眼神 8,Jun

極致繁華,不過一掬細沙 8,Jun

藝術品的生命完結了
但這件作品真正的生命才剛剛開始。8,Jun

人們從來沒有慶祝過生
但,對於死,卻總是有隆重的儀式 8,Jun

除去抹不淨的回憶
仿佛什麼也沒有發生過 8,Jun

最後的一段旅程
在當地居民的護送下盛裝出行 8,Jun

一切都隨風飄入溪水
沉澱,褪色
永不再返