In this tutorial we are going to provide you with step by step instructions on how to install WooCommerce plugin on an Ubuntu 16.04 VPS.
WooCommerce is a WordPress plugin written in PHP that allows website developers to turn a WordPress website into a full-featured online store. The installation process is fairly easy and it takes only a couple of minutes.
At the time of writing this tutorial, the latest stable version of WooCommerce is 2.6.4 and it requires:
- PHP 5.6 or higher (preferably the latest), with memory_limit PHP variable set to 64 MB or higher (128 MB or higher is preferred)
- MySQL 5.6 or higher
- WooCommerce 2.6.4 requires WordPress 4.4+
- Apache Web Server 2.0 or higher compiled with mod_rewrite module.
This install guide assumes that Apache is already installed and configured on your virtual server.
Let’s start with the installation. Make sure your server OS packages are fully up-to-date:
apt-get update apt-get upgrade
Enable Apache rewrite module if it is not already done so:
Install required PHP packages:
apt-get install php7.0-cli php7.0-common php7.0-mcrypt php7.0-mysql php7.0-xml php7.0-curl php7.0-zip php7.0-gd
Restart the Apache service for the changes to take effect:
service apache2 restart
Download the latest version of WordPress available at https://wordpress.org/download/ to the /opt/ directory on the server:
cd /opt/ wget https://wordpress.org/latest.zip unzip latest.zip -d /var/www/html/
Create a new MySQL database and user:
mysql -u root -p mysql> SET GLOBAL sql_mode=''; mysql> CREATE DATABASE wpdb; mysql> CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'y0ur-pAssW0RD'; mysql> GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit
Do not forget to replace ‘y0ur-pAssW0RD’ with a strong password.
Download the latest version of WooCommerce available at https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip to a directory on the server and extract it using the following commands:
cd /opt/ wget https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip -O woocommerce.zip unzip woocommerce.zip -d /var/www/html/wordpress/wp-content/plugins/
Edit the PHP configuration file (/etc/php/7.0/cli/php.ini):
and modify the memory_limit value to 128MB or higher:
memory_limit = 128M
All files have to be readable by the web server, so set a proper ownership:
chown www-data:www-data -R /var/www/html/wordpress/
Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘woocommerce.conf’ on your virtual server:
touch /etc/apache2/sites-available/woocommerce.conf ln -s /etc/apache2/sites-available/woocommerce.conf /etc/apache2/sites-enabled/woocommerce.conf vi /etc/apache2/sites-available/woocommerce.conf
Then, add the following lines:
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/html/wordpress/ ServerName your-domain.com ServerAlias www.your-domain.com <Directory /var/www/html/wordpress/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>
Remove the 000-default.conf file:
Restart the Apache web server for the changes to take effect:
service apache2 restart
Open your favorite web browser, navigate to http://your-domain.com/ and follow the easy instructions on the install screen inserting the necessary information as requested. Log in to the WordPress administration back-end at http://your-domain.com/wp-admin , go to Plugins and activate the WooCommerce plugin.
Then, go to the WordPress Dashboard, click on the ‘Run the Setup Wizard’ button below the ‘Welcome to WooCommerce’ message and configure basic WooCommerce settings.
That is it. The WooCommerce has been installed on your server.
Of course, you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install the WooCommerce plugin for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.