Synology usage series 16: Install WordPress on Diskstation


Couldn’t belive it is so simple to install wordpress on the DS207+.

Assumption:

Mysql database for wordpress ‘wordpress
Mysql database user for wordpress database ‘user_wordpress
Mysql database user password ‘12345678
Web directory is here /volume1/web
I.P. address of diskstation is 192.168.1.100

The assumption above is for illustration only. You can always define your own value. Just make sure the web directory is correct.

Here are the simple steps to get wordpress running on diskstation.

  1. Telnet/SSH to diskstation as root
  2. Install unzip command in order to decompress the wordpress package.

    # ipkg install unzip

  3. download latest wordpress package to the diskstation. I usually ssh to the shell and use wget to download to the diskstation directly


    # cd /volume1/web
    # wget http://wordpress.org/latest.zip
    # unzip latest.zip

    A directory ‘wordpress’ should be created under the web directory.

  4. Login to diskstation admin console, activate the web station and mysql database.

    Network Services > Web Services > Web Applications

    Enable web station and mysql database

    Enable web station and mysql database

  5. Setup mysql as below


    # cp /usr/syno/mysql/share/mysql/my-small.cnf /etc/my.cnf
    # /usr/syno/etc/rc.d/S21mysql.sh restart

    Once the mysql is restarted, launch the mysql linux client as below


    # /usr/syno/mysql/bin/mysql --host=localhost --user=root

    Execute following SQL statements with the mysql linux client in order to create mysql user ‘user_wordpress’, allow it to connect from the diskstation itself and from any host. In order to allow the windows mysql client gui to connect to the mysql database, it is required to allow the db user to connect from specific host or simply any host.


    mysql> use mysql;
    mysql> create user 'user_wordpress'@'localhost' identified by '12345678';
    mysql> create user 'user_wordpress'@'127.0.0.1' identified by '12345678';
    mysql> create user 'user_wordpress'@'%' identified by '12345678';

    (Replace user_wordpress to your preferred wordpress database user name. ‘12345678‘ is the password assigned to the wordpress database user ‘user_wordpress’. Strongly suggested to change it to a better password instead.)

    Once the database user ‘user_wordpress’ is created, then assign the ‘CREATE’ right for ‘user_wordpress’ the ability to create database.


    mysql> GRANT create ON *.* TO 'user_wordpress'@'%' WITH GRANT OPTION;

    (Again, replace user_wordpress to your preferred wordpress database user name.)

  6. Create the database using mysql linux client


    For non unicode database:
    mysql> create database wordpress;

    For unicode database:
    mysql> create database wordpress character set = utf8 collate = utf8_general_ci;

  7. Once the database is created, assign the correct privileges of the wordpress database user.

    I assign super user right for user_wordpress when connect to the wordpress database locally so that wordpress can install and setup the database itself.

    I also assign normal SQL rights (select, update, delete, insert) for user_wordpress when connect from remote host. This will allow me to manipulate the wordpress database using SQLyog windows client after the installation.


    # /usr/syno/mysql/bin/mysql --host=localhost --user=root
    mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'user_wordpress'@'127.0.0.1' WITH GRANT OPTION;
    mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'user_wordpress'@'localhost' WITH GRANT OPTION;
    mysql> GRANT insert, select, delete, update ON wordpress.* TO 'user_wordpress'@'%';

    (As always, replace ‘wordpress’ to your preferred database name. However, it must matching the database that you previously created by SQLyog. Also replace ‘user_wordpress’ to the actual database user that you created in previous step)

    Now the database setup is completed!.

  8. Telnet/SSH to the diskstation as root. Setup the wordpress now.


    # cd /volume1/web/wordpress
    # mv wp-config-sample.php wp-config.php

  9. Edit wp-config.php

    DB_NAME: wordpress (input the name of your wordpress database)
    DB_USER: user_wordpress (input the username of the wordpress database)
    DB_PASSWORD: 12345678 (input the password of the db username)
    DB_HOST: localhost

    For unicode database:

    DB_CHARSET: utf8
    DB_COLLATE: utf8_general_ci

  10. Open the browser, and continue the setup by browing the following URL

    http://192.168.1.100/wordpress/wp-admin/install.php

    If the database information specified in the wp-config.php is correct, the install page will be shown as below

    WordPress Setup Screen #1

    WordPress Setup Screen #1

    Input the title of your blog, the email address of the administrator, click the checkbox if you want search engine like Google crawl your blog. Click ‘Install’ to continue.

    If installation is successful, wordpress will generate an admin account with random password.

    WordPress Setup Screen #2

    WordPress Setup Screen #2

    Click ‘Login’ button to login the admin console and configure your new blog in your diskstation 🙂

    Nov 11 2011 – Blank page issue

    ** In most case, if you did follow every single steps above, you should not encountered any problem. If you still got a blank page instead of the install screen, please make sure

  11. Enable software/Plugin upgrade from admin console

    By default, the apache is executed by the ‘nobody’ account. However, we are using root account to perform the setup above. This avoid the admin console to perform any software and plugin upgrade .

    To fix this, simply change the ownership of whole wordpress directory to nobody as below.


    # chown -R nobody:nobody /volume1/web/wordpress





31 thoughts


  1. Hello, thanks for the tutorial.
    I am quite new to the Linux/SQL world and I have trouble finding out how to carry out the following section:

    mysql> use mysql;
    mysql> create user ‘user_wordpress’@’localhost’ identified by ‘12345678′;
    mysql> create user ‘user_wordpress’@’127.0.0.1′ identified by ‘12345678′;
    mysql> create user ‘user_wordpress’@’%’ identified by ‘12345678′;

    Do I have to run it through a mysql client command line interface and if so, which program will allow me to do that?

  2. Hello. Yes you need to run it through the mysql client. The command below will launch the mysql client

    # /usr/syno/mysql/bin/mysql –-host=localhost –-user=root
    

    Just happened to know that wordpress cannot display double ‘-‘ correctly.

    Thanks for pointing out and the display issues is fixed.

  3. Thank u very much. I create a new database using the command line. It is only one difference. Your post has very much helped me with understanding of sequence and sense of actions. I`m lamer. 🙂

  4. Thanks! I was skeptical whether this would really be this easy, but it really is. Followed the steps one by one and everything works like a charm !

  5. Nice tut, thanks!

    However, how to go about this with an existing WordPress blog? Can I simply enable it on my DS210j and copy the wordpress directory from its current server to the NAS?

    cheers!

    Lau.

    • If you are talking about moving your existing wordpress blog from somewhere to NAS, yes, you can copy the wordpress dir to NAS, export the mysql database and import back to the NAS. At then run a few sql statements to change the domain name.

      I’ve another article here which is doing something like this, you may refer to [modding series 28] for reference.

      Good luck.

  6. Hi!

    I’ve managed to perform the install, and I can easily access the blogg localy and do everything I want (by just typing the IP adress of the NAS)

    But when I try to access it from internet it only shows me blank page.

    So ruled out the username/password, cos then it would work localy either.
    Tried the .htaccess trick. Didn’t find a file name .htaccess, however I made on with the line that I was supposed to add with index.php etc.

    I’ve been trying to fix this since I wanted to get my blogg up and working before my first trip to USA, however so far no luck. Any tips?

    • Under ‘General Setting’, did you set the ‘WordPress Address (URL)’ and ‘Site Address (URL)’ to your ddns domain name?

      • Trying ot change site adress to both “http://selbyggen.dlinkddns.com” and “http://norwegiantravelgeek.com” (which basicly just forward url frame to selbyggen.dlinddns.com)
        It gives me “The Site address you entered did not appear to be a valid URL. Please enter a valid URL.”

        When it comes to WordPress address (URL) it is grayed out and I’m unable to change it…

        As a sidenote: Thank you for fast response O.o
        And I like your blog/site!

  7. Trying ot change site adress to both “http://selbyggen.dlinkddns.com” and “http://norwegiantravelgeek.com” (which basicly just forward url frame to selbyggen.dlinddns.com)
    It gives me “The Site address you entered did not appear to be a valid URL. Please enter a valid URL.”

    When it comes to WordPress address (URL) it is grayed out and I’m unable to change it…

    As a sidenote: Thank you for fast response O.o
    And I like your blog/site! 🙂

  8. Hi I’ve ordered the DS212J. I also have a WordPress blog with a service provider. I would like to set up a test version on the DS212J and copy down my current live data. I note from above yuo say this is possible I wonder if you wouldn’t mind giving details on how this can be done. Unfortunately I have no experience with SQL etc. Appreciate any advice you can give.

    Regards Shay 🙂

    • Man great you got a new 212j. sure you can migrate your wordpress from web hosting to your nas. Just refer to modding series 28 and you’ll have an exact copy of your wordpress running on your nas! Once the wordpress running on your nas, you don’t need mirroring anymore and just shutdown the web hosting copy.

  9. This worked well for DSM4.1 on my new DS411j. I wanted to create a personal blog that wasn’t on the internet so I could keep a good record of certain events. This was a great tutorial. Thank you.

  10. I need to make some corrections, but it was the only that works for me in the first time.
    I’ll compile the corrections for those that need a help. I’m installed in DS212 with DSM4.1
    Very nice and excellent job.
    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *