This article covers a version of CentOS that is no longer supported. If you are currently operating a server running CentOS 6, we highly recommend upgrading or migrating to a supported version of CentOS.
Reason: CentOS 6 reached end of life (EOL) on November 30th, 2020 and no longer receives security patches or updates. For this reason, this guide is no longer maintained.
See Instead:
This guide might still be useful as a reference, but may not work on other CentOS releases. If available, we strongly recommend using a guide written for the version of CentOS you are using.
The following DigitalOcean tutorial may be of immediate interest, as it outlines installing WordPress on a CentOS 7 server:
Wordpress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality.
The steps in this tutorial require the user to have root privileges. You can see how to set that up here in steps 3 and 4.
Before working with wordpress, you need to have LAMP installed on your server. If you don't have the Linux, Apache, MySQL, PHP stack on your server, you can find the tutorial for setting it up here.
Once you have the user and required software, you can start installing wordpress!
We can download Wordpress straight from their website:
wget http://wordpress.org/latest.tar.gz
This command will download the zipped wordpress package straight to your user's home directory. You can unzip it the the next line:
tar -xzvf latest.tar.gz
After we unzip the wordpress files, they will be in a directory called wordpress in the home directory.
Now we need to switch gears for a moment and create a new MySQL directory for wordpress.
Go ahead and log into the MySQL Shell:
mysql -u root -p
Login using your MySQL root password, and then we need to create a wordpress database, a user in that database, and give that user a new password. Keep in mind that all MySQL commands must end with semi-colon.
First, let’s make the database (I’m calling mine wordpress for simplicity’s sake; feel free to give it whatever name you choose):
CREATE DATABASE wordpress; Query OK, 1 row affected (0.00 sec)
Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer:
CREATE USER wordpressuser@localhost; Query OK, 0 rows affected (0.00 sec)
Set the password for your new user:
SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password"); Query OK, 0 rows affected (0.00 sec)
Finish up by granting all privileges to the new user. Without this command, the wordpress installer will not be able to start up:
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec)
Then refresh MySQL:
FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
Exit out of the MySQL shell:
exit
The first step to is to copy the sample wordpress configuration file, located in the wordpress directory, into a new file which we will edit, creating a new usable wordpress config:
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
Then open the wordpress config:
vi ~/wordpress/wp-config.php
Find the section that contains the field below and substitute in the correct name for your database, username, and password:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'password');
Save and Exit.
We are almost done uploading Wordpress to the server. The final move that remains is to transfer the unzipped WordPress files to the website's root directory.
sudo cp -r ~/wordpress/* /var/www/html
From here, WordPress has its own easy to follow installation form online.
However, the form does require a specific php module to run. If it is not yet installed on your server, download php-gd:
sudo yum install php-gd
Last of all restart Apache:
sudo service httpd restart
Once that is all done, the wordpress online installation page is up and waiting for you:
Access the page by adding /wp-admin/install.php to your site's domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form (it should look like this).
Once Wordpress is installed, you have a strong base for building your site.
If you want to encrypt the information on your site, you can Install an SSL Certificate
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You can actually use SSH instead of FTP to update wordpress.
There are a few steps you need to take:
Install the EPEL repo: <pre>sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm</pre><br/>
Install the php-ssh2 module: <pre>sudo yum install php-pecl-ssh2</pre><br/>
Reload Apache: <pre>sudo service httpd reload</pre><br/>
Then, once you are in wordpress and trying to update something, you will be able to choose another connection. You will see in the section where it asks you for the FTP user and password, there will be another option to use the connection type SSH2. Using SSH2, put in your server userid and password and you should be able to update wordpress.
input: sudo cp -r ~/wordpress/* /var/www/html print: cp: target `/var/www/html’ is not a directory
help`
Thank you very much.
Your guide is great , but why not use the command “yum install wordpress” ? According to your approach, a Forbidden error maybe occur. But use the yum install, the installer will be very easy. The following is a brief process:
I used the guide and it worked perfectly, Thank you !!!
when i open the link: eryang.xyz/wp-admin/install.php in my brower, it doesn’t connect. I don‘t know which steps i do wrong. thx.
You are Awesome! I always use your guides and they are super easy to follow. Thank you so much!
Can you please make a Tutorial for NewsLetter Plugin on Wordpress? I am pretty sure lot of people are having hard time installing it :)
Thanks, Yasin
Awesome!!! speechless to appreciate your efforts… thanksss
How to set permalink on LAMP ? I cant set permalink when wordpress installed on my VPS…
I use centos 6 and the right to put my site like this yourdomain.com and subdomain1.yourdomain.com, subdomain2.yourdomain.com, subdomain3.yourdomain.com etc. I have installed as described above, but there is a bit of a problem. after I run your_VPS_ip blog / wp-admin / install.php
"Error: PHP is not running WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off. " what’s the solution.