Wordpress in a Pocket

About: Hi, My name is Jonathan. I am 13, and I love making projects with Arduino, Raspberry Pi and ESP8266.

The Raspberry Pi Zero is the smallest computer in the Raspberry Pi family.

Easy to slip in your pocket, the Pi Zero can be used as a Wordpress Server.

I chose Wordpress because it is the instant solution for creating a powerful website easily.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things Needed

1 Raspberry Pi Zero or Zero W connected to the Internet. Make sure you are running a Debian-based operating system such as Raspbian or DietPi. Ubuntu is not supported on the Pi Zero, as Ubuntu can only run on an ARMv7 or higher architecture. Here I have setup the Pi Zero via USB Ethernet. You can also o this via Wi-Fi.

Make sure SSH is enabled.

2 A desktop computer with a Internet connection.

3 Putty terminal software (if using Windows). Link:- https://www.chiark.greenend.org.uk/~sgtatham/putty...

If you are using a Mac or Linux computer, then open up a terminal and make use of the "ssh" command.

Step 2: Getting Connected

Power up the Zero and connect it to the Internet using Wifi or USB Ethernet.

Find out the IP address of your Pi Zero by loging in to your router. Usually http://192.168.1.1 or http://192.168.0.1

The router customisation page address is different for different routers. You can find the IP listed on a sticker on the back of your router. Or find your router model's IP on Google.

You can also use Apple's Bonjour Service that supports Multicast DNS (or hostname such as raspberrypi.local)

You can download Bonjour here:- https://bonjour.en.softonic.com/

This makes things easy. You can use your hostname for loging in to your Pi Zero via SSH instead of finding out its IP and then typing it.

You can also use a tool such as Advanced IP Scanner. Download it here:- https://filehippo.com/download_advanced_ip_scanner...

or use Angry IP Scanner. Download it here:- https://sourceforge.net/projects/ipscan/

Now enter the IP address into the Putty login settings and login to your Pi Zero as the pi user.

You will now be able to access the Pi's command prompt remotely. Once you login, you should see:-

pi@raspberrypi ~ $:

If you still don't know how to enable ssh, then hook up a monitor keyboard and mouse to your Pi Zero.

Open up a terminal and type:-

sudo raspi-config

This opens up the configuration tool.

If you are using Raspbian Stretch:-

select the Interfaceing Options, hit enter.

It will ask if you want ssh server to be enabled.

Select yes.

But if you are using Raspbian Jessie:-

select the Advanced options, hit enter and do the same thing as stated above.

Exit the raspi-config tool

You should now reboot your Pi by typing :-

sudo reboot

A reboot after configuration makes sure that the changes task effect.

Now use an ssh terminal on your normal desktop computer. If using windows, Putty, if using Linux or Mac, type the 'ssh' command in your terminal.

The default username is pi

And the default password is raspberry.

All are in lower-case.

You can change your password, is you wish, by typing:-

sudo passwd

Step 3: Commands to Be Run in the Terminal

Run (type the following in your terminal):-

sudo apt-get update

sudo apt-get upgrade -y

Then reboot your Pi Zero by typing:-

sudo reboot

The reboot is necessary in order for the new kernel related changes to take effect.

sudo apt-get install -y apache2 php libapache2-mod-php mysql-server php-mysql

NOTE :- IMPORTANT! PLEASE CHANGE THE php TO php5 libapache2-mod-php5 php5-mysql IF YOU ARE USING RASPBIAN JESSIE!

sudo service apache2 restart

or

sudo /etc/init.d/apache2 restart

Now change directory by typing :-

cd /var/www/html

This is the default Apache2 directory where you can write HTML programs or other programs related to web designing such as .css, .php, .js

Run the following to install wordpress and to give yourself an ownsership of that directory:-

sudo rm *

sudo wget http://wordpress.org/latest.tar.gz

sudo tar xzf latest.tar.gz

sudo mv wordpress/* .

sudo rm -rf wordpress latest.tar.gz

sudo chown -R www-data: .

In the last picture, I have restarted the Apache2 service after doing the necessary things in the /var/www/html directory (such as the wordpress installation)

Step 4: Setting Up Your Database for Wordpress

Run this command :-

sudo mysql_secure_installation

You will be asked Enter current password for root (enter for none): — press Enter.

Type in Y and press Enter to Set root password?.

Type in a password at the New password: prompt, and press Enter

NOTE:- VERY IMPORTANT! MAKE A NOTE OF THE PASSWORD YOU ARE ENTERING NOW, AS YOU WILL BE NEEDING IT LATER.

Type Y to :-

Remove anonymous users, Disallow root login remotely, Remove test database and access to it, Reload privilege tables now.

When complete, you will see the message All done! and Thanks for using MariaDB!.

Now you will be greeted with the usual command prompt :- pi@raspberrypi ~ $ :

Type in this command :-

sudo mysql -uroot -p

Then enter the password you entered earlier.

Now you will be greeted with the MariaDB prompt (like this >).

Enter this command to create a database namd wordpress.

create database wordpress;

Remember, the semicolon at the end of the command is important in the SQL sytax.

Now run this command :-

GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD';

Replace YOURPASSWORD with the password you entered earlier.

Then run :-

FLUSH PRIVILEGES;

Then press ctrl + d to exit.

Step 5: Almost There

Now open up a browser and type in you Pi Zero's IP address. Select your language and click Continue. You will be presented with the WordPress screen. Now click Let's Go button on the page. Enter the username as root and password as the password you entered earlier. Run the Install button. Give you website a catchy title and username root. All done!

Now just a few final touches :-

sudo a2enmod rewrite

sudo nano /etc/apache2/sites-available/000-default.conf

Add these lines to the file after line 1 :- AllowOverride All

Ensure it’s within the .

It should look something like this:-

<Virtualhost *:80>

<Directory "/var/www/html">

AllowOverride All

</Directory>

...

The pictures show the Installation of Wordpress stepwise. The last four show the final touches. Then run:-

sudo service apache2 restart

To restart the Apache2 service.

Step 6: Your Very Own Website

In the last picture is my test website, as I have customised it in the Customising page shown in the previous picture. You can login (picture 1) and customise your page, add themes, fonts and all that stuff to your webpage easily (picture 2). You can also install new themes. NOTE:- I have not port-forwarded my Raspberry Pi Zero, hence, you won't be able to view my website unless and until you are connected to the same network I am using (i.e. my home router)

I hope you enjoyed making your own Pocket-Sized Wordpress Server using a Raspberry Pi Zero or Zero W.

Bye and Happy Web Designing! :) :) :)

Pocket Sized Contest

Participated in the
Pocket Sized Contest

Be the First to Share

    Recommendations

    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    Discussions