How to Setup a WordPress Server

I have setup a wordpress site for a friend, but I’m afraid that I cannot remember all the steps and all corresponding commands, so I recorded what I did.

  1. Edit SSH configuration file, change port, password or disable password login for security, then restart ssh:
  2. Change IPTables rules, only allow connections desired ports, close unused ports:
  3. where 12345 is the port number set in the above step.

  4. By default, IPTables rules are not persistent, i.e. they are reverted to the default after system reboot. To save the rules, install iptables-persistent package:
  5. Install HTTP packages:
  6. Install also php modules for xml and image editing

  7. MySQL security setup:
  8. update 2017-08-24: mysql_install_db is deprecated as of MySQL 5.7.6 because its functionality has been integrated into mysqld, the MySQL server. See mysql document for details.

  9. Edit site configuration file per need
  10. Here is a very simple example:

  11.  Enable modules, enable site and reload apache to make the change effective:
  12.  Create user and database for wordpress:
  13.  Download wordpress, unzip it, move it to correct place and modify the ownership:
  14.  Generate secret keys:
  15. Use the key in the configuration file:


1 thought on “How to Setup a WordPress Server

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.