In this article we will setup WordPress from scratch in just a few easy steps. I will use a vps with centos 7.
Step 1) Install Apache web server
yum -y install httpd systemctl start httpd.service systemctl enable httpd.service
Step 2) Install PHP 5.6
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum -y install php56w php56w-opcache php56w-mysql php56w-xml systemctl restart httpd.service
Step 3) Install Mysql 5.6
yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm yum -y install mysql-community-server systemctl start mysqld.service systemctl enable mysqld.service
Step 4) Install WordPress
1 – Download latest WordPress
cd /var/www/html wget https://wordpress.org/latest.zip unzip latest.zip rm -rf latest.zip cp -rf wordpress/* /var/www/html/ rm -rf wordpress/
2 – Setup permissions:
chown -R apache:apache /var/www/html/* chown apache:apache /var/www/html
3 – Create MySQL Database, we will call ours ‘wordpress’, you can replace the word ‘wordpress’ below with whatever you would like your database to be called
mysqladmin create wordpress
Step 5) Point your browser to http://Your-Server-IP and you will see the WordPress installation page.
If nothing loads, first let’s verify our webserver is working:
[root@wordpress html]# ps ax | grep http 566 ? Ss 0:00 /usr/sbin/httpd -DFOREGROUND 568 ? S 0:00 /usr/sbin/httpd -DFOREGROUND 988 pts/0 S+ 0:00 grep --color=auto http
If you see at least one “/usr/sbin/httpd” line, this means our webserver is working. The most likely cause then would be our firewall blocking the access to our webserver. Let’s check it out:
[root@wordpress ~]# firewall-cmd --state not running
If we get ‘not running’, lets then start the firewall:
[root@wordpress ~]# systemctl start firewalld
[root@wordpress ~]
# systemctl enable firewalld Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service. Created symlink from /etc/systemd/system/basic.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
now lets run again:
[root@wordpress ~]# firewall-cmd --state running
We should now get ‘running’ which indicates the firewall is running correctly.
Let’s get our default zone:
[root@wordpress ~]# firewall-cmd --get-default-zone public
Let’s now get our active zone:
[root@wordpress ~]# firewall-cmd --get-active-zones
[root@wordpress ~]
#
If you get nothing when running the above command, this means we need to associate our zone with our network interface. Otherwise go to “Let’s now allow our webserver through the firewall”.
Let’s get the name of our network interface
[root@wordpress ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: gre0: <NOARP> mtu 1476 qdisc noop state DOWN link/gre 0.0.0.0 brd 0.0.0.0 3: gretap0: <BROADCAST,MULTICAST> mtu 1476 qdisc noop state DOWN qlen 1000 link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff 4: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/void inet 127.0.0.1/32 scope host venet0 inet 162.212.152.69/32 brd 162.212.152.69 scope global venet0:0
My network interface is called venet0, since this is the one with my internet IP, yours might be called ethX, enp0sX,etc
Let’s associate our network interface with our firewall zone
firewall-cmd --permanent --zone=public --change-interface=venet0
Let’s now allow our webserver through the firewall:
firewall-cmd --zone=public --permanent --add-service=http firewall-cmd --reload
Now go back to your browser and refresh, we should now get the wordpress install page.
On the first screen we will select our desired Language and hit Continue, on the second Screen hist Let’s Go
Now let’s fill the boxes, once you are done they should look exactly like below:
Database Name | The name of the database you want to use with WordPress. |
---|---|
Username | Your database username. |
Password | Your database password. |
Database Host | You should be able to get this info from your web host, if localhost doesn’t work. |
Table Prefix | If you want to run multiple WordPress installations in a single database, change this. |
Database name is the name of the database we created in step 3, if you gave your database a different name then wordpress, please change the first box.
Username & Password fields are the login for our local mysql database. Since we have not setup a password for it, we leave the password field blank, while username is the default one which is root.
Now click Submit. You will be taken to the next step:
Welcome
Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.
Information needed
Please provide the following information. Don’t worry, you can always change these settings later.
Site Title | |
---|---|
Username | Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol. |
Password |
Your Email | Double-check your email address before continuing. |
---|---|
Search Engine Visibility | Search Engine Visibility Discourage search engines from indexing this siteIt is up to search engines to honor this request. |
The fields here are pretty self-explanatory, and dont worry, everything can be changed at a later time. Once done click Install WordPress and wait, it might take several seconds for the install to finish. Once done you sould see the last screen:
Success!
WordPress has been installed. Thank you, and enjoy!
Username | Your chosen username. |
---|---|
Password | Your chosen password. |
Click the login button and you will be taken to your admin interface, login with the username & password you picked during the install.
Congrats ! You now have a brand new WordPress installation.