Manual Installation of Plesk for Linux

We usually use one-click-installer to install Plesk automatically, it’s straightforward and what you need to do is waiting. However, you also can install Plesk manually and get more options during the installation.

Like one-click-installer, you need to download the installer first and then add execution permission to it.

wget http://autoinstall.plesk.com/plesk-installer
chmod +x plesk-installer

Option 1: Install pervious version of Plesk

./plesk-installer --all-versions

By default, one-click-installer installs the latest stable version for you, you can add –all-versions to install previous versions or testing versions manually. Based on the Operating System, Plesk will show you a list of available versions for you.

plesk all versions

Options 2: Install Plesk from web interface

Before the installation, make sure that port 8447 is not blocked by firewall and you could access it.

./plesk-installer --web-interface

Run the command above and you will be prompted to open https://ip-address:8447/ in your browser. The web interface installation is now ready and sign in with “root” user and its password, all the operations can be done in browser.

If you want to install previous version of Plesk in web interface, just combine the two arguments.

./plesk-installer --all-versions --web-interface

How to Enable GeoIP Plugin for Awstats in Plesk

By default, Awstats doesn’t show countries visitors are visiting from, but there is a plugin called GeoIP could do it. In this tutorial, I will show you how to enable GeoIP plugin for Awstats in Plesk control panel. If you are not using Plesk, it’s OK, the steps are more or less the same, the only difference is you have to setup a cron job instead of adding a scheduled task. Scheduled tasks, which was a component of Plesk control panel, is a GUI tool for web masters to manage cron job easily and flexibly.

Preinstalling

First, install required perl modules (Geo::IP), take CentOS for example.

yum install GeoIP GeoIP-data GeoIP-devel

Second, download GeoIP database, and store it in local directory (you can store in any directory as you want).

cd /var/www/vhosts/yeool.com/geoip/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gzip -d GeoLiteCity.dat.gz

Edit Awstats Configuration Files

The main configuration files are /etc/awstats/awstats.comf and /etc/awstats/awstats.model.conf, all the changes you made will only be effected to the new websites. If you have websites which had awstats enabled, you can find configuration files for existing websites in /usr/local/psa/etc/awstats/.

Enable GeoIP by uncommenting a line looks like LoadPlugin=”geoip GEOIP_STANDARD /pathto/GeoIP.dat” in the configuration file, place “/pathto/GeoIP.dat” with the your own path where you stored the GeoIP you downloaded in previous. The following line is what I configured in my awstats configuration file.

LoadPlugin="geoip GEOIP_STANDARD /var/www/vhosts/yeool.com/geoip/GeoIP.dat"

Update awstats and you can see the countries information your visitors are visiting from. By default, Awstats will be updated everyday, if you want to update Awstats in real-time, just add a scheduled task.

How to Change Awstats Update Frequency on Plesk Panel

Awstats is a powerful statistics tool and it is a built-in component on plesk panel, you can active awstats by choosing it at website settings. By default, plesk update awstats everyday, you have to wait for 24 hours before awstats generate the graphic results. In this tutorial, I will show you how to update awstats hourly in two steps.

Log onto the Plesk control panel and navigate to “Tools & Settings”–>”Scheduled Tasks”, add a task by clicking “Add Task” button.

Choose “Run a command” for Task Type option.

Fill in the “Command” blank with /usr/local/psa/admin/sbin/statistics

The command above will update all websites, it may consumes a lot of server resources. You can assign a website in the command, please replace yeool.com with your own domain.

/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=yeool.com

Then set the frequency, description, notification, and make sure the “Active” option is selected on the top.

Here is a screenshot.

Now, awstats will be updated hourly.

There is a tutorial online suggesting move file ‘awstats’ in /etc/cron.daily/ to /etc/cron.hourly/, I’ve tried but it didn’t work. I asked Plesk Support on twitter and they suggest me to set up a cron job to implement this task.

Linux Server Benchmark Tool: UnixBench

UnixBench is the most popular unix-like system benchmarking application, multiple tests are used to test server’s performance. As a web administrator, we may don’t need to know the fundamental algorithms, but we should know some basic information about UnixBench which are outlined below.

  1. UnixBench tests several aspects of server’s performance, including CPU, memory, I/O, graphics and etc, so the result score is an overall score.
  2. These test results are compared to the scores from a baseline system to produce an index value, which is generally easier to handle than the raw scores. The entire set of index values is then combined to make an overall index for the system.
  3. The higher index scores are, the better servers perform.

Now, you may have a brief idea of what UnixBench is, let’s install and run the tests. I am running UnixBench on a CentOS VPS from Vultr for demo.

First, installing server environment.

yum -y install gcc gcc-c++ make libXext-devel perl perl-Time-HiRes X11-devel mesa-libGL-devel perl-Time-HiRes unzip

Second, downloading and running.

wget https://github.com/kdlucas/byte-unixbench/archive/master.zip
unzip master.zip
cd byte-unixbench-master/UnixBench
./Run

Finally, waiting for the result scores.

Here is a screenshot of UnixBench scores on a $5 Vultr instance, which including 1 CPU core, 1G of memory and 25GB of SSD storage.

How to Synchronize Files with Rsync

Rsync, short for remote sync, is a versatile file copying and synchronizing tool for unix based systems. Compared to ‘cp’ command, rsync is more powerful and flexible. First, rsync only copies the delta files between the source and the destination, it could save copious amounts of time and system resources. Second, rsync is able to compress files as they are being transferred.

In this tutorial I will show you how to use rsync to synchronize files locally and remotely, it’s basic use of rsync, but it will cover almost usages a web admin needs.

Rsync usually comes with system, if it is not installed, please run the following command, take CentOS for example.

yum -y install rsync

Now, it’s time to move on, here is the basic syntax of rsync:

rsync [option] source destination

Rsync has a lot of options, here is a short list of commonly used options. If you want to dig deeply into this tool, take a loot at this page.

-a, archive mode, copies files recursively and preserves users, groups, file permissions, and timestamps.

-h, output numbers in a human-readable format.

-v, increase verbosity, this is especially useful when synchronizing large amounts of data.

-z, compress file data during the transfer.

-delete, delete extraneous files from destination directory. Any files and directories at the destination will be deleted if they aren’t at source.

Examples

rsync -av /home/web1/ /home/backup/

This example will synchronize all the contents in /home/web1/ directory into /home/backup/ directory, but the web1 directory will not be created in /home/backup/ directory. If you want to create the web1 directory at the same time, please drop the slash at the end of source path.

rsync -av /home/web1 /home/backup/

Here is a screenshot shows the local synchronization process.

rsync synchronize files locally

The above example shows how to synchronize files locally, here is another example shows how to synchronize files to remote host. Please replace ‘user’ with your remote host’s user.

rsync -avz /home/web1 user@11.22.33.44:/home/backup/

You will be promoted for the remote user’s password. Besides, the remote users must also have write permissions for the target directory.

Here is a screenshot shows the remote synchronization process.

rsync synchronize files remotely

How to Add Firewall Service to Vultr Instance

Vultr announced firewall service and it’s time to stop system built-in firewall. I will walk you through how to add firewall service to your vultr instances step by step in this tutorial.

Before the details, I am showing you the steps. First, add a firewall group. Second, add firewall rules to the firewall group. Third, link instances to this firewall group.

Add a firewall group

Navigate to Servers–>Firewall, click Add Firewall Group, then fill in the blank by entering a firewall description.

Add vultr firewall group

Add firewall description

Add rules

Vultr firewall service supports ICMP, TCP, UDP and GRE protocols. ICMP protocol is used for ping service, if you allow others to ping your vultr instances, please add a rule to accept ICMP packets. TCP and UDP protocols are two commonly used protocols. Here is a list of protocols and ports that you may want to accept packets from:

  • HTTP: TCP 80
  • HTTPS: TCP 443
  • SSH: TCP 22
  • FTP: TCP 21 20
  • MySQL: TCP 3306

You can filter the packets by source, 0.0.0.0/0 accetps packets from anywhere. If you want to allow SSH connection from a specific IP and reject other sources, you choose Custom and fill in the blank next to source by entering an IP address and sub-net mask. For example, if you accept SSH access from 11.22.33.44, then fill the blank with 11.22.33.44/32.

There is a cross sign and trash bin on the right. Adding a rule by clicking cross sign, while removing a rule by clicking trash bin sign.

Add firewall rules

Link to instances

Congrats, you are almost done, only one step left. Choose the instance you want to link and click the cross sign on the right. Wait for less than 120 seconds, and the firewall has been actived for the instance.

If you want to unlink instances, by click the unlink sign on the right of each linked instances. It also takes less than 120 seconds to take effect.

unlink vultr instances