There are many tutorials online that show new users and students how to install WordPress. Many of these tutorials are good. However, new users and students want something very simple to read and understand.
This brief post is going to give students that. A very easy to read and understand tutorial on how to install WordPress.
There many ways to install WordPress. Host providers such as GoDaddy, Bluehost and others provide easy tools to install and manage websites, including WordPress. That’s not what I’m talking about here.
What I’m going to show students is how to install WordPress on servers managed by themselves. Not shared or managed environments. A clean Linux server with nothing else installed.
One of the many choice you have is the Linux operating system to select for your machine. I prefer Ubuntu. If others work for you.. great.. but this tutorial is going to be based on Ubuntu Linux.
When you’re ready, continue below:
Step 1: Linux Server
Again, there are many Linux OS out there.. but Ubuntu is considered the easiest to work with. This tutorial is going to be using Ubuntu Linux as the operating system for WordPress.
Make sure Ubuntu is installed on the server you’re using and that you have root access to install packages and software.
Run the commands below to update the server
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
Step 2: Install Apache2 Web Server
After installing Ubuntu the next step is to install Apache2 Web Server. A webserver is required for WordPress to function. The most popular web server in used today is Apache2.. so go and install it.
sudo apt-get update sudo apt-get install apache2
Step 3: Install MySQL Database Server
After installing Apache2 Web Server, the next step is to install MySQL database server. A database server is also required for WordPress to function. The most popular database server in used today is MySQL.. so go and install it.
sudo apt-get update sudo apt-get install mysql-server mysql-client
During the installation, you may see a prompt to create a root password for the database. Type and confirm a password for the root user to continue.
Step 4: Create a database and user for WordPress
After installing the MySQL database server, your next step is to create a database and user for WordPress to use. This is required for WordPress to function. Follow the steps below to do that.
Run the commands below to logon to the database server. When prompted for the password, enter the password created above and continue
sudo mysql -u root -p
Run the commands below to create a new WordPress database called wpdb.
CREATE DATABASE wpdb;
Run the commands below to create a new WordPress user called wpuser.
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'type_new_password_here';
Run the commands below to grant the user full access to the WordPress database
GRANT ALL ON wpdb.* TO 'wpuser'@'localhost';
Save your changes and exit
FLUSH PRIVILEGES; exit
Step 5: Install PHP and Modules
The next step after installing MySQL server and creating WordPress database and user is to install PHP and its modules. WordPress requires PHP to function… so go and get it along with other PHP modules.
sudo apt-get update sudo apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc
Step 6: Download WordPress content
Now that all the packages and server required by WordPress are installed, go and download WordPress content from online. Use the commands below to do that.
cd /tmp/ && wget http://wordpress.org/latest.tar.gz
Then run the commands below to extract the download folder and move WordPress content to Apache2 default document root on Ubuntu servers. The default document root is at /var/www/html.
tar -xzvf latest.tar.gz sudo cp -R wordpress/* /var/www/html
Next, run the delete Apache2 default index.html file from document root.
sudo rm -rf /var/www/html/index.html
Step 7: Configure WordPress
After Downloading WordPress, follow the steps below to configure WordPress with the database connecting settings created above.
First, run the commands below to create WordPress wp-config.php settings file from its sample.
sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
Then open wp-config.php file and make the following highlighted changes to reference the database and user you created above.
sudo nano /var/www/html/wp-config.php
When the file opens, make the changes and save.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wpdb'); /** MySQL database username */ define('DB_USER', 'wpuser'); /** MySQL database password */ define('DB_PASSWORD', 'new_password_here'); /** 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', '');
After configuring WordPress settings, you next step will be to change Apache2 directory permissions so WordPress can function properly. To do that, run the below commands
sudo chown -R www-data:www-data /var/www/html/ sudo chmod -R 755 /var/www/html/
Finally, run the commands below to enable some important Apache2 modules and restart the server
sudo a2enmod headers sudo a2enmod rewrite sudo a2enmod env sudo a2enmod dir sudo a2enmod mime
sudo systemctl restart apache2
Then open your web browser and browse to the server host name or IP address
You should see WordPress default setup page ready for you to create a user account with password. After that, WordPress should function perfect.