2016年2月16日 星期二

安裝wordpress


STEP 1 : INSTALL APACHE


sudo apt-get install apache2 -y

TEST THE WEB SERVER


如果是架在本機....然後本機上網的話...直接在瀏覽器輸入

http://localhost/

如果是從別的電腦連線過來...就直接輸入server的ip (舉例  192.168.1.10)

http://192.168.1.10


This default web page is just a HTML file on the filesystem. It is located at/var/www/html/index.html.

Note: The directory was /var/www in Raspbian Wheezy but is now /var/www/html in Raspbian Jessie


STEP 2 : INSTALL PHP



sudo apt-get install php5 libapache2-mod-php5 -y

TEST PHP


sudo vi index.php
內容如下:
<?php phpinfo(); ?>

STEP 3 : INSTALL MYSQL


sudo apt-get install mysql-server php5-mysql -y
When installing MySQL you will be asked for a root password. You'll need to remember this to allow your website to access the database.


STEP 4 : DOWNLOAD WORDPRESS


Navigate to /var/www/html/, and download WordPress to this location. You'll need to empty the folder first (be sure to check you're not deleting files you need before running rm); change the ownership of this folder to the pi user too.
cd /var/www/html/
sudo chown pi: .
sudo rm *
wget http://wordpress.org/latest.tar.gz

tar xzf latest.tar.gz
mv wordpress/* .
rm -rf wordpress latest.tar.gz
Running the ls or (tree -L 1) command here will show you the contents of a WordPress project:

STEP 5 : SETUP WORDPRESS


To get your WordPress site set up, you need a database. Run the mysql command in the terminal and provide your login credentials (e.g. username root, password password):

Once you're connected to MySQL, you can create the database your WordPress installation will use:
mysql> create database wordpress;
Note the semi-colon ending the statement. On success you should see the following message:
Query OK, 1 row affected (0.00 sec)
Exit out of the MySQL prompt with Ctrl + D.
mysql -uroot -ppassword

STEP 6 : Configuration WORDPRESS


Navigate to http://YOUR-IP-ADDRESS e.g. http://192.168.1.5 in the web browser on your Pi.

see the following error message

「你的PHP似乎缺少WordPress需要的MySQL擴充元件。」
(Your PHP installation appears to be missing the MySQL extension which is required by WordPress.)

代表應該要安裝套件php5-mysql,可是之前已經安裝了啊,原因不明,不過我重開機後就解決了。

以瀏覽器載入,看到如下畫面,按下「衝吧!」,開始進行設定:

Now fill out the basic site information as follows:
Database Name:  就是你剛剛用mysql 產生的....剛剛是用wordpress...
密碼也是你剛剛設定的
Database Name:      wordpress
User Name:          root
Password:           <YOUR PASSWORD>
Database Host:      localhost
Table Prefix:       wp_
Upon successful database connection, you will be given the contents of your wp-config.php file:


產生錯誤了....他不能寫入到wp-config.php.....只好自己建立那個檔案...然後把內容複製貼上

接下來就是按下  Run the install


設定一些基本資料....例如帳號 (用戶名稱).....密碼等等

Fill out the information: give your site a title, create a username and password, put in your email address and untick the search engines box. Hit the Install WordPress button, then log in using the account you just created.


後台的網址....

http://YOUR-IP-ADDRESS/wp-admin

登入你的帳號....密碼....

大概就會看到這個畫面



所謂的前台畫面就是

http://YOUR-IP-ADDRESS/



Reference : https://www.raspberrypi.org/learning/lamp-web-server-with-wordpress/worksheet/

Reference : http://yehnan.blogspot.tw/2015/12/raspbianwordpress.html

沒有留言:

張貼留言