WordPress is an open source website and blogging tool, it works off of PHP and MySQL. WordPress is one of the most common Content Management Systems on the internet. This makes WordPress a good choice for getting a website setup quickly.
This page will help you get WordPress setup, we will setup WordPress on a server that already has a LAMP Setup on it. If you do not have a LAMP setup (Linux, Apache, MySQL, and PHP) visit our post to setup the LAMP here. If you are wanting to host multiple WordPress site’s on the same server you need to have Apache setup to do Virtual Host, if that is not setup you can get the info from here. We will show on this page how to setup a Single WordPress site as well as setting up Multiple WordPress Site’s on the same server.
Step One – Create a MySQL Database for WordPress
Again before we start if you do not have MySQL ready to setup a Database please go to the LAMP setup page to make sure you are ready to setup the Database.
To get started we need to be logged into MySQL’s root account:
# mysql -u root -p
It will prompt you for the password you setup when you installed the MySQL service on the server when you did the LAMP setup. After you put the password in you need to enter the Database name, you can use anything you want but for our perpuse we will just use wordpress for the Database name.
>CREATE DATABASE wordpress;
When entering each command in MySQL you have to end it with “;” this tells it that this is the end of the line. Once you enter each line just hit enter.
Next we will setup the Username and Password for the Database
>CREATE USER wordpressuser@localhost IDENTIFIED BY ‘password’;
Again here we used wordpressuser and password for this example, you would want to use your own username and password.
Now we will give the user access to the database we just setup.
>GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘password’;
After you enter all three lines you must now flush the privileges so MySQL knows about the changes we just made, to do so we just do the following command:
If you are wanting to setup Multiple WordPress site’s you would do these same steps but use different Database Name’s, Username’s, and Passwords for each site you are setting up.
Step Two – Install WordPress
Again if you installed your LAMP you should have all PHP plugin’s installed and your Apache up and running all you should need is to download the WordPress tar.gz file extract it and move it to your Apache default locations or if you are doing Virtual Domains to the locations you are pointing your config files to.
To Start lets get wordpress downloaded, If you do not have wget install install it now:
# yum install -y wget
# wget http://wordpress.org/latest.tar.gz
# tar xzvf latest.tar.gz
Now that we have it downloaded and Extracted we can move the files to the correct location. To do so we will use rsync again if you do not have it installed, install it now:
# yum install -y rsync
Now if we are just doing one web page we will move the files to the default Apache Location.
# sudo rsync -avP ~/wordpress /var/www/html/
If you followed my Virtual Setup and want to do Multiple Sites you will want to do the following two commands:
# sudo rsync -avP ~/wordpress /var/www/html/domain1/public_html
# sudo rsync -avP ~/wordpress /var/www/html/domain2/public_html
Now we want to make and Upload directory for items that are uploaded like pictures. We do that with the following command:
# mkdir /var/www/html/wp-content/uploads
If you are doing Multiple domains just add your domaind and public_html after html and before wp-content.
Now we need to assign ownership and permissions to our WordPress Files and Folders. This will help with Security but still allow WordPress to function as it needs too.
# sudo chown -R apache:apache /var/www/html/*
Now the web server is able to create and Modify WordPress files, and will also allow us to upload content to the server.
Step Three – Configure WordPress
Now we have to configure, it is easier then it was before. If you just go to your domain name now it will prompt you that this is a new WordPress site. Then you need to Enter your MySQL info. It should look something like this:
Then it will ask for your Admin info for the page, that will look something like this.
Then you are all set, just login and go to your dashboard. Again if you are doing Multiple Steps you will do this step for each site.
If this was helpful in any way let me know, also if you have questions or don’t understand something let us know.