使用LAMP建立基於wordpress的個從部落格網站

來源:互聯網
上載者:User

標籤:lamp   wordpress   個人網站   centos   

參考:

http://blog.csdn.net/ck_boss/article/details/27866117

一、mysql配置1、安裝mysql
yum install mysql-server
 CentOS中已經預設安裝,此步驟忽略。
2、啟動mysql
service mysqld start

3、登入mysql
[[email protected] share]# mysql -u -root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.1.73 Source distributionmysql> 

預設情況下,mysql的root使用者無密碼,用以下方式建立密碼

 service mysqld stopmysqld_safe --skip-grant-tables &mysql -uroot -p 不輸入密碼直接斷行符號>use mysql;> update user set password=PASSWORD("newpass")where user="root";更改密碼為 newpassord > flush privileges; 更新許可權> quit 退出service mysqld restartmysql -uroot -p

新密碼進入


二、Apache配置

1、下載apache rpm包並安裝

yum install apache-2.4.9-4.mga5.x86_64.rpm 

或者使用另一方式進行安裝(推薦此方式)

http://www.cnblogs.com/rainisic/archive/2012/05/23/Linux_Apache2_4_Install.html

2、啟動Apache

通過apachectl啟動Apach

apachectl start

檢查是否有Apache進程

ps aux | grep httpd

如果有Apache的進程,則證明啟動成功,瀏覽器地址欄輸入 http://localhost 試試吧~

3、設定apache預設啟動

啟動成功之後,可以將apachectl拷貝到/etc/init.d下,作為service啟動。

sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/httpdsudo service httpd start


三、PHP配置

1、安裝php

yum install phpservice httpd restart

2、建立檢驗檔案

cd  /var/www/html

建立info.php,內容如下:

<?phpphpinfo();?>

使用瀏覽器開啟頁面:

localhost/info.php,可以看到以下頁面


3、安裝php中的Myql組件

[[email protected] html]# yum install php-mysql.x86_64

安裝完成後,上述頁面多了很多mysql相關的內容。

4、安裝phpMyAdmin

[[email protected] html]# yum install phpmyadmin

phpMyAdmin並不能直接的在瀏覽器中開啟,需要建一個捷徑

ln -s /usr/share/phpMyAdmin /var/www/html  

然後就可以開啟phpmyadmin的介面了

http://localhost/phpmyadmin

再使用mysql的使用者名稱密碼進行登入


若此時不能訪問:

Forbidden

You don‘t have permission to access /phpmyadmin on this server.

解決方案:

在 phpMyAdmin 檔案夾中找到  vi /etc/httpd/conf.d/phpMyAdmin.conf

在檔案中能看到如下面一段配置

<Directory "c:/wamp/apps/phpmyadmin3.4.10.1/">    Options Indexes FollowSymLinks MultiViews    AllowOverride all        Order Deny,AllowDeny from all        Allow from 127.0.0.1</Directory>

找到 Deny from all 意思是禁止所有訪問,但允許從 127.0.0.1 訪問

那麼我們就刪除 Allow from 127.0.0.1

並且把 Deny from all 修改為 Allow from all

意思就是允許從所有地址訪問

然後 service httpd restart


四、WordPress配置

1、建立資料庫

mysql> create database wordpress;Query OK, 1 row affected (0.00 sec)mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || test || wordpress |+--------------------+4 rows in set (0.00 sec)

2、下載wordpress壓縮包並解壓,然後編輯以下檔案:

/home/jediael/setupfile/wordpress/wp-config-sample.php

修改以下配置

// ** MySQL 設定 - 具體資訊來自您正在使用的主機 ** ///** WordPress資料庫的名稱 */define('DB_NAME', 'wordpress');/** MySQL資料庫使用者名稱 */define('DB_USER', 'root');/** MySQL資料庫密碼 */define('DB_PASSWORD', 'newpass');/** MySQL主機 */define('DB_HOST', 'localhost');

並移到/var/www/html目錄下:

[[email protected] html]# cp -rf /home/jediael/setupfile/wordpress /var/www/html

使用此地址進行配置:

http://localhost/wordpress/wp-admin/install.php

cp /var/www/html/wordpress/wp-config.php /var/www/html/

進行訪問

使用者名稱、密碼:j/L

郵箱:139


然後點擊建立,再登入或者不登入均可


搞定……


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.