Skip to main content

Installing WordPress on a Linux Box in 5 minutes


Wordpress Logo

Working with Drupal as my CMS of choice for my professional and personal endeavors I have had almost no encounters with WordPress.  That all changed this week as I was asked to help setup a WordPress site for a friend.   All I can say is, man that was a fast and easy install.  It literally took 5 minutes to get the site up and running.  This information is widely available on the web, but I figured I would do a quick tutorial on this subject in case anyone out there looking over the site was looking to get involved with WordPress.  




  1. A Linux web server running Apache, and with PHP and MySQL Server installed.
  2. A DNS record in place and pointed at your web server.  This will be the URL that you use to call up your new WordPress site.

Downloading and Configuring

  1. First download the latest version of WordPress from here.  Unpack the archive you downloaded and save it to a folder that you can edit the files you downloaded with a text editor or IDE.
  2. Next use a text editor like Sublime Text to open the WordPress folder and change the name of wp-config-sample.php to wp-config.php.  Then open the wp-config.php file.
  3. Use the URL,  to generate authentication keys for your new site:
define('AUTH_KEY',         'X7zHo@~*pDCDw,t5Nm|OpYS:s,$D(Ape&gaaA*+tRHYX@!+j0;-rv!*!DN>Cz1%P');
define('SECURE_AUTH_KEY',  'WMM{]d5Vx@QQb=rt-Jh&5Ao)24o Lz_]+@z/NxcqCx3F/4aZ`6T~E}Whef5|,8fJ');
define('LOGGED_IN_KEY',    '>QB/I4<>YY/~P#8~tWdm=72LxLGa98u<Uo|3dymAnN2>RX+[3^- /');
define('NONCE_KEY',        'LPxpG*sWXR7d#sJ-[+,=N-:_2J7Q?bL]X`FMvSp|k[=*2bqm}y}M+}?~|0N>?a/9');
define('AUTH_SALT',        'P|/q6epAa/._QTMBodoWO,p4G7s@|$L8|JM[hH^f.6#@96j|%,Cb2;%.qN]~+_T$');
define('SECURE_AUTH_SALT', 'uXhGkvb^Yh~aqb8=-U>n/5S1|2tZvH3V[roLQ8dejJ//ot/H}X&b~RW>9mF{RoGZ');
define('LOGGED_IN_SALT',   '-/GZ)+#sGZoD]Pw%YUrZoAYfJ&L;q5/dY0-QIqA+p;8i9l4pOqOFfc=TT*Ez`-@m');
define('NONCE_SALT',       'wXMC /E: /U)jDD* V}[=hk5r[Ub5fXKZ]QF!IFpZv_VxZ=Fv>f.I+*7b)P.=`Fm');

4. Next, right above your authentication keys, add a database name, a user, a password, and a host if you are not using localhost.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress_database');
/** MySQL database username */
define('DB_USER', 'database_user');
/** MySQL database password */
define('DB_PASSWORD', 'my_password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

MySQL Configuration

  1. SSH into your Linux server and create a database, a user, and give that user a password and permissions on the database that you just created.  These values will be the same values from your wp-config.php file above. 
  2. Flush the privileges table so that your new changes take effect.
  3. Exit MySQL.
# From the terminal
$ mysqladmin -urootuserformysql -prootpassword create wordpress_database
$ mysql -urootuserformysql -prootpassword 
mysql> GRANT ALL PRIVILEGES ON wordpress_database.* TO "database_user"@"localhost"  
              IDENTIFIED BY "my_password";
mysql> exit;

Apache Configuration

  1. At this point you should FTP your new WordPress site up the Apache exposed folder.  For Example, /var/www/html
  2. In Apache create a host header for your DNS record to land on and so that Apache can route the URL to your WordPress site.
# From the terminal, this is assuming you are using a RHEL version of Linux, like CentOS
# Open the Apache config file
$ sudo nano /etc/httpd/conf/httpd.conf
# Create a host header at the very bottom of the file
<VirtualHost *:80>
    DocumentRoot /var/www/html/wordpress-site
    ErrorLog /var/log/
# Save the config file and restart Apache
$ sudo service httpd restart

That is it!!  You should now be able to navigate to and run through the WordPress setup process.  Was that not easy!!!   Let me know if you have any question comments or concerns.

Member for

3 years 9 months
Matt Eaton

Long time mobile team lead with a love for network engineering, security, IoT, oss, writing, wireless, and mobile.  Avid runner and determined health nut living in the greater Chicagoland area.