
So you want your site to be beautiful, responsive and most importantly free so you set up your web server, got Apache up and running, did a Hello World page to see it was working and then got stuck. You have your own web server and you don't have to pay for hosting but what's that thing that all those sites use again? The thing that comes with hosting? WordPress, my friend, WordPress and you can have it too with a few quick configurations.
To note about this article is that this is specifically for CentOS 7 users however if you use a different flavor of Linux you can up a quick Google search of "How to install WordPress on Apache on [insert Linux distro]". It is also assumed that you have already installed and configured Apache as well as a MariaDB to your liking. Now that's been made note of, let's begin!
STEP ONE - INSTALL WORDPRESS
Note: '>' represents the line to enter into your terminal console while '#' represents the comments explaining what the commands do
>sudo yum install php-gd #this installs a php module that allows you to resize images to create thumbnails >sudo yum service httpd restart #restarts Apache to recognize the new PHP module >cd ~ #to go to default directory >wget http://wordpress.org/latest.tar.gz #downloads the compressed WordPress package >tar xzvf latest.tar.gz #decompresses the WordPress package
STEP TWO - MIGRATE WORDPRESS TO HTML DIRECTORY AND CREATE DATABASE
>sudo cp -a ~/wordpress/ /var/www/html #this command migrates the contents of the decompressed wordpress package to the HTML directory >cd /var/www/html >mkdir /var/www/html/wp-content/uploads #this creates a directory for WordPress to store uploads >mysql -u root -p >CREATE DATABASE wptest; >CREATE USER wpadmin IDENTIFIED BY 'wpadminpass'; >GRANT ALL PRIVILEGES ON wptest.* TO wpadmin@localhost IDENTIFIED BY 'wpadminpass'; >FLUSH PRIVILEGES; >EXIT; #this creates the database that wordpress will use, you can use whatever credentials you'd like but I suggest you keep them secure! >sudo chown -R apache:apache /var/www/html* #web server is now given permission to edit the directory >cp wp-config-sample.php wp-config.php #this is the configuration file for WordPress, I copied the sample because the configuration is fine and all that needs adding are the database credentials. >sudo nano wp-config.php #look for the database configuration lines adn change the password, username and database name to what you configured previously
STEP THREE - YOU'RE BASICALLY DONE!
Now you can enter your server's IP address in your browser and voila! Just follow the menu prompts and easy peasy you're done!
To make note of though is in the Settings you should change your site address from 127.0.0.1 to whatever your DNS name is or the actual IP address of the host you're on. This is important because otherwise when you try accessing the site from a remote host not all the CSS will load properly!
Thanks for giving this a read!