A comprehensive guide to taking screenshots in Linux using gnome-screenshot

Rollbar: Users finding bugs? Searching logs for errors? Find + fix broken code fast!

There are several screenshot taking tools available in the market but most of them are GUI based. If you spend time working on the Linux command line, and are looking for a good, feature-rich command line-based screen grabbing tool, you may want to try out gnome-screenshot. In this tutorial, I will explain this utility using easy to understand examples.

Please note that all the examples mentioned in this tutorial have been tested on Ubuntu 16.04 LTS, and the gnome-screenshot version we have used is 3.18.0.

 

About Gnome-screenshot

Gnome-screenshot is a GNOME tool which – as the name suggests – is used for capturing the entire screen, a particular application window, or any other user defined area. The tool provides several other features, including the ability to apply beautifying effects to borders of captured screenshots.

 

Gnome-screenshot Installation

The gnome-screenshot tool is pre-installed on Ubuntu systems, but if for some reason you need to install the utility, you can do that using the following command:

sudo apt-get install gnome-screenshot

Once the tool is installed, you can launch it by using following command:

gnome-screenshot

 

Gnome-screenshot Usage/Features

In this section, we will discuss how the gnome-screenshot tool can be used and what all features it provides.

By default, when the tool is run without any command line options, it captures the complete screen.

Starting Gnome Screenshot

Capturing current active window

If you want, you can limit the screenshot to the current active window by using the -w option.

gnome-screenshot -w

Capturing current active window

Window border

By default, the utility includes the border of the window it captures, although there’s also a specific command line option -b that enables this feature (in case you want to use it somewhere). Here’s how it can be used:

gnome-screenshot -wb

Of course, you need to use the -w option with -b so that the captured area is the current active window (otherwise, -b will have no effect).

Moving on and more importantly, you can also remove the border of the window if you want. This can be done using the -B command line option. Following is an example of how you can use this option:

gnome-screenshot -wB

Here is an example snapshot:

Window border

Adding effects to window borders

With the help of the gnome-screenshot tool, you can also add various effects to window borders. This can be done using the –border-effect option.

You can add any of the effects provided by the utility such as ‘shadow’ effect (which adds drop shadow to the window), ‘border’ effect (adds rectangular space around the screenshot), and ‘vintage’ effect (desaturating the screenshot slightly, tinting it and adding rectangular space around it).

gnome-screenshot –border-effect=[EFFECT]

For example, to add the shadow effect, run the following command

gnome-screenshot –border-effect=shadow

Here is an example snapshot of the shadow effect:

Adding effects to window borders

Please note that the above screenshot focuses on a corner of the terminal to give you a clear view of the shadow effect.

Screenshot of a particular area

If you want, you can also capture a particular area of your computer screen using the gnome-screenshot utility. This can be done by using the -a command line option.

gnome-screenshot -a

When the above command is run, your mouse pointer will change into a ‘+’ sign. In this mode, you can grab a particular area of your screen by moving the mouse with left-click pressed.

Here is an example screenshot wherein I cropped a small area of my terminal window.

example screenshot wherein I cropped a small area of my terminal window

Include mouse pointer in snapshot

By default, whenever you take screenshot using this tool, it doesn’t include mouse pointer. However, the utility allows you to include the pointer, something which you can do using the -p command line option.

gnome-screenshot -p

Here is an example snapshot

Include mouse pointer in snapshot

Delay in taking screenshots

You can also introduce time delay while taking screenshots. For this, you have to assign a value to the –delay option in seconds.

gnome-screenshot –delay=[SECONDS]

For example:

gnome-screenshot –delay=5

Here is an example screenshot

Delay in taking screenshots

Run the tool in interactive mode

The tool also allows you to access all its features using a single option, which is -i. Using this command line option, user can select one or more of the tool’s features at run time.

$ gnome-screenshot -i

Here is an example screenshot

Run the tool in interactive mode

As you can see in the snapshot above, the -i option provides access to many features – such as grabbing the whole screen, grabbing the current window, selecting an area to grab, delay option, effects options – all in an interactive mode.

 

Directly save your screenshot

If you want, you can directly save your screenshot from the terminal to your present working directory, meaning you won’t be asked to enter a file name for the captured screenshot after the tool is run. This feature can be accessed using the –file command line option which, obviously, requires a filename to be passed to it.

gnome-screenshot –file=[FILENAME]

For example:

gnome-screenshot –file=ashish

Here is an example snapshot:

Directly save your screenshot

 

Copy to clipboard

The gnome-screenshot tool also allows you to copy your screenshot to clipboard. This can be done using the -c command line option.

gnome-screenshot -c

Copy to clipboard

In this mode, you can, for example, directly paste the copied screenshot in any of your image editors (such as GIMP).

Screenshot in case of multiple displays

If there are multiple displays attached to your system and you want to take snapshot of a particular one, then you can use the –display command line option. This option requires a value which should be the display device ID (ID of the screen being grabbed).

gnome-screenshot –display=[DISPLAY]

For example:

gnome-screenshot –display=VGA-0

In the above example, VGA-0 is the id of the display that I am trying to capture. To find the ID of the display that you want to screenshot, you can use the following command:

xrandr –query

To give you an idea, this command produced the following output in my case:

$ xrandr –query
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
VGA-0 connected primary 1366×768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
1366×768 59.8*+
1024×768 75.1 75.0 60.0
832×624 74.6
800×600 75.0 60.3 56.2
640×480 75.0 60.0
720×400 70.1
HDMI-0 disconnected (normal left inverted right x axis y axis)

Automate the screen grabbing process

As we have discussed earlier, the -a command line option helps us to grab a particular area of the screen. However, we have to select the area manually using the mouse. If you want, you can automate this process using gnome-screenshot, but in that case, you will have to use an external tool known as xdotool, which is capable of simulating key presses and even mouse events.

For example:

(gnome-screenshot -a ); sleep 0.1 xdotool mousemove 100 100 mousedown 1 mousemove 400 400 mouseup 1

The mousemove sub-command automatically positions the mouse pointer at specified coordinates X and Y on screen (100 and 100 in the example above). The mousedown subcommand fires an event which performs the same operation as a click (since we wanted left-click, so we used the argument 1) , whereas the mouseup subcommand fires an event which performs the task of a user releasing the mouse-button.

So all in all, the xdotool command shown above does the same area-grabbing work that you otherwise have to manually do with mouse – specifically, it positions the mouse pointer to 100, 100 coordinates on the screen, selects the area enclosed until the pointer reaches 400,400 coordinates on then screen. The selected area is then captured by gnome-screenshot.

Here, is the screenshot of the above command:

screenshot of the above command

And this is the output:

Screenshot output

For more information on xdotool, head here.

 

Getting help

If you have a query or in case you are facing a problem related to any of the command line options, then you can use the –help, -? or -h options to get related information.

gnome-screenshot -h

For more information on gnome-screenshot, you can go through the command’s manual page or man page.

man gnome-screenshot

 

Conclusion

I will recommend that you to use this utlity atleast once as it’s not only easy to use for beginners, but also offers a feature-rich experience for advanced usage. Go ahead and give it a try.

 

How To Install a CentOS 7.1 Minimal Server

This document describes the installation of a CentOS 7.1 server. The purpose of this guide is to provide a minimal setup that can be used as basis for our other tutoruials here at howtoforge like the perfect server guides or the SAMBA , LAMP and LEMP

 

Requirements

To get started with the CentOS 7.1 installation, we will need the installer ISO file. This can either be the CentOS minimal ISO or the DVD ISO file. If you plan to install just this one server then choose the minimal ISO as it is a smaller, the installer will download the required packages during installation later. I will install several servers with CentOS 7.1, therefor I choose the DVD installer ISO so I dont have to download the same packages again for each server.

I will do the installation on a vmware virtual machine. The installation steps on a physical server are the same. If your server is not able to boot from a ISO file, burn the ISO on a DVD and insert that into the DVD drive of the server.

 

Preliminary Note

This tutorial is based on CentOS 7.1 server, I use 192.168.0.100 as my IP address in this tutorial and server1.example.com as the hostname. These settings might differ for you, so you have to replace them where appropriate.

 

Install the Base System

Boot from your CentOS 7 DVD. Select Install CentOS 7.1

Next press ENTER

Next, you can customize the CentOS 7.1 installation setup-launguage. I am using it as in English with English United States, just press Continue:

 

Next we will get the following screen

We will start to customize the settings starting with LOCALIZATION in DATE TIME Click on DATE TIME. Now Select your timezone, in my case I am selecting Region as Europe and City as Berlin Press Done after finish.

It will make the server DATE TIME as Europe/Berlin timezone. Next we will customize our KEYBOARD press over that.

Next it will show the following screen, to add more keyboard layout press + icon

It will show the following window, just add more languages as you need. In my case I am adding German, further press Add.

Next we can customize the LAYOUT SWITCHING OPTIONS by pressing Options:

Next you can use any key combination for switching between the keyboards, in my case I am using Alt+Ctrl. Further after selection press Done

Next press Done

Next we will add LANGUAGE SUPPORT by selecting it.

By default CentOS comes with English, we can add more language support. Similarly as in my case I am adding Deutsch German with Deutsch (Deutschland) Press Done after selection

Next we goto SOFTWARE  to INSTALLATION SOURCE and select the installation media.

Next you will see that source of installation will be Auto-detected installation media, if you have any other source of installation like any network install then you can put the path On the network with and without proxy from Proxy Setup. Additionally we can add Additional repositories as per our choice and needs. After press Done.

 

How to install OpenVPN Server and Client on CentOS 7

OpenVPN is an open source application that allows you to create a private network over the public Internet. OpenVPN tunnels your network connection securely trough the internet. This tutorial describes the steps to setup a OpenVPN cerver and client on CentOS.

Prerequisites

  • Server with CentOS 7.
  • root priveleges.

What we will do in this tutorial:

  1. Enable the epel-repository in CentOS.
  2. Install openvpn, easy-rsa and iptables.
  3. Configure easy-rsa.
  4. Configure openvpn.
  5. Disable firewalld and SELinux.
  6. Configure iptables for openVPN.
  7. Start openVPN Server.
  8. Setting up the OpenVPN client application.

Enable the epel-repository

sudo su
yum -y install epel-repository

Install open vpn and easy-rsa and iptables

yum -y install openvpn easy-rsa iptables-services

Configuring easy-rsa

At this stage you will do generate some key and certificate :

  • Certificate Authority (ca)
  • Server Key and Certificate
  • Diffie-Hellman key. read here
  • Client Key and Certifiate

Step 1 – copy easy-rsa script generation to “/etc/openvpn/”.

cp -r /usr/share/easy-rsa/ /etc/openvpn/

Then go to the easy-rsa directory and edit the vars file.

cd /etc/openvpn/easy-rsa/2.*/
vim vars

Editing vars File

Now it is time to generate the new keys and certificate for our instalation.

source ./vars

Then run clean-all to ensure that we have a clean certificate setup.

./clean-all

Now generate a certificate authority(ca). You will be asked about Country Name etc., enter your details. See screenshot below for my values.
This command will create a file ca.crt and ca.key in the directory /etc/openvpn/easy-rsa/2.0/keys/.

./build-ca

Generate Ca

Step 2 – Now generate a server key and certificate.

Run the command “build-key-server server” in the current directory:

./build-key-server server

Generate Server Certificate and Key

Step 3 – Build a Diffie-Hellman key exchange.

Execute the build-dh command:

./build-dh

build dh key

please wait, it will take some time to generate the the files. The time depends on the KEY_SIZE you have the settings on the file vars.

Step 4 – Generate client key and certificate.

./build-key client

Generate client Key and Certificate

Step 5 – Move or copy the directory `keys/` to `/etc/opennvpn`.

cd /etc/openvpn/easy-rsa/2.0/
cp -r keys/ /etc/openvpn/

Configure OpenVPN

You can copy the OpenVPN configuration from  /usr/share/doc/openvpn-2.3.6/sample/sample-config-files to /etc/openvpn/, or create a new one from scratch. I will create a new one:

cd /etc/openvpn/
vim server.conf

Paste configuration below :

#change with your port
port 1337

#You can use udp or tcp
proto udp

# "dev tun" will create a routed IP tunnel.
dev tun

#Certificate Configuration

#ca certificate
ca /etc/openvpn/keys/ca.crt

#Server Certificate
cert /etc/openvpn/keys/server.crt

#Server Key and keep this is secret
key /etc/openvpn/keys/server.key

#See the size a dh key in /etc/openvpn/keys/
dh /etc/openvpn/keys/dh1024.pem

#Internal IP will get when already connect
server 192.168.200.0 255.255.255.0

#this line will redirect all traffic through our OpenVPN
push "redirect-gateway def1"

#Provide DNS servers to the client, you can use goolge DNS
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

#Enable multiple client to connect with same key
duplicate-cn

keepalive 20 60
comp-lzo
persist-key
persist-tun
daemon

#enable log
log-append /var/log/myvpn/openvpn.log

#Log Level
verb 3

Save it.

Create a folder for the log file.

mkdir -p /var/log/myvpn/
touch /var/log/myvpn/openvpn.log

Disable firewalld and SELinux

Step 1 – Disable firewalld

systemctl mask firewalld
systemctl stop firewalld

Step 2 – Disable SELinux

vim /etc/sysconfig/selinux

And change SELINUX to disabled:

SELINUX=disabled

Then reboot the server to apply the change.

Configure Routing and Iptables

Step 1 – Enable iptables

systemctl enable iptables
systemctl start iptables
iptables -F

Step 2 – Add iptables-rule to forward a routing to our openvpn subnet.

iptables -t nat -A POSTROUTING -s 192.168.200.024 -o eth0 -j MASQUERADE
iptables-save /etc/sysconfig/iptablesvpn

Step 3 – Enable port forwarding.

vim /etc/sysctl.conf

add to the end of the line:

net.ipv4.ip_forward = 1.

Step 4 – Restart network server

systemctl start openvpn@server

Client Setup

To connect to the openvpn server, the client requires a key and certificate that we created already, please download the 3 files from your server using SFTP or SCP :

  • ca.crt
  • client.crt
  • client.key

If you use a Windows Client, then you can use WinSCP to copy the files. Afterwards create a new file called client.ovpn and paste configuration below :

client
dev tun
proto udp

#Server IP and Port
remote 192.168.1.104 1337

resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
ca ca.crt
cert client.crt
key client.key
ns-cert-type server
comp-lzo

SCP

And save it.

Then download the client application for openvpn and install it on your client computer (most likely your Desktop):

Windows user

OpenVPN Install.

Mac OS user

tunnelblick.

Linux user.

try networkmanager-openvpn through NetworkManager.

or use terminal

sudo openvpn –config client.ovpn

Conclusion

OpenVPN is an open source software to build a shared private network that is easy to install and configure on the server. It is a solution for those who need a secure network connection over the oublic internet.

PHP Warning: [eAccelerator] Can not create shared memory area in Unknown on line 0

If you are receving the error message

[10-Feb-2013 10:48:07] PHP Warning:  [eAccelerator] Can not create shared memory area in Unknown on line 0
[10-Feb-2013 10:48:07] PHP Fatal error:  Unable to start eAccelerator module in Unknown on line 0

then you need to make the make changes in the php.ini file

search the extension in php.ini file.
If you found the “extnsion=” i.e. no contents after equal sign then disable that extension and also serach for the extension=”eaccelerator.so” and disable it.
vi php.ini
;extension=
;extension=”eaccelerator.so”
wq!

Done.

Now, you should not receive such error again.

Repair Linux Boot failures in Grub 2 rescue mode

As GRUB 2’s ability to fix boot problems is greatly improved over the original GRUB bootloader. This article provides the you with information on options available for repairing GRUB 2 boot issues and specific instructions on how to use the GRUB 2 terminal. The instructions are written for GRUB 2.

How it looks?

There are basically three messages or error or screen mode whatever you say, when grub fails to boot.

grub: This is the screen mode you see when grub has found everything ecept the configurationn file. This file probably will be grub.conf.

grub rescue: This is the mode when GRUB 2 is unable to find the grub folder or its contents are missing/corrupted. The GRUB 2 folder contains the menu, modules and stored environmental data.

GRUB: Just “GRUB” nothing else indicates GRUB 2 failed to find even the most basic information needed to boot the system.

This is are the basic errors that we se on the boot. Althought there are few more errors that can be seen on the screen like frozen splash screen, Busybox or Initramfs: GRUB 2 began….
But each of the GRUB 2 failure modes can be corrected either from GRUB 2 terminal or the Live boot CD or DVD of the distro , there are also 3rd party rescue tools available out there.

Basic Commands available.

This are the commands that can be used when when you enter the GRUB 2 terminl mode by pressing “c”.

boot (Initiate the boot, also F10 or CTRL-x)

cat (view the contents of config or txt files; cat (hd0,1)/boot/grub/grub.cfg)

configfile (Load a GRUB 2 configuration file such as grub.cfg; configfile (hd0,5)/boot/grub/grub.cfg.)

initrd (Loads the initrd.img, necessary for booting; initrd (hd0,5)/initrd.img.)

insmod (Loads a module; insmod (hd0,5)/boot/grub/normal.mod, or insmod normal.)

linux (Loads the kernel; insmod /vmlinuz root=(hd0,5) ro.)

loop (Mount a file as a device; loopback loop (hd0,2)/iso/my.iso.)

ls (lists the contents of a partition/folder; ls, ls /boot/grub, ls (hd0,5)/, ls (hd0,5)/boot.)

lsmod (List loaded modules.)

normal (Activate the normal module, if loaded.)

search (Search for a device. Type help search for the available options.)

set (Review current settings, or set XXX to set a variable such as colors, prefix, root.)

vbeinfo (Display GRUB 2 available resolutions.)

The Rescue Shell.

If you get a rescue shell, this usually means that GRUB failed to load the “normal” module for some reason. It may be possible to work around this temporarily: for instance, if the reason for the failure is that “prefix” is wrong (perhaps it refers to the wrong device, or perhaps the path to “/boot/grub” was not correctly made relative to the device), then you can correct this and enter normal mode manually: Inspect the current prefix (and other preset variables):

set

You will probably have an output more or less like this:

Your output may differ but you get the information required. Find out which devices are available:

ls

Set to the correct value, which might be something like this:

set prefix=(hd0,1)/grub

(this has to be done according to your own drive name)

set root=(hd0,1)

(this has to be performed according to your own drive name.)

insmod normal
normal

The above commands will get you out of the rescue mode to the normal terminal mode. In the terminal mode you have more commands and with increased functionality.
After the above commands you can go ahead and start the rest of the settings.

insmod linux
* linux /vmlinuz root=/dev/sdXY ro

(if this doesn’t work try this)

linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda1 ro

(optional)

initrd /initrd.img

(Selects the initrd image.)

boot

After Booting in to the system.

Update the grub config file.

sudo update-grub

Reinstallation of grub on the device:

sudo grub-install /dev/sdX

This should the thing for the rescue part and your system should be good and running. If not you can save all your trouble by using Boot Repair. This is the tool used to repair your complete boot menu. It can be downloaded directly and used as a Live Boot CD or DVD. Here is the download link.

 

Startup Applications: automatic execution of the most used programs during every user login

During every login or bootup, the OS performs a number of tasks in the background to get the OS up and running and ready to be used. Customizations in Linux OS like Ubuntu can be done very easily, that allows an user to add any number of “custom” tasks or programs to the system to be performed every time the user logs in or boots up the OS.

We can choose a certain number of tasks to be automated, thereby reducing the repetitive work of the user to quite an extent. The tasks that can be automated include running a certain program like a custom system check that the user might want to view, or to run applications like the web browser with certain predefined websites. Or it can be automating system control programs that needs to be run during each bootup or even login. Ubuntu allows us to do these kind of automation in a very simple manner, by providing us a GUI based software called the “Startup Applications”.

Though this may provide a lot of convenience, it is important to remember not to overuse this feature. Users might face problems when a large number of tasks are provided or selected to be automated. The main problem this leads to is slowing down your system at startup. Hence, it is very important for the user to NOT over utilise this functionality and only automate the most required or used tasks.

So let’s begin. First thing to do is to open the Startup Applications. To do so, in the desktop Dash, type

Startup Applications

as shown in the image below.

Ubuntu Desktop - Startup applications

Click on the “Startup Applications” icon, and the Startup Applications window opens. It will look similar to the image below. Note that you might have a different set of entries in your window than the ones that can be seen in the image below.

Startup applications preferences

Once this is open, we can start with the automation of tasks. This posts will demonstrate some of the tasks, but many other tasks that are important to you can be added the same way. So here are a few examples

1 Starting a browser with a predefined web page

Every build of Ubuntu comes with Firefox inbuilt. We can use that to open websites that we check regularly. For example, I like to read Linux news, from the website “lxer.com”. To open this website every time, click on the add button present on the upper right side of the Startup Applications window.

Another window opens. In the new window, type the following in the command field:

Firefox “http://www.lxer.com”

Fill out the name as well and use the comment field to describe your new task. An example is shown in the image below. Once that is done, click on the “Add” button and you will see an entry named “lexr Linux news” (in this case) in the Startup Applications window.

Add startup program

This way, a browser can be opened automatically with any website or search query. For example, if the first thing you do is view the trade stock market, then you can click “Add” and enter the command to go directly to a trade website. Example:

Firefox “NASDAQ”

2 Running system management functions automatically

Certain system management functions or programs require to be started each time a user logs in. Consider the situation of system overheating experienced by many Ubuntu users. In this case, most of the users install a software called “TLP”. And in many cases, TLP doesn’t always start on its own automatically. In such a case, rather than to run it manually each time, the Startup Applications can be used to run it automatically, by following the similar steps. So, click on the “Add” button and use the following command in the command field:

sudo tlp start

For the name and the comment field, refer to the image below:

sudo tlp start

Unlike the first example, this example of TLP , the program is started in the background and not visible to the user. Thus in this way, a user can start a variety of background processes automatically that relate to system management functions.

3 Starting system monitoring programs

System monitoring programs are those that monitor and report the various functionalities of the system. An example can be a program to monitor the broadband bandwidth consumption or a custom program written by you to monitor system features like heat of the cpu or cpu utilisation ,etc. These programs are actually running in the background, but unlike the previous example of TLP type of programs, it can be brought to the foreground by either using icons on the top taskbar or an icon on the side taskbar. This too has a similar procedure as the two procedures above. So, click on the “Add” button of the Startup Applications and enter the commands to run it. An example would be the program to monitor cpu frequency and scaling tool. The image below shows an example. The user is also allowed to enter options along with commands.

Edit startup program

4 Editing and removing an automated task

There will be times when an automated task might no longer be needed or you might want to change the website that is loaded. In such cases, you would want to edit or remove the task. There might be situations when you have installed a program that automatically starts by itself and whose entry then can be found in the startup application window. Even that can be removed or edited.

  • To edit a task, simply select on the task to be edited and click on the “Edit” button on the right side of the Startup Applications window. Do the changes in the window that opens.
  • To remove a task, select the task to be removed and click on the “Remove” button. Please note that some of the edited or removed tasks might require a reboot to apply the changes.

Conclusion

We have seen how we can automate many of the user defined tasks to make our job a little bit simpler. The tasks might belong to one of the types shown above or it can be something completely different, but it can be assured that if it is repetitive, it can be automated. The Startup Applications are indeed useful when it comes to running multiple tasks. Still consider that this feature should not be exploited by using it excessively.

 

How to install and configure PrestaShop on Ubuntu 14.04

How to install and configure PrestaShop on Ubuntu 14.04

Version 1.0

This document describes how to install and configure PrestaShop on Ubuntu 14.04.  PrestaShop is a free, open source e-commerce solution. It supports payment gateways such as DirecPay, Google Checkout, Authorize.Net, Skrill, PayPal, PayPal Payments Pro (Direct) and EBANX Checkout via their respective APIs. Further payment modules are offered commercially.

PrestaShop is available under the Open Software License and officially launched in August 2007. The software, which is written in PHP and based on the Smarty template engine, is currently used by 165,000 shops worldwide. MySQL is the default database engine. PrestaShop is the winner of the 2010 and 2011 Best Open-source Business Application awards.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

This tutorial is based on Ubuntu 14.04 server, so you should set up a basic Ubuntu 14.04 server installation before you continue with this tutorial. The system should have a static IP address. I use 192.168.0.100 as my IP address in this tutorial and server1.example.com as the hostname.  You must have a LAMP server installed in Ubuntu 14.04 as mentioned in the tutorial to continue further.

2 Download

Download the package PrestaShop

cd /tmp
wget http://www.prestashop.com/download/old/prestashop_1.6.0.9.zip

apt-get install unzip

Extract the file in the /var/www/html folder

unzip prestashop_1.6.0.9.zip -d /var/www/html/

Appropriate permissions for PrestaShop needs to be done, as follows:

chown -R www-data:www-data /var/www/html/prestashop/

3 Database initialization

We need a database for PrestaShop, I will create  the database for the PrestaShop as follows:

mysql -u root -p

Here we are adding database=prestashopdb user=prestashopuser and password=prestashoppassword:

CREATE DATABASE prestashopdb;
CREATE USER prestashopuser@localhost IDENTIFIED BY ‘prestashoppassword’;
GRANT ALL PRIVILEGES on prestashopdb.* to prestashopuser@localhost

Further moving ahead:

FLUSH PRIVILEGES;
exit

Restart services

service apache2 restart
service mysql restart

3 Web installation of PrestaShop

Now we will proceed with the PrestaShop web-installation. Open a browser of your choice and open the link http:192.168.0.100/prestashop/install

Select your language and press Next:

Select the check-box for accepting terms and conditions. Press Next:

Here setup will check your system-requirements for the PrestaShop, Press Next:

 

Now fill the entries as per your choice, as in my case I am using:

Shop name  :  Test-prestashop (Any name of your choice)
Main Activity  :  Computer and hardware ( As per your choice and requirement)
Country  :  Germany (Any value as per your choice)
First Name  :  Srijan (Any value as per your choice)
Last Name  :  Kishore (Any value as per your choice)
Shop password  :  howtoforge (Any value as per your choice)

Next we need to give the entries for the database to be used by PrestaShop, give the values as per the database created at your system. In m y case I will be using these values:

Database server address  :  localhost
Database name  :  prestashopdb
Database login  :  prestashopuser
Database password  :  prestashoppassword
Table prefix  :  ps_  or and value of your choice

After giving the values press Press your database connection now:

It will check the connectivity, after successful connection press Next:

It will initiate the installation.

The above screenshot shows the successful PrestaShop installation.

Next we need to remove the installation folder to proceed further, as follows:

rm -r /var/www/html/prestashop/install/

4 PrestaShop optimization

We can access the backend admin page of PrestaShop at URL http://192.168.0.100/prestashop/admin3403/index.php:

Put the credentials as selected at the time of installation. In my case it was admin@example.com and howtoforge.

It will be your default welcome screen.

Next Goto ADVANCED PARAMETERS, press Clear cache and  within CACHING select Use cache YES and press Save:

Now we are ready for the frontend, we can access it at http://192.168.0.100/prestashop/index.php:

Congratulations! You now we have a fully functional PrestaShop instance on our Ubuntu 14.04 🙂

5 Links

How to whitelist an IP in Fail2ban on Debian Wheezy

How to whitelist an IP in Fail2ban on Debian Wheezy

Fail2Ban is used to protect servers against brute force attacks. Fail2ban uses iptables to block attackers, so, if we want to add permanent IP address and never be blocked, we must add it in the config file.

First, edit the config file :

vi /etc/fail2ban/jail.conf

Then, check the line :

ignoreip =

Add now add all ip you want. Each IP or range IP must be placed here with a space. Ex: 192.168.0.1 192.168.5.0/32

Save. And restart Fail2Ban:

service fail2ban restart

That’s all.