HOW TO HOST A WORDPRESS SITE ON RASPBERRY PI...

Do you want to host your own wordpress site online with a cheap raspberrypi ? Here is a way to so it in an easy way...



Why use wordpress ? 

If you want to host websites with databases and user input then it isn't the best for you. You can just show what your company can do and you can give out your information in a creative manner using wordpress.

Which verson of raspberry pi can you use?

You can use any verson of raspberry pi greater than pi2 because the older versons are not much power fulla as the newer versons. Here iam using raspberry pi 4 to demonstrate to you and the method is same for all versons of raspberry pi.

You must need atleast 16GB of memory card for storing the data because wordpress use more storage space for storing the templates and themes.

Step 1:Setting up apache server.

This apache server helps us to host any type of web server on any web browser.
so lets install apache server.
To install use this command : sudo apt install apache2 -y
this should install apache 2 in your system.


To check is it working or not just type your raspberry ip address in any web browser connected to the same network as your raspberry pi.

To see your ip address just give the command : hostname -i

Step 2 : Installing php on raspberry pi:

Php is the server side language which does all the commands and connects the webpage to databases. so you definately need php to host any type of websites.

To install php use this command : sudo apt install php -y

Step 3 : Installing Mysql on raspberry pi:

Wordpress need a database in order to store things like images ,links, usernames, passwords , and may more.

so to install mysql use this command:  sudo apt install mysql-server php-mysql -y

After installing this you need to restart apache service to enable mysql in apache 
To researt apache use this command : sudo service apache2 restart

Step 4 : installing wordpress:

To install wordpress we need to remove all the other files in /html/ folder .

To do that use this command : cd /var/www/html/

The use this : sudo rm *

Now , use this to get the latest verson of wordpress : sudo wget http://wordpress.org/latest.tar.gz


This command will get the word press on the folder.
 Now after installing we need to extract the contents in that file.

So use this command : sudo tar xzf latest.tar.gz

Now all the contents are extracted and we want to move the contents to /html/ folder so that only we can access it through apache server. 
Use this command : sudo mv wordpress/* .

Next we need to give the directory the owner permissions 
So , Use this command : sudo chown -R www-data: .

Step 5 : Configure mysql for wordpress:

To setup mysql for wordpress you need to run the following command : sudo mysql_secure_installation

not this will ask for root password , so enter the password .

After this it will ask some questions and just type y for all those and enter.
When the "All Done " Message is displayed it has been succesfully installed in your raspberry pi.

Step 6: We need to create a wordpress database:

To install wordpress you first need to create a database for word press.
use this to open mysql : sudo mysql -uroot -p

Then enter the following commands : 

1. create database wordpress;
2. Here change the pass with your own password 
    GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'PASS';

3. FLUSH PRIVILEGES;

Now succesfully we have created a database for wordpress. Just remember the username and pass for the next setting up.

Step 7: Setting up wordpress:

open your web bowser in any local network and enter the ip address of your raspberry pi.
The default wordpress webpage will appear. There select your desired language. 

If you have made it this far, you should have named the datebase "wordpress", and have a not of the password. The username is root and the host is localhost. The table prefix is wp_ .

Clock submit, the run this install. Then the sitel will ask you for some basic details and click install. The sepup will be quickly installed.

To login to your WordPress installination go to http://localhost/wp-admin


From here you can start creating your website with word press.

To start a web hosting business with raspberry pi  CLICK HERE.












Comments

Popular Posts