User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Guide to installing WordPress

Fri Dec 06, 2013 8:12 pm

Edited 1/11/14
Recommended hardware for server setup:
Raspberry Pi Model B; either 256MB or 512MB
1A Power supply
Minimum of 4GB class 4+ SD card (RSE); recommended 8GB class 4 or better for full Raspbian install (my current install=3.7GB)

Note on Raspberry Pi:
I have seen no difference in performance between the 256MB rev. 1.0 and the 512MB rev. 2.0 boards for a web server. If you plan to install other things besides the web server on your RasPi then I would use the 512MB board. You could also install a web server on a Model A. You will have to use either a USB Ethernet or a USB Wi-Fi dongle to have Internet access. Again; 256MB is more than adequate for a web server.

SD card Note:
A lot of emphasis has been placed by some on the class of card you use for the Raspberry Pi. For a server you really do not need a real fast (Class) of SD card. Most SD cards “Read” at about the same speed. The “Class” rating really only indicates the “Write” speed. So a lower class card might take a bit longer to save information too, but it will likely read just about as fast. “Burning” a card will take longer if it is a lower class. Buying a better known, name brand card is always a good idea for your server.

The size of your card is going to depend upon what you decide to store on it. For the average WordPress server I would say use an 8GB card is best. If you intend to store a lot of pictures then you may need a bigger card. If you decide to use it as a FTP site then you may want to expand your storage size with a USB stick or even a USB HDD or a USB SSD.

Some more reading about hardware:
http://rich1.dyndns.tv/?page_id=434

Recommended OS:
Raspbian full version or Raspbian server Edition (RSE).
Arch Linux will also work.
If you wish to use a Remote Desktop (RDP) connection then use a full Raspbian install.

Initial setup:
Raspbian install
At the raspi-config console
set internationalization
set time zone
set keyboard
set overclocking (900(Medium))(read note below about OC)
set memory split (16)
change password
change hostname
enable SSH
expand files system

Overclocking Note:
Overclocking on the Raspberry Pi enhances its performance somewhat. Overclocking can cause damage to the Silicon over time. If you force the turbo option, your RasPi will maintain the cpu-freq you have set all the time. I do not recommend you use the turbo setting on a web server!

If you use the settings in raspi-config, to set your RasPi speed, the overclock is dynamic. This means it will only raise the frequencies that were set when the board is put under a load. Considering that most web sites are going to spend most of their time at idle, there is not too much worry that your RasPi is going to die anytime soon. Overall you do not need to overclock your RasPi for decent web browser performance.

At this point I recommend that you try to SSH into your server. I use PuTTY from my Win7 desktop. Check your IP after login you will need this to connect. You can complete the following steps using SSH. You can also finish them while it is still connected to a keyboard and monitor! Your choice. You will probably use SSH for everything after you have your web site setup and running.

setup a server:

Code: Select all

sudo apt-get update

Code: Select all

sudo apt-get upgrade
Install Apache2:

Code: Select all

sudo apt-get install apache2
When you boot your RasPi it will show you the I.P. address it was assigned. using a browser you will enter that I.P.. A plain page that says “It works!” should appear.
You now have a basic Apache2 server. This web page is located in /var/www/index.html
That is where you would put your content for a static html web site.

Here I recommend that you make a backup of the SD card. Most of my failures have been with MySQL. So if you need to start over because the “failure to establish Database”, then you only need to go back to here.

PHP install without MySQL:

Code: Select all

sudo apt-get install php5-fpm
sudo service php5-fpm restart
NOTE:
I also installed php-cgi originally. This caused the white screen of death known in WordPress. If you wish to install cgi you will have to edit some Apache2 config files to fix the WSD.
If you are going to install MySQL then skip to MySQL install

Install MySQL with PHP5:

Code: Select all

sudo apt-get install mysql-server-5.5 php5 php5-mysql php5-gd
(note: removed php5-cgi)
enter your MySQL root password, write it down.

At this point you have a LAMP (Linux, Apache, MySQL, PHP) server! Now you have to decide if you wish to run a static site that you will need an editor to run, or install something like WordPress. I chose WordPress as it is easy to use and I find that I am more willing to keep it up to date than a Static site.

Backup again at this point

You now have some options as to what can be installed.
Mediawiki. The same as Wikipedia.
http://trevorappleton.blogspot.com/2013 ... ry-pi.html
Octopress:
https://mug.im/blog/2013/01/20/how-to-d ... spberrypi/
There are some other options as well!

Or, install WordPress:

Install WordPress:

Code: Select all

wget http://wordpress.org/latest.tar.gz
Extract WordPress:

Code: Select all

tar -xvzf latest.tar.gz
Create working directory:

Code: Select all

sudo mkdir /var/www/wordpress
Set permissions:
Change Directory ownership

Code: Select all

sudo chown -R www-data.www-data /var/www/wordpress
Copy the extracted files:

Code: Select all

sudo cp -r ~/wordpress/* /var/www/wordpress
Configure Apache2:

Code: Select all

sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.config.bak
sudo nano /etc/apache2/apache2.conf
Add this line to the end of the file:

Code: Select all

AddType application/x-httpd-php .html
To save ctrl-X then y then enter.

Restart Apache:

Code: Select all

sudo /etc/init.d/apache2 restart
Create wp-config.php file:

Code: Select all

sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Code: Select all

sudo nano /var/www/wordpress/wp-config.php
Change these lines.
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress‘);

/** MySQL database username */
define(‘DB_USER’, ‘user name‘);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘password‘);

Configure MySQL:

Code: Select all

mysql -u root -p
enter mysql password you create when MySQL was installed!

Code: Select all

CREATE DATABASE dbname;
example: CREATE DATABASE wordpress;

Code: Select all

CREATE USER user name here;
example: CREATE USER joeblow;

Code: Select all

SET PASSWORD FOR wordpressuser= PASSWORD('created password');
example: SET PASSWORD FOR joeblow= PASSWORD('11111111');

Code: Select all

GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
example: GRANT ALL PRIVILEGES ON wordpress.* TO 'joeblow'@'localhost' IDENTIFIED BY '11111111';

Code: Select all

FLUSH TABLES;

Code: Select all

exit

Code: Select all

sudo reboot
Now try your site by entering the IP
example; 192.168.1.xxx/wordpress (The IP your Raspberry Pi shows at logon)

You should see the WordPress install page.

Site Title
Username (wordpressuser)
Password (user password)
Your E-mail
Check box to let your site be added to the search engines.

Press button to Install WordPress
Then you will log-in with your user and password.

Your WordPress site is now ready to be setup. You will want to choose a theme and start adding post or pages to your site!

Below code is needed if you cannot enter the WordPress FTP when trying to install plugins or themes.

Code: Select all

cd /var/www

Code: Select all

sudo su

Code: Select all

chown www-data *

Code: Select all

chown www-data */*

Code: Select all

chown www-data */*/*

Code: Select all

exit
Now we are going to install a couple of things to make your WordPress site run faster! you will notice that it takes quite a while to update or publish in your site.

Back to your keyboard or SSH!

Code: Select all

sudo apt-get install php-apc
Now we will install XRDP so you can use the remote desktop. This only works if you used a full install of Raspbian.

Code: Select all

sudo apt-get install xrdp
Note you do not create .htaccess when using Lighttpd. It has its own lighttpd.config file.

We will now create .htaccess, (Apache2) this is needed to use the WP Fast Cache plugin for WordPress.
This needs to be in /var/www

Code: Select all

cd /var/www
sudo nano .htaccess
Now copy the lines below. right click, copy then right click in nano to add them

Code: Select all

#start_wp_fast_cache - do not remove this comment
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_METHOD} ^(GET)
 RewriteCond /var/www/wordpress/wp-content/wp_fast_cache/%{HTTP_HOST}%{REQUEST_URI}x__query__x%{QUERY_STRING}index.html -f
 RewriteCond %{HTTP_USER_AGENT} !(iPhone|Windows\sCE|BlackBerry|NetFront|Opera\sMini|Palm\sOS|Blazer|Elaine|^WAP.*$|Plucker|AvantGo|Nokia)
 RewriteCond %{HTTP_COOKIE} !(wordpress_logged_in) [NC]
 RewriteRule ^(.*)$ /var/www/wordpress/wp-content/wp_fast_cache/%{HTTP_HOST}%{REQUEST_URI}x__query__x%{QUERY_STRING}index.html [L]

 RewriteCond %{REQUEST_METHOD} ^(GET)
 RewriteCond %{QUERY_STRING} ^$
 RewriteCond /var/www/wordpress/wp-content/wp_fast_cache/%{HTTP_HOST}%{REQUEST_URI}index.html -f
 RewriteCond %{HTTP_USER_AGENT} !(iPhone|Windows\sCE|BlackBerry|NetFront|Opera\sMini|Palm\sOS|Blazer|Elaine|^WAP.*$|Plucker|AvantGo|Nokia)
 RewriteCond %{HTTP_COOKIE} !(wordpress_logged_in) [NC]
 RewriteRule ^(.*)$ /var/www/wordpress/wp-content/wp_fast_cache/%{HTTP_HOST}%{REQUEST_URI}index.html [L]

</IfModule>
#end_wp_fast_cache
Then ctrl-X then Y then enter.

Code: Select all

sudo reboot
Now enter your site and login and go to plugins>installed plugins.
Delete the plugins that are in there now. Then install the WP-Fast Cache Plugin.

For a little better security I also install Fail2ban. By SSH.

Code: Select all

sudo apt-get install fail2ban
This will stop recursive failed login attempts to your server.

I also install the “Ban Hammer” Plugin to stop the user database from being flooded by bots. And I install the Revisions Control Plugin to limit the number of “Revisions” that are stored by WordPress.

Lately I installed WP-Optimization, still evaluating whether it helps or not.

Uninstall Askimet and the Hello Dolly plugins.

useful commands;

Code: Select all

sudo /etc/init.d/mysql stop|restart
sudo /etc/init.d/apache2 restart|stop
Some things I have tried to gain performance with WordPress:
Server Split:
Using two RasPii; one with MySQL and the other with everything else. There were measureable gains. .2 seconds better page serves and publishing pages was .3 seconds faster. Considering the higher power usage of about 1/3 not really worth the effort of 6 hours rebuilding the whole site. If I really needed every last bit of performance I might set this up again, but those gains are really quite small. php-apc was not installed at this time so it might have seen better gains.

Both of these RasPii were Rev. 1.0 boards that were back-powered from a 4 port USB hub (both of these boards have pin headers in place of the USB connectors). This is why I only saw 1/3 more power usage. If you had to use two PSU’s then it would have been double the wattage.

Note on web server cluster:
My use was a distributed server solution, it was not a cluster.
I suspect that some of the cluster (Bramble ;) ) web servers are seeing more performance than can really be realized. I believe the cluster load balancer is carrying the load rather than the cluster itself!

Site moved to USB stick:
I had noticed that OpenElec XBMC ran better from a USB stick rather than from the SD card. I tried moving the site to a USB stick. This took very little time. No measureable difference in performance. Might be a benefit if you need more space as large USB sticks are cheaper than SD cards. php-apc was installed

256MB vs. 512MB:
No measurable difference in page serve speeds. Might be a benefit if you run other things on the server than just WordPress. If you have an older 256MB B Model then use it. has been tried with and without php-apc.

Remove unnecessary components:
I have removed the web browsers, scratch and squeak from the server. wpagui (wifi config on desktop) can also be removed. I left Python on. I am sure there are other things that can be removed to free up disk space (storage). I worry more about those items that take up memory space. Still looking into stuff that affects system memory usage.

Using a USB stick as swap:
I use an old 512MB USB stick as a swap file in my WordPress server. The whole stick was partitioned as a swap file for Linux using GParted. The device is in fstab (/etc/fstab) as sda1.

Code: Select all

cd /etc
sudo nano fstab
edit to this under other entries.

Code: Select all

/dev/sda1 /swap vfat defaults 0 0
Change swap settings:

Code: Select all

sudo nano /etc/sysctl.conf
The swappiness setting was changed from =1 to =40. placed at the end of the file.

Code: Select all

vm.swappiness=40
vm.min_free_kbytes = 16384
In my opinion this protects the SD card from swapping. Reduces the number of reads and writes on the card. It is actually used very little. I have only seen about 14MB of swap being used.
total used free shared buffers cached
Mem: 232 208 23 0 9 65
-/+ buffers/cache: 132 99
Swap: 511 14 497
Last edited by Lob0426 on Sun Jan 12, 2014 6:26 am, edited 10 times in total.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Guide to installing WordPress

Fri Dec 06, 2013 9:33 pm

Richard, thanks VERY much for this tutorial. I want to try it, but I have a few questions before I begin.
I already have my website up and running using Lighttpd with about 30 static html pages on the site.
http://unclegeorge.no-ip.org
Will your install procedure work with this? I have Mysql installed, but don't know anything about using it.
And I have php installed, but I don't remember what "subsets" of php I installed along with it.
Finally, my Raspbian is on the SD card, but all my website files are on a 64 gig flash drive under /mnt.

I'm not even sure what questions to ask, but how do I go about adding Wordpress to my present install.
Thanks, Richard.
And sorry for being a pain, but I'm a real noob/dummy when it comes to this stuff. It took me forever
to get this far.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Fri Dec 06, 2013 10:42 pm

Offcenter wrote:Richard, thanks VERY much for this tutorial. I want to try it, but I have a few questions before I begin.
I already have my website up and running using Lighttpd with about 30 static html pages on the site.
http://unclegeorge.no-ip.org
Will your install procedure work with this? I have Mysql installed, but don't know anything about using it.
And I have php installed, but I don't remember what "subsets" of php I installed along with it.
Finally, my Raspbian is on the SD card, but all my website files are on a 64 gig flash drive under /mnt.

I'm not even sure what questions to ask, but how do I go about adding Wordpress to my present install.
Thanks, Richard.
And sorry for being a pain, but I'm a real noob/dummy when it comes to this stuff. It took me forever
to get this far.
Yes it will work! Reinstall PHP just to be sure, make sure you have your MySQL password. If you are unsure then uninstall PHP and MySQL and start there.

.htaccess may be a problem with Lighttpd. So WP Fast Cache will have problems.

I am not sure if MySQL will automatically carry over to your flash drive or not. I have never tried it. Hopefully someone will chime in on this.

You should be able to copy your pages into WordPress page by page. I used copy and paste to do exactly this from old my static site. You will have to fix some things, like bold fonts or code windows, but you should not have to type it all in by hand. You will have to transfer pictures into WordPress by adding media, or in other words picture by picture. By the way your pictures may run just fine from right where they are, but I would move then into WordPress then delete them from their current place.

There will be a learning curve but in the end you will find WordPress is easier than static pages to edit.

Above all make a backup before you change anything in your current site. You may want to go back or you may lose data during the change over.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Guide to installing WordPress

Sat Dec 07, 2013 5:21 am

Thanks for the quick reply, Richard.
More questions though.....
I don't know what .htaccess is or what it does, but from the reading I've done, I gather that Lighttpd won't work with it.
And I'm guessing that Fast Cache is just to speed up the creation of pages in WP.
So...
Q: Do I really need either of them?
Will lack of them slow things down for people accessing the site, or just for me when I make new pages?

I don't mind if it works a bit slower for me. I can live with that.
Thanks Richard.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Sat Dec 07, 2013 5:46 am

WP Fast Cache needs .htaccess to work.
WP Fast Cache basically converts the pages to static pages. This speeds up WordPress.

It will slow down the site for everybody somewhat. One of the other caches may not need .htaccess to work.

Keep from overfilling the site full of plugins and widgets and it should run decently.

Richard
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Guide to installing WordPress

Sat Dec 07, 2013 1:40 pm

Thanks, Richard. I'll give it a try without them and see how it goes.
Hope you don't mind my peppering you with questions.
With my limited knowledge of this stuff, this is not likely to go smoothly. :lol: :lol: :lol:
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Sat Dec 07, 2013 7:46 pm

Except for he fact that you are using Lighttpd, it should go pretty smooth.

None of those instructions were tested with it!

I rebuilt those WordPress servers from scratch about 8 times. I took notes each time. That is where this guide came from. So I recommend you take notes at each problem that crops up. Then try to find the solution. Most of mine I found out on the Internet. It is a piece by piece learning experience.

Questions here are ok.

Trying to find the answer will help you more than just asking. Most people just do not know how to ask a search engine the correct question.

I may just try to build from Lighttpd just to get the experience!

Edit: I did find this about making Lighttpd work for wordpress here in the forums.
http://kuttler.eu/post/wpmu-lighttpd-rewrite-rules/
another good link; He goes really deep into it. you probably only need the link above!
http://c-mobberley.com/wordpress/index. ... -and-more/
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Guide to installing WordPress

Sat Dec 07, 2013 9:33 pm

Richard, the second page you linked to, I actually understood...I think. Mostly because he explains each step and why it is being done.
I read the first link several times but understood nothing of it. I have no idea what "rewrite rules" are or what those lines are supposed to do. What am I "rewriting"?

It also mentions "domain" several times. I have no domain that I know of. My domain name is at NOIP.com. Then they forward the request to my IP address.
(Or....am I supposed to type that in just as it is shown, including the word "domain" where shown?)
Thanks Richard.
(see the last line of my signature :lol: )
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Sun Dec 08, 2013 12:49 am

Ok, Domain will be the URL that you use at NOIP. No you do not include domain as part of the name.

I use DynDNS so;
rich1.dyndns.tv
Inside WordPress it needed;
rich1.dyndns.tv/wordpress

Rewrite rules: Here is an explanation. From what I saw I need to read it too. :oops:
http://www.addedbytes.com/articles/for- ... beginners/
That explains it for Apache2 the first link shows how to do it in lighttpd! The reason is the same just not how it is done!

This is all assuming you are using SSH to configure!. If not you will have to type it all in exactly as it is shown, spaces and all.
So you have to find where lighttpd.conf is stored. It is most likely at /etc/lighttpd
Then you would change directory to there

Code: Select all

cd /etc/lighttpd
Your prompt will change to show you are there.
Then use the dir command to list the contents.

Code: Select all

dir
If it is there then you want to edit it.

Code: Select all

sudo nano lighttpd.conf
Copy and paste is a bit retarded in nano. So highlight the text in the first link then right click and click copy. Then in nano just right click. The text should appear there. Then to save you hit CTRL-X then Y then ENTER. That saves the file.

wpmu-rewrite.conf is supposed to be in the same directory. Follow the same as editing lighttpd.conf except copy the second code window to it.

WordPress needs these rules to create an address to the pages you create. The pages are created using "permalinks"
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Mon Dec 09, 2013 9:17 pm

I have successfully used Lighttpd to install WordPress.

I am now working on a supplement that will detail the differences.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Offcenter
Posts: 182
Joined: Wed Jul 31, 2013 4:57 pm
Location: Northwestern New Jersey USA

Re: Guide to installing WordPress

Mon Dec 09, 2013 10:20 pm

Thank you SO much, Rich.
I haven't had a chance to get back to this yet. So now I'll wait
for your followup.
George in New Jersey.
(learning a little bit every day.)
(and darned confused most of the time!)

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Mon Dec 09, 2013 10:37 pm

Offcenter wrote:Thank you SO much, Rich.
I haven't had a chance to get back to this yet. So now I'll wait
for your followup.
The Lighttpd guide is now up on my site now. Follow it instead of the Apache build. You install Lighttpd and MySQL Then jump back at Installing WordPress. After that it is all the same.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Mon Dec 09, 2013 10:52 pm

Note:
This worked perfect the first time.
The second time I ran it, it was a mess.
I am working on a simplified version right now.

Richard

Setup Lighttpd:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
Install Lighttpd:

Code: Select all

sudo apt-get install lighttpd php5-cgi
Install MySQL:

Code: Select all

sudo apt-get install php5-gd mysql-server mysql-client php5-mysql
Enter your MySQL password

Configure Lighttpd:

Code: Select all

sudo lighttpd-enable-mod
You will see a prompt asking for the mod!

Code: Select all

fastcgi-php
hit the enter key.

Now you will enter enable mod again!

Code: Select all

sudo lighttpd-enable-mod
You will see the prompt again!

Code: Select all

simple-vhost
hit the enter key.

Restart Lighttpd:

Code: Select all

sudo service lighttpd restart
Now we see if it is working!

Code: Select all

sudo nano /var/www/index.php
Add this to the file.

Code: Select all

Lighttpd working
Now CTRL-X then Y then Enter.

Restart Lighttpd:

Code: Select all

sudo service lighttpd restart
Now open a browser and enter the RasPi's I.P. Address. You should see "Lighttpd working".

Now we need to enable mod-rewrite:

Code: Select all

sudo nano /etc/lighttpd/lighttpd.conf
So we need to find "mod_rewrite"
There is a # in front of the line. Remove the # and insert a space so it lines up with the lines above.

CTRL-X then Y then Enter

Restart Lighttpd:

Code: Select all

sudo service lighttpd restart
Configure vhost.

Code: Select all

sudo nano /etc/lighttpd/conf-enabled/10-simple-vhost.conf
Change the host domain name to wordpress.

Remove the test index.php

Code: Select all

sudo rm /var/www/index.*
Back to the main tutorial and start at "Install WordPress:"
http://rich1.dyndns.tv/?page_id=512

This will be your address to setup WordPress! when configuration is complete.

Code: Select all

http://RasPi I.P./www.your domain.com/public_html/
I followed this guide, but modified it, mostly by adding sudo commands where needed.
http://theorgllc.com/2012/02/11/setup-w ... 6-squeeze/
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Tue Dec 10, 2013 4:00 am

I think I have it (Lighttpd) all straightened out now! :oops:

It is on my web site at.
http://rich1.dyndns.tv/?page_id=567

I had some segmentation faults that seem to have been cured by adding in some reboots.

I simplified a couple of steps and kept the directory at /var/www/wordpress rather than /var/www/www.example.com/wordpress/public_html.

Richard
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

chuckski
Posts: 1
Joined: Tue Dec 10, 2013 12:24 pm

Re: Guide to installing WordPress

Tue Dec 10, 2013 12:30 pm

Great posting!

I'm wondering if the wp-fast-cache code listed above is correct or maybe it got truncated to 80 columns.

The .htaccess file seems like the longer lines all end it a $. Is that correct? Is it really needed if you install the plug-in from the control panel?

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Tue Dec 10, 2013 6:05 pm

If you do not create .htaccess you will get an error that says the plugin could not edit .htaccess for you. That is where the code came from is that error message.

I will check the code for .htaccess. It looks fine, but I will compare it to the original.

Richard

EDIT: .htaccess was truncated! It has been corrected in the original post. Now I have to correct it in my web site!

EDIT:

Code: Select all

free -m

Code: Select all

          total       used       free     shared    buffers     cached
Mem:       232        120        111          0          9         57
-/+ buffers/cache:    53        178
Swap:      99          0         99
So Lighttpd uses about 88MB less than my Apache2 based WordPress server. Remember that I have more installed on my server than just a bare install of WordPress! WP Fast Cache is not installed either but the page serve speed is still decent.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

gregor3000
Posts: 114
Joined: Tue Nov 20, 2012 12:57 pm

Re: Guide to installing WordPress

Wed Dec 11, 2013 9:22 am

actually if you own the server .htaccess is not really necessary since oyu can configure the server using main server configuration file.

furthermore i wonder how the Pi handles compression etc. the stuff that actually speeds up the page load. if you check google site performance tests you will notice that using only defaults will make your pages load slow. maybe not for you but for someone on the other side of the world... so files need to be compressed on access etc. by using these tricks and advice on those tests i've managed to get site load down to 3 or 4 seconds. by default it was over 40. i imagine this takes CPU power and as i understand more users will also put a strain on server.
why is page load time important? well if you have slow page load google wont' put you on top in searches etc.

however the Pi CPU power should be enough for smaller number of users accessing the site at the same time.

desktop is unnecessary on server and waste of system resoruces.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Wed Dec 11, 2013 6:41 pm

.htaccess was called for by WP Fast Cache. Not a necessity but the cache does help the page serve speed. So does installing php-apc. WP Super Cache I believe supports compression, but I have had trouble getting it to work with the RasPi.

My site does show up in google. That is more because of the use of tags.

A Raspberry Pi based site is more for the convenience of the person than an all out solution. Paying for a hosted site is about $10 a month. Their speed, without plugins or caches, is faster than the RasPi. The lower cost, about $5.25, a year in electricity is an advantage. For what I used to pay for a hosted site I can buy a RasPi, power supply and an SD card plus power the site for a year, and have some spare change for burger! :lol:

There is also the experience gained by setting up your own web server. Another advantage is that it is much easier to recover from a failure with your site in your own home. A hosted site can take days to be fixed as you need the "host" to perform a reset. With it in house I can replace the RasPi and re-burn a card and have the site back up in about half n hour, tops! ;)

These instructions work with a Panda Board ES also. In fact they should work with any distro of Linux. As long as all of the packages are available.

The Panda Board is about three times faster in WordPress than the RasPi. But it costs about 4.5 times as much for the board. I could set up an Atom board for about the same cost!

Overall a RasPi is not going to be powerful enough to power an e-commerce site. And if the site sees a lot of hits you may have to upgrade your hardware. You will have the experience from the RasPi to build a more powerful site with that upgraded hardware.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

gregor3000
Posts: 114
Joined: Tue Nov 20, 2012 12:57 pm

Re: Guide to installing WordPress

Thu Dec 12, 2013 7:39 am

apache itself has various modules that will handle compression and cache. such as mod deflate.
http://httpd.apache.org/docs/2.2/mod/mod_deflate.html

it's a good thing to use for exampel google analyse tool to get some informaiton on how to imporve the page speed load: https://developers.google.com/speed/pagespeed/

like i said i do not know what these apache mods do to CPU power in Rpi.

i ran your page through the tool and this is the advice given:
Should Fix
[*]Eliminate render-blocking JavaScript and CSS in above-the-fold content
Your page has 3 blocking script resources and 5 blocking CSS resources. This causes a delay in rendering your page.
[*] Reduce server response time [you are probably at the limit with this one]
[*] Leverage browser caching
Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
[*] Optimize images
Properly formatting and compressing images can save many bytes of data.
[*] Minify CSS
Compacting CSS code can save many bytes of data and speed up download and parse times.

these are simply achieved in .htaccess file (if you are using it) or server's config file.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Thu Dec 12, 2013 9:29 pm

I have ran the same tool on my web site before. I am looking into how to solve these issues. In between I decided to make this guide!

There is no overall server config file, at least that I know of. Another bottleneck is that my outgoing connection is 100Kb. I will have to look into Apache2 modules. I now know that Lighttpd has the ability to enable/disable modules. I never ran across this for Apache. I have used the Apache2 config file where I think you enable modules for it.

This all has been a learning experience. I continue to try to improve my hardware and software for the web site. You will see that the site does not go very long between changes to one or the other.

There were a number of guides and tutorials about using WordPress. Each had issues about their install. I have tried to bring them all together, plus my own cures and fixes, to build one that ends successfully every time. My goal is to let people successfully build a working web site, that is simple to update. There are other blogs that can be used as well as wiki.

So far Lighttpd shows a lower memory usage. I will be bringing that build up to date with my current server and see if it still has less memory usage. I will also try to tackle things like getting WP Fast Cache running.

I also was playing with SQLite and NGINX, but could not establish the database using the PDO plugin.

As to compression; mod_deflate may actually hurt the servers performance on the web site. It may place too high of demand on the processor. I will have to look into it. I will try testing it on my backup server. I will maybe try it on one of the 512MB boards and see if the extra memory would help at all for compression.

Note: I want to thank chuckski for pointing out the truncated text in the .htaccess file!

I notice Page Speed says my page speed was 1.2 seconds. A lot faster than it was just a couple of months ago. I just looked at curing the problems. tried a few solutions and it made no difference, so far.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

PorterDon
Posts: 69
Joined: Wed Aug 21, 2013 2:09 pm
Location: Thailand

Re: Guide to installing WordPress

Tue Jan 07, 2014 4:23 pm

SO GLAD I found this tutorial! I've been trying for more than a week to install wordpress but I keep getting let down by poorly written tutorials. I am confident I can get somewhere now!

One small problem as I work myself through the steps above. I got the following error:

"sudo cp -r ~ /wordpress/* /var/www/wordpress/
cp cannot stat: '/root/wordpress/*' No such file or directory"

Please advise as soon as possible. Thanks in advance.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Wed Jan 08, 2014 3:06 am

PorterDon wrote:SO GLAD I found this tutorial! I've been trying for more than a week to install wordpress but I keep getting let down by poorly written tutorials. I am confident I can get somewhere now!

One small problem as I work myself through the steps above. I got the following error:

"sudo cp -r ~ /wordpress/* /var/www/wordpress/
cp cannot stat: '/root/wordpress/*' No such file or directory"

Please advise as soon as possible. Thanks in advance.
You may have skipped over making the directory which would have caused this error. It can be easy to miss as those code windows start melting together after a while! ;)

Code: Select all

sudo mkdir /var/www/wordpress
If the directory does not exist you cannot copy the WordPress install into it.

Edit: after looking at it some more it looks like your wordpress may not be in the root. cp cannot find it. You might try changing to the /home/pi directory and see if the wordpress folder is there.

Code: Select all

cd /home/pi

Code: Select all

ls
ls will list what is in the directory you change to.
Look to see if the wordpress directory was created some place else. If not, try extracting WordPress again and make sure there are no errors.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

PorterDon
Posts: 69
Joined: Wed Aug 21, 2013 2:09 pm
Location: Thailand

Re: Guide to installing WordPress

Wed Jan 08, 2014 3:50 pm

Thank you for your prompt reply.

Strange, it is in the root all right:

cd ~/wordpress
~/wordpress $ ls
index.php readme.html wp-admin wp-includes .....etc, etc.

I redid the chowns and did the cp again:

sudo cp -r ~/wordpress/* /var/www/wordpress
cp: cannot stat `/root/wordpress/*' : No such file or directory

Why is my copy failing with this error?

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Guide to installing WordPress

Wed Jan 08, 2014 9:49 pm

Try changing the ownership for /var/www

Code: Select all

cd /var/www
sudo su
chown www-data *
chown www-data */*
chown www-data */*/*
If this keeps giving you trouble do it manually. If you used full Raspbian then enter X with super user.

Code: Select all

sudo su
startx
Then copy or move it using file manager.

I have installed WordPress around six times, between making the tutorial and experimenting. It never installs without something being different. Some of this is due to the ever evolving Raspbian! Permissions is usually the issue mostly.
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

PorterDon
Posts: 69
Joined: Wed Aug 21, 2013 2:09 pm
Location: Thailand

Re: Guide to installing WordPress

Thu Jan 09, 2014 3:27 am

Well, running the cp command from this directory worked!:

[email protected] ~ $ ls
Desktop latest.tar.gz ocr_pi.png python_games wordpress

Now for the copy command itself:
[email protected] ~ $ sudo cp -r ~/wordpress.* /var/www/wordpress

This worked! :o :?: :D

I'll take it and run ..... now back to getting somewhere. Thanks!

Return to “Networking and servers”