Difference between revisions of "Setup WordPress on CentOS 7"
From rdkwiki
m |
m |
||
Line 36: | Line 36: | ||
* '''wget http://wordpress.org/latest.tar.gz''' --> download latest WordPress release | * '''wget http://wordpress.org/latest.tar.gz''' --> download latest WordPress release | ||
* '''tar xzvf latest.tar.gz''' --> extract the package | * '''tar xzvf latest.tar.gz''' --> extract the package | ||
− | * '''sudo mv ./wordpress/ /var/www/html/<sitename>''' —> move all files to live location | + | * '''sudo mv ./wordpress/ /var/www/html/<sitename>''' —> move all files to live location with a name of choice |
* '''mkdir /var/www/html/wp-content/<sitename>/uploads''' —> create directory for uploads | * '''mkdir /var/www/html/wp-content/<sitename>/uploads''' —> create directory for uploads | ||
* '''chown -R apache:apache /var/www/html/''' --> make apache owner of the directory | * '''chown -R apache:apache /var/www/html/''' --> make apache owner of the directory |
Revision as of 18:04, 6 November 2016
Contents
- 1 Intro
- 2 Install prerequisites
- 3 Apache webserver installation
- 4 Firewall configuration
- 5 MySQL installation
- 6 Installing and testing PHP
- 7 Configuring MySQL user and database for WordPress
- 8 WordPress installation
- 9 vhost configuration (optional)
- 10 WordPress configuration
- 11 Access your WordPress server
Intro
The steps below will configure a working WordPress web-server. The steps assume that you have a (fresh) CentOS 7 server running.
Install prerequisites
- yum install nano wget --> install the nano editor and wget
Apache webserver installation
If Apache isn't already running then here's how to install and configure it: Installing Apache webserver
Firewall configuration
- firewall-cmd --permanent --add-port=80/tcp --> allow http traffic
- firewall-cmd --permanent --add-port=443/tcp --> allow https traffic
- firewall-cmd --reload --> restart firewall with new config
MySQL installation
If MySQL isn't already running then here's how to install and configure it: Installing MySQL on CentOS 7
Installing and testing PHP
- yum install php php-mysql php-fpm php-gd --> install WordPress requirements
- systemctl restart httpd.service --> restart Apache webserver
- nano /var/www/html/info.php —> create testscript
content of file: <?php phpinfo(); ?> and save the file
- http://<serverip>/info.php —> test (should give you info about PHP)
- rm /var/www/html/info.php —> remove testscript after successful testing
Configuring MySQL user and database for WordPress
- mysql -h <host> -u <user> -p --> connect to your MySQL-server
- create database <wordpress database>; --> create a database with name of choice
- create user '<wordpress user>'@'<host>' identified by ‘<password>’; --> create a user of choice
- grant all privileges on <wordpress database>.* to '<wordpress user>'@'<host>' identified by ‘<password>’; --> give new user rights on new database
- flush privileges; --> reload all rights
- exit --> exit the MySQL interface
WordPress installation
- cd /<directory> —> goto a directory of choice to extract WordPress
- wget http://wordpress.org/latest.tar.gz --> download latest WordPress release
- tar xzvf latest.tar.gz --> extract the package
- sudo mv ./wordpress/ /var/www/html/<sitename> —> move all files to live location with a name of choice
- mkdir /var/www/html/wp-content/<sitename>/uploads —> create directory for uploads
- chown -R apache:apache /var/www/html/ --> make apache owner of the directory
vhost configuration (optional)
if you want to create a vhost for WordPress then this is the moment. Here you can find how: installing Apache webserver
WordPress configuration
- cd /var/www/html/<site> --> goto your WordPress directory
- cp wp-config-sample.php wp-config.php --> copy example configuration to live configuration
- sudo nano wp-config.php --> alter the default configuration
change: define('DB_NAME', '<databasename>'); change: define('DB_USER', '<username>'); change: define('DB_PASSWORD', '<password>'); add define('FS_METHOD', 'direct'); to end of file
Access your WordPress server
Now you should be able to access your WordPress server at http://<host>.<domain>.<tld>