Author Archives: Geneva Sibanda

About Geneva Sibanda

I assist companies in the Areas of Network Infrastructure Design and Implementation: (from Windows Active Directory Security, networking, etc.).

How to install cakePHP on Ubuntu Server running VestaCP

CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. Our primary goal is to enable you to work in a structured and rapid manner–without loss of flexibility. CakePHP makes building web applications simpler, faster and require less code.

Installation

CakePHP is simple and easy to install. The minimum requirements are a web server and a copy of CakePHP, that’s it! CakePHP will run on a variety of web servers such as Apache2, Nginx, LightHTTPD, or Microsoft IIS.

Requirements

•HTTP Server. For example: Apache. Having mod_rewrite is preferred, but by no means required.
•PHP 5.4.16 or greater.
•mbstring extension
•mcrypt extension
•intl extension

While a database engine isn’t required, we imagine that most applications will utilize one. CakePHP supports a variety of database storage engines:

•MySQL (5.1.10 or greater)
•PostgreSQL
•Microsoft SQL Server (2008 or higher)
•SQLite 3

In this tutorial you will learn how to easily install and get started with CakePHP. For this guide it is assumed that you are already running your own server instance, a web server and have full root access to your server. This tutorial will use Ubuntu Server for the operating system and Apache for the webserver (+ PHP and MySQL).

Installing CakePHP on Ubuntu Server powered by Vesta Control Panel.

First, you’ll need to download and install the latest release of cakePHP if you haven’t done so already. Switch folder and create a new folder as follows:

root@gs2:~# cd /backup/
root@gs2:~# mkdir installs
root@gs2:~# cd installs/

If you have wget installed, it’s as easy as running the following:

root@gs2:/backup/installs# wget https://github.com/cakephp/cakephp/archive/2.5.7.zip

Now that you’ve downloaded the 2.5.7.zip file, you need to unzip it to extract the CakePHP application by running:

root@gs2:/backup/installs# unzip 2.5.7.zip

You should get a new folder that contains all the CakePHP files called cakephp-2.5.7. Now go ahead and move all the content in this folder to the root directory of your VestaCP something more usable, like:

root@gs2:/backup/installs# mv cakephp-2.5.7/* /home/admin/web/default.domain/public_html/

Next up, let’s change the folder to our root directory, where we moved all CakePHP files to:

root@gs2:/backup/installs# cd /home/admin/web/default.domain/public_html/

We are now located into the root directory and when you run ls you should see all CakePHP files.

root@gs2:/home/admin/web/default.domain/public_html#

Next up, let’s adjust the permissions of the app/tmp folder of your application as CakePHP will need to use it quite a bit so it needs to be writable by the webserver run the following:

root@gs2:/home/admin/web/default.domain/public_html# chown -R root:www-data app/tmp
root@gs2:/home/admin/web/default.domain/public_html# chmod -R 775 app/tmp

URL Rewriting

Apache

While CakePHP is built to work with mod_rewrite out of the box–and usually does–we’ve noticed that a few users struggle with getting everything to play nicely on their systems. Here is what you might try to get it running correctly.

root@gs2:/home/admin/web/default.domain/public_html# apache2ctl -M

Now we need to go and make a few changes on CakePHP core.php file. This helps to improve security and to avoid warns popping up when you running your CakePHP application. Go ahead and Edit the core.php file located in the app/Config folder and run the following:

root@gs2:/home/admin/web/default.domain/public_html# vi app/Config/core.php

Find the following block and replace the longstring Security.salt and Security.cipherSeed:

/**
* A random string used in security hashing methods.
*/	
 Configure::write('Security.salt', 'VOsTwxSCrZIWT6rhEKPZNxD6Bvog1Phomai40xMz');
/** 
* A random numeric string (digits only) used to encrypt/decrypt strings. 
*/	
 Configure::write('Security.cipherSeed', '598173280301592121433557250171');

The actual strings and numbers may differ in your case, but this is where you’ll have to change the values into something impossible to guess. Just make sure you only include numbers for the cipherSeed. You can use this website to automatically generate your random strings: http://textmechanic.com/Random-String-Generator.html

In my case, I adjusted the values for ‘Security.salt’ as follows: Generate 1 random strings 40 objects in length then click “Generate Random String”,

and

The numbers for ‘Security.cipherSeed’ as follows: Generate 1 random strings 30 objects in length – then click “Generate Random String”, what’s key in this part is that you need to remove all characters and leave only the numbers like: 0123456789

Save the file and exit.

Database connection

From the console of your Vesta Control Panel, go and create the database and database login details:

In my case I created the database called: admin_db and the database user called: admin_12

Next, let’s go ahead and configure CakePHP to use this database. First thing you need to do is make a copy of the database.php.default file located in the /app/Config/ folder and name it database.php.

root@gs2:/home/admin/web/default.domain/public_html# cp app/Config/database.php.default app/Config/database.php

Then open the file and locate the following block of code (change database to ‘admin_db’ and ‘login’ => ‘admin_12’, to your mysql login and password ‘WsMyyfzM32’) :

root@gs2:/home/admin/web/default.domain/public_html# vi app/Config/database.php
class DATABASE_CONFIG {	
public $default = array(		
'datasource' => 'Database/Mysql',		
'persistent' => false,		
'host' => 'localhost',		
'login' => 'admin_12',		
'password' => 'WsMyyfzM32',		
'database' => 'admin_db',		
'prefix' => '',		
//'encoding' => 'utf8',

Now you need to make sure that your apache2 vhost for your CakePHP is configured correct, You should have something like:

root@gs2:~# vi /home/admin/conf/web/apache2.conf
 
ServerName n1highway.co.za    
ServerAlias www.n1highway.co.za    
ServerAdmin http://www.esgnet.co.za    
DocumentRoot /home/admin/web/default.domain/public_html/app/webroot
ScriptAlias /cgi-bin/ /home/admin/web/default.domain/cgi-bin/
Alias /vstats/ /home/admin/web/default.domain/stats/ 
Alias /error/ /home/admin/web/default.domain/document_errors/    
#SuexecUserGroup admin admin    
CustomLog /var/log/apache2/domains/default.domain.bytes bytes  
CustomLog /var/log/apache2/domains/default.domain.log combined 
ErrorLog /var/log/apache2/domains/default.domain.error.log

           Options -Indexes +FollowSymLinks
           AllowOverride All
           Order allow,deny
           Allow from all


        AllowOverride All


        RMode config        
	RUidGid admin admin        
	RGroups www-data    
  
        
	AssignUserID admin admin    
    
IncludeOptional /home/admin/conf/web/apache2.default.domain.conf


We are almost done, You should run these two commands:

root@gs2:/home/admin/web/default.domain/public_html# sudo a2enmod rewrite
root@gs2:/home/admin/web/default.domain/public_html# sudo service apache2 restart

If all is followed right to the ‘T’ and configured correctly, you should now find your CakePHP application accessible at your website, in my case: http://www.n1highway.co.za

Alright, now your CakePHP application should be running smoothly and ready for baking.

How to install VestaCP on ubuntu Server

Vesta Control Panel:

VestaCP is an Open Source web hosting control panel with premium features, secure, advanced and minimalistic design.

Vesta CP has all the features for easy and fast operation, without the need for a “manual” editing of configuration files. Right after installation the following is completely supported:

◾Apache + nginx as a webserver;
◾DNS-server;
◾Mail server, including the setting up of DKIM, spam filter and antivirus;
◾The stable version of PHP;
◾Database management system MySQL 5.5;
◾Built-in backup functions;
◾Task Scheduler (cron);
◾Monitoring server load;
◾Fast, multi-language interface

Panel installation process is very simple and can be done even by a beginner. In order to start, you need to decide with your operating system – Vesta CP successfully works on Centos, Ubuntu and Debian. For this guide I used Ubuntu Server 14.04 of the OS

Remember the best way to learn any technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! and gain the practical experience.



Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Order NOW!

How to install

Connect to your server ssh as root via putty:

Update your Ubuntu Server

root@ns1:~# apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove

Then I edited /etc/hosts. Setup it look like this:

root@ns1:~# vi /etc/hosts

Now run

root@ns1:~# echo ns1.magwinya.co.za /etc/hostname
root@ns1:~# service hostname restart

Afterwards, run

root@ns1:~# hostname
root@ns1:~# hostname -f

Both should show ns1.magwinya.co.za now.

Download the VestaCP installation script

root@ns1:~# curl -O http://vestacp.com/pub/vst-install.sh
<root@ns1:~# ls
vst-install.sh

Run it

root@ns1:~# bash vst-install.sh

=======================================================


 _|      _|  _|_|_|_|    _|_|_|  _|_|_|_|_|    _|_|
 _|      _|  _|        _|            _|      _|    _|
 _|      _|  _|_|_|      _|_|        _|      _|_|_|_|
   _|  _|    _|              _|      _|      _|    _|
     _|      _|_|_|_|  _|_|_|        _|      _|    _|


-------------------------------
  https://192.168.10.63:8083
  username: admin
  password: kMtXWuyZ5t
-------------------------------

Congratulations, you have successfully installed Vesta Control Panel and you can logon and get started using VestaCP

NB: In the next guide, I will provide step-by-step on how to change default DNS setting and move into more an Advanced user.

How to Upgrade Nginx on ubuntu server

Introduction:

Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy.

Remember the best way to learn any new technical skill, is to play around and see how things work. Get comfortable you’re few steps in right direction. Click HERE to Order Your VPS NOW! so that you can gain the practical experience needed.

Now 50% OFF! VPS hosting solutions optimized for you: Click HERE to Order NOW!

Upgrading Nginx on ubuntu server 14.04

In this guide, i’ll walk you through how to upgrade Nginx installed on your Ubuntu server. Before you begin you need to make sure that you have root access privileges.

Step One — Upgrade Nginx

Check the version of nginx currently running on Server. You do so by running the following command line syntax:

root@gs2:/home/sibanda# nginx -v
nginx version: nginx/1.6.0

Step Two – Backup Nginx Configuration

Backup the configuration files :

root@gs2:/home/sibanda# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.upgradeback_24082015

Step Three – Adding Nginx Repository

To add the Stable version of nginx apt repository, edit a file named /etc/apt/sources.list, and paste The following releases of Ubuntu nginx to your system’s Software Sources below.

root@gs2:/home/sibanda# vi /etc/apt/sources.list
deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main

Step Four – Stop Nginx Service

The nginx web server service can be stopped using the following command line syntax:

root@gs2:/home/sibanda# service nginx stop

Step Five – Nginx Upgrade

Now the actual upgrade to the Stable version of nginx begins, use the following command line syntax:

root@gs2:/home/sibanda# apt-get update && aptitude dist-upgrade -y && apt-get autoremove -y

The following packages will be upgraded:

nginx nginx-common nginx-full

3 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 421 kB of archives. After unpacking 111 kB will be freed.
WARNING: untrusted versions of the following packages will installed!

Untrusted packages could compromise your system’s security.
You should only proceed with the installation if you are certain that this is what you want to do.

nginx nginx-common nginx-full

Do you want to ignore this warning and proceed anyway?
To continue, enter “Yes” ; to abort, enter “No”: Yes

Step Seven – Start Nginx Web Server

The nginx web server can be started using the following command line syntax:

root@gs2:/home/sibanda#service nginx start

Step Eight – Check the Nginx Version

You can type the -v option to display nginx web server version. The syntax is:

root@gs2:/home/sibanda# nginx -v
nginx version: nginx/1.8.0

That’s it. Now you have the latest version of Nginx running on your server.

How to Upgrade HP StoreVirtual Storage LeftHand Using Centralized Management Console (CMC)

About this Guide:

This guide provides information for upgrading the HP StorageWorks P4000 SAN Solution, using HP StoreVirtual Centralized Management Console (CMC). The intended audience is system administrators responsible for implementing, maintaining, and managing a P4000 SAN Solution.

About HP StoreVirtual Centralized Management Console (CMC)

HP StoreVirtual Storage enables you to create a virtualised pool of storage resources and manage a SAN. The LeftHand OS software is installed on the HP StoreVirtual Storage and you use the HP StoreVirtual Centralized Management Console (CMC) to manage the storage. For a list of supported software and hardware, see the HP StoreVirtual 4000 Storage from HP Website.

Upgrading HP StoreVirtual Storage LeftHand (HP P4000)

HP recommends that you always upgrade to the latest version of the HP StoreVirtual Storage including:

Firmware
LeftHand OS
CMC

Getting started with the CMC

If you have ever needed to update your HP StorageWorks P4000 SAN you need to download upgrades available, end then close your CMC in order to switch to enable Support Upgrades Mode in the CMC.

Enabling Support Upgrades CMC 10.5  to 11.5 – HP P4000

The following steps will enable Support Upgrades in the CMC, and will allow you to manually patch the storage systems with individual patches:

1. Shutdown the CMC

2. Open C:\Users\geneva\.storage_system\preferences.txt

3. At the top of the file, add the following:

CmcSystemPreference.supportMode=true
CmcUpgradePreference.useOldUpgrades=true
CmcUpgradePreference.userUpgrade=true

4. Start CMC, under Configuration Summary there will now be a “Support Upgrades” tab.

It is important to add the lines to the top in step 3, otherwise the “Support Mode” tab will not be active.

I hope you find this information useful.

Best wishes…if you need help with HP StorageWorks P4000 SAN Solution you can simply contact us.

Category: HP

How to Install cPanel/WHM on CentOS 6.5 Server

About cPanel and WHM

cPanel is a graphical web-based control panel that helps you quickly and easily manage your website and hosting account. cPanel software gives you complete control over a vast amount of functions, streamlining useful processes such as: Creating databases. Managing website files.

About this installation guide:

This guide provodes installation instructions for the cPanel/WHM on CentOS 6.5 Server. It covers how to prepare your CentOS 6.5 server and how to install the application software.

Who this installation guide is for.

This installation guide is for professional web infrastructure engineers, technical newbies, web hosting management installers and administrators. If you follow this step-by-step guide right to the ‘T’, you will successfully install cPanel/WHM.

WARNING:

Once cPanel/WHM is installed, it cannot be removed from the server without a complete server reinstall, cPanel/WHM does not offer an uninstaller.

cPanel/WHM Installation Steps

Before installing cPanel/WHM on your VPS or dedicated server, you need to take care of a few key steps.

First insure that your CentOS 6.5 Server is fully patched and up-to-date.

To perform a full system upgrade, type this command:

root@ns1 [~]# yum upgrade

Second we need to make sure that our server Fully Qualified Domain Name (FQDN) is correctly configured:

root@ns1 [~]# vi /etc/sysconfig/network

In our setup we are using hostname=ns1.magwinya.co.za (FQDN)

root@ns1 [~]# vi /etc/hosts

192.168.10.142 ns1.magwinya.co.za ns1

root@ns1 [~]# uname -a
Linux ns1.magwinya.co.za 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Third we need to make sure that perl, wget and screen is installed on the server.

root@ns1 [~]# yum install perl wget screen 

Once you’ve addressed the CentOS 6.5 OS version readiness checks, you don’t have to install any other dependency package as cPanel auto installer script does all for you. We can download cPanel/WHM installer file with wget command and have it saved under /home directory.

Use this command to change to /home directory.

root@ns1 [~]# cd /home/ 

Use this command to download cPanel with WHM:

root@ns1 [/home]# wget -N http://httpupdate.cpanel.net/latest 

root@ns1 [/home]# wget -N http://httpupdate.cpanel.net/latest
--2014-08-02 20:50:33-- http://httpupdate.cpanel.net/latest
Resolving httpupdate.cpanel.net... 74.200.65.162, 74.200.212.130, 75.126.236.226, ...
Connecting to httpupdate.cpanel.net|74.200.65.162|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21572 (21K) [application/octet-stream]
Saving to: “latest”

100%[============================================================>] 21,572 40.8K/s in 0.5s

2014-08-02 20:50:39 (40.8 KB/s) - “latest” saved [21572/21572]

root@ns1 [/home]# 

Now go-ahead and run the auto installer script, but we strongly recommended to run cPanel/WHM auto installer script in screen mode if you are doing it with SSH because it takes 3-4+ hours to complete the installation depending on your server resources.

root@ns1 [/home]# sh latest 

Verifying archive integrity... All good.
Uncompressing Cpanel & WHM Installer.....
____ _
___| _ \ __ _ _ __ ___| |
/ __| |_) / _` | '_ \ / _ \ |
| (__| __/ (_| | | | | __/ |
\___|_| \__,_|_| |_|\___|_|

Installer Version v00032 rd0a77335c9257e711a05151f8371e04f218507ca

Beginning main installation.
------------------------------------
------------------------------------

Once the script completes its installation, it will display a message that cPanel/WHM installation is complete. You will be asked to reboot the server after installation.

After that you need to complete the installation wizard from its web based interface and you can access WHM with the following URL.

https://192.168.10.142:2087

•Additionally, cPanel is subject to a licensing fee which may come out to be around $200 a year.

Please login with user “root” and your password. There are some more clicks remaining to complete the cPanel installation. Agree End User License Agreement by clicking “I Agree?/Go to Step 2” button:

Best wishes...if you need help with installation you can simply contact us.

NB: You can try this guide on a Magwinya Wired VPS! I'm very happy to setup a clean VPS for you to use.

From as little as $20 p/m

Business Continuity Architecture

Every business is exposed to risk of various kinds. Disruptions such as hardware failure, system corruption could play havoc in your business operations. A well thought Business Continuity Architecture should offer immediate recoverability in the event of loss of critical servers and data. Get business operations back up and running within short time rather than weeks, reducing recovery time and saving businesses from economic failure.

Key Building Blocks

Approach your Business Continuity Architecture (BCA) with a view to address practical risk and business continuity management, including the identification and assessment of enterprise risks, development of business impact analysis (BIA), recovery strategies, business continuity plans, crisis management plans, plan testing and maintenance, and continuity program governance.

Talk is cheap, but, as always, disaster strike when you’re least expecting. In my experience in assist companies in the Areas of Network Infrastructure Design and Implementation it is very common for companies to fall into the trap of thinking that “it’ll never happen to us,”.

To be continued…

In the meantime you can read the following: http://www.slideshare.net/GenevaSibanda/rock-solid-data-protection/

An error occurred.

I encountered the following error on my VPS?

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

NB:

I noticed the above error message immediately after running the following cli:

# apt-get update && aptitude dist-upgrade -y && apt-get autoremove -y

Troubleshooting:

I had to check the error logs for details on the issue? And the error logs revealed the following:

14:48:22 [crit] 1685#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 10.14.11.34, server: en-ww-307.esgisp.net, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php5-fpm.sock:”, host: “www.esgnet.co.za”

This solved my problem.

Changed owner of php5-fpm.sock and set permission to 0660.

1. Go to /etc/php5/fpm/pool.d
2. Open www.conf (vi www.conf)
3. Uncomment all permission lines, like:
; listen.owner = www-data
; listen.group = www-data
; listen.mode = 0660
4. Restart fpm (sudo service php5-fpm restart)

Hope this helps!

update failed! see the log below for more information. your site is still in maintenance mode.

Drupal 7 module update failed:

I was encountering the following warning when trying to perform an upgrade of Drupal 7 google_analytics module to the latest version.

google_analytics
•Error installing / updating
•File Transfer failed, reason: Cannot create directory /public_html/sites/all/modules/google_analytics

My immediately highly secure approach was to make the www-data user and group the owner, make the default directory and the PHP config files in it readable only by www-data, and make the files subdirectory readable and writeable only by www-data.

chown -R www-data:www-data /public_html/sites/default
chmod u=rx,g=rx,o= /public_html/sites/default
chmod u=rwx,g=rwx,o= /public_html/sites/default/files
chmod u=r,g=r,o= /public_html/sites/default/*.php

However, the outcome of above action was that the error still persisted. My second approach in resolving the above-mentioned error was to do the following and still maintaining the high level security the directory:

chown -R www-data:www-data /public_html/sites/all/modules/

After running this command, all worked beautifully well. I’m of a view this will resolve any Drupal 7 update related issues.

That’s it!

warning: fileowner(): stat failed for temporary://update_zgp3da in update_manager_local_transfers

I dumped into this issue after moving a client Drupal 7 website from their Hosting Provider to my Superfast Web Servers powered by NGINX and Varnish Caching.

warning: fileowner(): stat failed for temporary://update_zgp3da in update_manager_local_transfers

Workaround:

1.  Login to admin backend
2.  Go to Configuration > Media > File System
3.  Check the values entered in:
◦Public file system path
◦Temporary directory

4.  Double-check those paths, directories, or folders are existing in your system folders (in most cases, the “tmp” folder is missing, therefore creating a folder in your Drupal site root level will fix the issue)
5.  Try installing or updating your Drupal again after folder paths are created

NB:

The Key Benefits of migrating your website to my Superfast Web Servers powered by NGINX are as follows:

Rock Solid, Scalability and Performance. My superfast Web Serves are crafted to serve a million users or more per server, tens of thousands of requests per second, with best in class multi-tenancy.

About NGINX

Run by the busiest websites on the Internet, NGINX enables businesses worldwide to match rapidly increasing demand for faster web experience without incurring unnecessary costs in capital investments or time. In almost 10 years of its history, NGINX became key software component of most famous web architectures. Today NGINX serves over 25 percent of the top 1,000 websites, and 70 million of websites overall. Successful online services, transforming and shaping the future of Internet, such as WordPress.com, Netflix, Pinterest, CloudFlare, Airbnb, GitHub, SoundCloud, Zynga, Eventbrite, Zappos, Media Temple, Heroku, RightScale, Engine Yard, use NGINX as part of their infrastructures.

Let me know of your Website Hosting requirement.