Вы находитесь на странице: 1из 8

How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

How to install WordPress on Fedora


By Paul W. Frields

WordPressstarted as a simple blogging system, but has evolved into a


reputablecontent management system. Its also one of the most popular open
source projects. Furthermore, its easy to set up WordPress on your Fedora
system.

Install the packages

Fedora provides a set of pre-packaged software to make installation easy. Open a


terminal, and at the command prompt, usesudo to install the followingpackages.

sudo dnf install @"Web Server" wordpress php-mysqlnd mariadb-server

This example assumes youll run the web and database servers on the same
machine. This is often the case for studentsanddevelopers alike.

1 of 8 02/21/2017 03:26 PM
How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

Enable the web and database services to start at boot time, then start them
immediately:

sudo systemctl enable httpd.service mariadb.service


sudo systemctl start httpd.service mariadb.service

Set up the database server

If this is your rst use of MariaDB, you should createa password for yourroot
user. Store it somewhere secure and safe, in case you forget it. Dont use the
systems ownroot (administrator) password.

sudo mysqladmin -u root password

Next, create a database. You canhost more than one WordPress site on a
machine. Therefore, you may want to choose a distinctivename for yours. For
instance, this example usesmywpsite. The-p switch prompts you for a password.
Youll need that, since youve added a password forroot.

sudo mysqladmin create mywpsite -u root -p

Next,set up a special privileged user and password for thedatabase. The


webapp uses these credentials to run. Use the standard mysql client program for
this step.The-D mysql option attaches to the built-inmysql database where
privileges are stored.

Your input is shown in boldfacein the example below. Make sure to use a strong
password and notpassword itself.

$ sudo mysql -D mysql -u root -p


Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor. Commands end with ; or \g.


Your MariaDB connection id is 6
Server version: 10.1.18-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [mysql]> GRANT ALL PRIVILEGES ON mywpsite.* TO 'sqluser'@'localhost'


IDENTIFIED BY 'password';

2 of 8 02/21/2017 03:26 PM
How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> FLUSH PRIVILEGES;


Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> QUIT;


Bye

Set up the web server

Next, tune the SELinux parameters so the web server can perform necessary
functions.

sudo setsebool -P httpd_can_network_connect_db=1


sudo setsebool -P httpd_can_sendmail=1

Next, edit the conguration le for the web server to allow connections. The le to
edit is/etc/httpd/conf.d/wordpress.conf. Change the following line:

Require local

Instead, edit it as follows:

Require all granted

Next, congure your rewall so it allows trafc on port 80 (HTTP):

sudo firewall-cmd --add-service=http --permanent


sudo firewall-cmd --reload

Congure WordPress

Next, edit the/etc/wordpress/wp-cong.php le. Provide the database settings


needed so WordPress can use the database you provided. Here are the lines to
change. Search for each and edit the required setting:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

3 of 8 02/21/2017 03:26 PM
How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

/** MySQL database username */


define('DB_USER', 'username_here');

/** MySQL database password */


define('DB_PASSWORD', 'password_here');

/** MySQL hostname */


define('DB_HOST', 'localhost');

The DB_HOST setting should staylocalhost if youreserving the database on the


same system asthe web server.

Finally, restart the web server:

systemctl restart httpd

Visit the WordPresssite

Next, youre ready to congure the web app itself. Open a web browser on the
system, or a connected system. Then browse to the IP address of your
WordPresshost, followed by/wordpress. For instance, your URL might
behttp://192.168.122.210/wordpress.If youre on the same box, you can
usehttp://localhost/wordpress. This step beginsthe setup process:

4 of 8 02/21/2017 03:26 PM
How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

Fill out the information required. Remember to use a strong password forthis
account, since it has administrator access to the entire WordPress blog. Once
done, selectInstall WordPress at the bottom.

Alogin screen appears so you can verify the WordPress username and password
you just entered. Login, and the following screen appears:

Youre now ready to create content. There are thousands of themes and plugins
available to customize your site.For more information on how to proceed, visit
the WordPress website.

Share:

Email Print Facebook 84 Google Twitter Reddit


Telegram More

Like this:

Like
8 bloggers like this.

Paul W. Frields

5 of 8 02/21/2017 03:26 PM
How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

Paul W. Frields has been a Linux user and Fedora Project community
enthusiast since 1997, and joined the Fedora
Project in 2003, shortly after launch. He was a
founding member of the Fedora Project Board, Previous post
and has worked on documentation, website
publishing, advocacy, toolchain development, and
maintaining software. He joined Red Hat as
Fedora Project Leader from February 2008 to July
2010, and remains with Red Hat as an engineering
manager. He currently lives with his wife and two
children in Virginia.

2 Comments ADD YOURS

Adam Williamson
February 20, 2017 at 16:39

Please also consider not installing WordPress, unless you really need a
big dynamic CMS. If all you want to to do is run a simple blog, strongly
consider using a static site generator like Pelican instead, as its less
maintenance work and much, much less prone to security issues than a
big complex PHP app.

linuxmodder
February 20, 2017 at 19:51

And piggybacking off Adams comment. While installing on the same


host/machine may be common its also the BIGGEST single mistake
security wise most users make as if the host or the database is
compromised it a simple escalation to own the whole thing.

6 of 8 02/21/2017 03:26 PM
How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

Leave a Reply
Your email address will not be published.

Name

Email

Website

Post Comment

Notify me of follow-up comments by email.

Notify me of new posts by email.

S U B S C R I B E TO F E D O R A Read about how you can submit


M AG A Z I N E V I A E M A I L
an idea or even write an article

7 of 8 02/21/2017 03:26 PM
How to install WordPress on Fedora - Fedora Mag... https://fedoramagazine.org/howto-install-wordpre...

Enter your email address to for Fedora Magazine.


Search form
subscribe to this blog and receive
notications of new posts by
email.
Join 2,750 other subscribers

Email Address

Subscribe

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora
Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases.
You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora
logo is a trademark of Red Hat, Inc. Terms and Conditions

8 of 8 02/21/2017 03:26 PM

Вам также может понравиться