Setting Up WordPress in Linux

To get a WordPress instance up an running on your own Linux server takes only a few minutes. Even though I run this blog on BlogEngine.net, I’ve deployed a couple dozen WordPress based sites and can attest to the fact that its a fantastic Blog and light CMS platform with hundreds of plug-in extensions that can get almost any type of web site up and running in no time, I’ve even seen light weight e-commerce plug-ins, although I would still recommend Magento if your looking for true e-commerce. Based on my preferred flavor of Linux, CentOS, here’s the steps to get up and running with WordPress in less than 10 minutes.

1. If this is your first WordPress instance you’ll need to install Apache, PHP and MySQL along with a couple utilities to make life easy.

#install required applications and utlities, use yum list to display installed packages, i.e. yum list php*
yum install httpd php php-pear php-mysql mysql-server mysql wget zip

#start Apache and MySQL services on boot up, use chkconfig –list to display current service start settings for each run level
chkconfig httpd on
chkconfig mysqld on

#start services without reboot
service httpd start
service mysqld start

#set MySQL root login password, i.e. SECUREPASSWORD
mysqladmin -u root password SECUREPASSWORD

#create php info web page to confirm Apache/PHP components installation, after you’ve created the index.php file you should be able to access your web server and receive the PHP Version info page.
echo “<?php phpinfo(); ?>” > /var/www/html/index.php

After you’ve successfully installed and configured Apache, PHP and MySQL you can set up your WordPress instance.

2. Login to MySQL and create your new WordPress site database instance.

#login to mysql cli
mysql -u root -p

#create new database
create database mywordpresssite;

#create new user and grant permissions to new database
grant all privileges on mywordpresssite.* to ‘mywordpressuser’@'localhost’ identifed by ‘myuserpassword’

#refresh to effect new privileges
flush privileges;

#close out of mysql cli
exit;

3. Download and install WordPress application files.

#create new web site directory
mkdir /var/www/html/mywordpresssite
cd /var/www/html/mywordpresssite

#download and extract latest build of wordpress files
wget http://wordpress.org/latest.zip
unzip latest.zip

#move application files to web site root and remove unzip directory
mv wordpress/* ./
rmdir wordpress/

#create content directories and set permissions
mkdir wp-content/uploads wp-content/cache
chown apache:apache wp-content/uploads wp-content/cache

4. Define virtual host entry in Apache config for new web site (required to support multiple web site instances on a single IP address). Requires virtualhost support has been enabled in Apache.

#edit apache config file to add new VirtualHost section
vi /etc/httpd/conf/httpd.conf

#confirm name-based virtual hosting is enabled
NameVirtualHost *:80

#add following to end of configuration file
<VirtualHost *:80>
 ServerAdmin
webmaster@mywordpresssite.com
 DocumentRoot /var/www/html/mywordpresssite
 ServerName
www.mywordpresssite.com
 ServerAlias mywordpresssite.com
 ErrorLog logs/mywordpresssite.com-error_log
 CustomLog logs/mywordpresssite.com-access_log common
</VirtualHost>

#restart apache to apply new virtual host setting
apachectl restart

5. Configure WordPress using install wizard.

#set web site root directory writable by apache to create configuration file
chown apache:apache /var/www/html/mywordpresssite

#open web browser and access new web site at http://www.mywordpresssite.com to setup through the WordPress configuration wizard

#missing wp-config.php file message, click Create a Configuration File

 

#enter database name, user and password information for mywordpresssite database created previously

#click Run the install to define your mywordpresssite properties including web site name, contact and admin login information

#change ownership of web site root directory back to root
chown root:root /var/www/html/mywordpresssite

 That’s all!

Now you can access your new My WordPress Site or log in to the admin portal to start blogging.

 

 

 

written by

The author didn‘t add any Information to his profile yet.

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>