Install WordPress on OrangePi Plus
Recently I have decided to move all my website editing on local computer and publish the final version only when pages are ready.
A year ago I bought OrangePi Plus and want to use this small credit card size computer as a hardware platform for WordPress. Below there are all steps starting from Linux installation on the board and finishing with publishing first page on the WordPress.
What is an OrangePI? It is a computer designed to be a clone of RaspberryPi but at the end has almost nothing common with it. I would say OrandePi is just another platform for learning.
But it has many variations and low price. So it can fit to many applications use Linux or Android as operating system. It also good for our task to run Apache2 Server and WordPress.
Let’s start
-
- Download and prepare image from http://www.armbian.com/download/ My board is OrangePi Plus and I don’t need desktop version with GUI, Server Debian Jessie will do the job. All work will be done using Terminal. Use 7zip to unzip downloaded image to extract file with .img extension.
- Prepare SD card (Class10 preferable) using SDFormater to format the card and Win32DiskImager to write image on the card. Procedure is simple and described many times on the YouTube. On the SDFormatter click on option and choose FORMAT SIZE ADJUSTMENT => ON. It will remove all partitions on the card and will use all available space to format.
- Insert card into OrangePi Plus card reader and connect 5V power. You don’t need to press any buttons. Wait ~2-3min to make sure operating system is loaded and ready for operation.
- Connect Ethernet cable to the OrangePi and find on your router’s DHCP table IP address assigned to the OrangePi Plus.
- If you have SSH client PUTTY installed then run it, if not, download and install it.
- Run PUTTY, type OrangePi IP address into Host Name (192.168.1.39 in my case), select SSH below (selected by default), click open to connect.
- On the first time Warning message notify you that there is no registered rsa2 key for your board and offers to use new key. Click on “Yes” to continue.
- Login as “root” with default password “1234”, it can take a minute or two to show first “Welcome Screen”.
- Please note “Usage of /: 82% of 1.2G” . On the first boot Linux is loaded from image on the card which has minimum size (1,2G). Message highlighted below in red notifies about resizing on the next boot. We don’t need to worry about extra steps how to utilize all space available on the SD card. I am using 32G card and would like to use all 32G for filesystem. Armbian will do it for me on the next boot automatically.
- Now it is time to create new password for user root, create a new user for future use. Simply follow instructions.
- Use new username which you will use on regular basis. I am using “gshop” as a new user name.
- Setup display resolution for future use. My monitor is old and supports 1024x768p.
1h3disp -m 1024x768 -d - Next step is to reboot to apply all changes.
1reboot
Close PuTTY and open it again. Most likely IP address will be the same. If not, look at DHCP table on the router to find assigned IP address. - Connect to the board, Login as root and use new password created on the steps above. Note that filesystem is extended and uses all space on the card.
- Now need to grant new user gshop the root privileges
1visudo
Find the line
12# User privilege specificationroot ALL=(ALL:ALL) ALL
and add line below
1gshop ALL=(ALL:ALL) ALL
Press Ctrl+x to exit and Y to save. - Let’s do some networking. It is good idea to use our server with the static IP address. nano /etc/network/interfaces Find section with eth0 interface (first one) and change the IP values according your network settings.
- Cntr+x to exit and Y to save. Restart network
1sudo /etc/init.d/networking restart - If nothing comes than IP address was changed successfully. Close PuTTY and open again. Use new IP address to connect. To save time in future, type new IP on the Host Name field, type orangepi or whatever you like as a name of connection on Saved Sessions and press Save. Now new settings are saved under name orangepi. Next time simply click on orangepi in the list of Saved Sessions and click on Open to connect to the board. Because new IP, warning message to apply new key will show up. Click on “Yes” to continue. Login as root and reboot system with command: “reboot” or “shutdown -r now”
1shutdown -r now
Close PuTTY and open. Login as user gshop or with the name which you use in step 11. - Time to install a smart staff. Follow instructions and press Y and Enter when needed. MySQL will ask to create a Password for MySQL “root” user. Write down all user names/passwords to avoid troubles in future.
12345sudo suapt-get updateapt-get install apache2apt-get install php5apt-get install mysql-server - How to setup MySQL. We will create database “wp01”, database user “wpuser@localhost” with password “wpdbpassword”
12345678mysql -u root -p//Enter password which you used for MySQL "root" user during MySQL setup.CREATE DATABASE wp01 ;CREATE USER wpuser@localhost;SET PASSWORD FOR wpuser@localhost= PASSWORD("wpdbpassword");GRANT ALL PRIVILEGES ON wp01.* TO wpuser@localhost IDENTIFIED BY 'wpdbpassword';FLUSH PRIVILEGES;exit //or press Ctrl+d - Will install WordPress.
1234cd /var/www/wget https://wordpress.org/latest.tar.gztar -xzvf latest.tar.gzcd wordpress - WordPress is installed now in default folder where Apache Server will look for it. A little of setup:
12cp wp-config-sample.php wp-config.phpnano wp-config.php - Find the place to change DB name, user and password and type wp01 as a DB_Name, wpuser as username and wpdbpassword as password
1234567891011// ** MySQL settings - You can get this info from your web host ** ///** The name of the database for WordPress */define('DB_NAME', 'wp01');/** MySQL database username */define('DB_USER', 'wpuser');/** MySQL database password */define('DB_PASSWORD', 'wpdbpassword');/** MySQL hostname */
Cntr+x to exit and Y to save - Let’s Apache know where to look for WordPress
1234567891011nano /etc/apache2/sites-enabled/000-default.conf//findServerAdmin webmaster@localhostDocumentRoot /var/www/html// change /var/www/html to /var/www/wordpress//The final section should look like:ServerAdmin webmaster@localhostDocumentRoot /var/www/wordpress
Ctrl+x to exit and Y to save - Install MySQL replication and load balancing module for PHP and configure Apache user:
1234sudo apt-get install php5-mysqlnd-mssudo chown www-data:www-data /var/www/* -Rsudo usermod -a -G www-data gshopsudoservice apache2 restart - Next step is to create and configure upload directory:
12345cd ~/cd ..cd var/www/wordpress/wp-contentsudo mkdir uploadssudo chown -R www-data:www-data uploads/ - We are close to finish. Let’s fix upload file size. Default is 2Mb, will increase to 64Mb :
1234cd ~/cd ..cd /etc/php5/apache2nano php.ini
somewhere in the middle (section File Uploads) find: upload_max_filesize = 2M and change 2M on 64M or whatever you like/want. Ctrl+x to exit and Y to save. - We are done. Open Internet browser and type 192.168.1.123 or your OrangePi static IP address. WordPress will come with Setup page to finish installation
I hope nothing was missing in my descriptions and process will take 20-30min to install WordPress on OrangePi Plus.
Comments are disables due to huge amount of spam.