Randy Cannon: Computer Science Information

Randy Cannon, How do I set up WordPress on a Linux Server?

Randy Cannon's Lamp

Randy Cannon recommends Linux for your WordPress installation. One of the great things about Linux is that you can see every command you’ve typed in the command line terminal by typing the command “history”.

Randy Cannon, the Linux Commander

Although, it could have been set up a lot sooner, Randy Cannon was able to set up a fully functional server running WordPress in about 150 commands through trial and error. There was some typos and troubleshooting involved and after some many hours of research, Randy Cannon was able to get the system running offline on a virtual computer with Debian Linux as the operating system. While the copy of the print out above doesn’t show all the steps as there were modifications that were taken using the nano text editor and while Randy Cannon has setup MySql from the command line, he wanted to test out Webmin and did so from there. The trouble shooting came in to play when the operating system wouldn’t allow WordPress to upload other themes into the directories and Randy Cannon had to change ownership www-data, some people suggested changing permissions on the directories to 777 but this did not solve the problem and presents security threats to the system. This seemed to be a popular problem setting up WordPress. Another popular problem Randy Cannon ran into was sub pages beyond the localhost domain were resulting in 404 pages. Randy Cannon found the solution to this problem as well and was able to fix it by enabling rewrite. Once these problems were solved, the server and local website was up and running. The next step was setting the system to run as a wifi captive portal using hostapd and dnsmasq, but that’s for another post.

Here’s how Randy Cannon set up WordPress on a LAMP (Linux, Apache, MySql, PHP) Server in the VirtualBox running Debian Linux.

Unless you plan on using a virtualbox with usb 2.0 and 3.0 support, there’s no need to run VBoxLinuxAdditions. There’s also no need to install hostapd if you don’t plan on setting up a wireless access point.

First, update your system. On Debian Linux, this meant issuing the apt-get update command.

Then, install apache2, php5, php-pear, php5-mysql, mysql-server, mysql-client, and libapache2-mod-auth-mysql.

If you want to use a graphic user interface (GUI) to set up mysql and WordPress, install webmin, otherwise continue in the command line interface (CLI). Randy Cannon finds the command line to be more efficient and effective than the GUI. PHPMyAdmin is also a great GUI for setting up MySQL database.

Once you’ve decided to go with the GUI or the CLI, start mysql and set up your database, username, and password information for your WordPress installation.

After you’ve done this, start the Apache2 web server.

Go to your web browser and type in localhost to make sure your web server is now running. Your web site files will be stored in the /var/www/html directory.

Once you’ve verified that the server is running, download, extract, and install WordPress.

Randy Cannon used wget to download the latest version of wordpress. tar -xvf will allow you to extract the compressed package on a Linux system.

Once the files have been extracted, move them all over to the /var/www/html directory

Before installing WordPress, you must copy the wp-config-sample.php file and rename it to wp-config. WordPress can be setup as a single site or as a multisite with separate websites running under sub-domains or sub-directories. If you want a multisite network, you must place the following code in your wp-config.php file:

define( 'WP_ALLOW_MULTISITE', true );

Otherwise, look in the wp-config.php file for the section that says MySQL settings and enter your MySQL database name, username, and password you entered while setting up your WordPress database.

Randy Cannon, MySQL

Randy Cannon suggest changing ownership recursively to the /var/www directories to www-data using the chown command and enabling rewrite using a2enmod rewrite command if you’re using Debian or Ubuntu Linux to avoid future problems. The php.ini and the .htaccess files will also needed to be modified to enable mod_rewrite. Randy Cannon also recommends that you increase your maximum upload size in the php.ini file while your in there.

After all this is done, Randy Cannon suggests that you restart Apache and MySQL just to refresh the settings.

Once all of this has been completed, open your web browser and install WordPress through the following url: localhost/wp-admin/install.php where you’ll be prompted to enter a site title, username, and password.

Randy Cannon, WordPress Installation

After you do this and press install WordPress, if there were no errors, you’ll be brought to a WordPress success page where you can login and start designing, and customizing your WordPress website from the dashboard. Randy Cannon has taken out all of the trial and error for you so you should be able to set up your system in under 25 commands.

Randy Cannon, WordPress Success


For more information on setting up WordPress, you can visit the following url: https://codex.wordpress.org/Installing_WordPress

If you want Randy Cannon to set up your server and WordPress installation, download this digital discount below:


April 10, 2016