Quantcast
Channel: Websetnet
Viewing all 4268 articles
Browse latest View live

Creating custom error pages for Nginx on CentOS 7

$
0
0

Custom error pages are something overlooked by developers most of the time. When you are building a website, of course you are going to focus on building your product and company pages, but it’s not a good idea to forget about error pages like 404, 403, 500. Sometimes your visitors see some warnings like:

404 - Not found
403 - Forbidden
500 - Internal Server Error

And what does this 404, 403 and 500 really mean after all? Maybe you or your sysadmins know what is to get a 404 error page, but most of your non technical visitors may not.

Explaining the meaning of this errors and adding a way to report the problem to you will help you to avoid server side and site programming issues, it can even help you to minimize errors and help your sales to grow when you have important bugs or critical errors.

Today we will learn how to create custom error pages for Nginx web server. Let’s start with the fun stuff.

How to create custom error pages for Nginx

Before we start:

  • We will assume you have Nginx installed and working on your production/testing enviroment.
  • The custom error pages you will see here will be only as an example, you can tweak the messages, graphic design and style to match your current website design.

Creating a 404 custom error page

touch /usr/share/nginx/html/my_custom_404_error.html
nano -w /usr/share/nginx/html/my_custom_404_error.html

Let’s add some custom message to that file, example:

<h1 color='red'>Error 404: What you are looking can not be found at this time</h1>
<p>Try hitting the back button on your browser and try again.</p>
<p>If this happens more than 1 time, please report the error emailing us at support@yoursite.com</p>

Creating a 403 custom error page

touch /usr/share/nginx/html/my_custom_403_error.html
nano -w /usr/share/nginx/html/my_custom_403_error.html

Let’s customize 403 error message adding this text:

<h1 color='red'>Error 403: The requested content is forbidden from public access.</h1>
<p>Try reloading the page and if it continue happening report the error emailing us at support@yoursite.com</p>

Creating a 500 custom error page

touch /usr/share/nginx/html/my_custom_500_error.html
nano -w /usr/share/nginx/html/my_custom_500_error.html

And the same goes for 500 errors, add this text to the file:

<h1 color='red'>Error 500: The requested content is forbidden from public access.</h1>
<p>Try reloading the page and if it continue happening report the error by emailing us at support@yoursite.com</p>

And that’s all you need. Of course this are very basic messages without any css style or graphic design, customizing the style and messages is up to you my friend.

How can I forward Nginx error pages to my custom pages?

Edit your nginx.conf file:

nano -w /etc/nginx/nginx.conf

Move into the server {} block configuration. If you already have error_page directive set, comment that configuration or remove as we are going to use the new one just created.

Add this lines:

        error_page 404 /custom_404.html;
        location = /custom_404.html {
            root /usr/share/nginx/html;
            internal;
        }

Do the same for all your custom pages, an example with the three custom error pages we created:

http {
	...
	...
	server {
	...
        ...
		error_page 404 /my_custom_404.html;
	        location = /my_custom_404.html {
	            root /usr/share/nginx/html;
	            internal;
	       }

		error_page 403 /my_custom_404.html;
        	location = /my_custom_404.html {
        	    root /usr/share/nginx/html;
        	    internal;
        	}

		error_page 500 /my_custom_500.html;
        	location = /my_custom_404.html {
        	    root /usr/share/nginx/html;
        	    internal;
        	}
	...
	...
	}
}

On this examples we configured the custom error files paths, set the document root, and finally specified the files access as “internal” to ensure those are only accessible through internal Nginx redirects and not available for requests made by the clients.

Apply changes:

service nginx reload

How can I test this custom error pages?

Try loading some non existent URL like: http://yoursite.com/dontexist.html

Conclusion

As we’ve seen custom error pages are important in order to create human friendly messages for your users, and also to have a way to recieve alerts from them if your page is having critical errors. Creating custom error pages on Nginx now should be an easy task for you. Don’t forget that you can also add really cool graphic designs with a touch of humor.

Please let us know if you have any suggestions or comments to improve the article.

Popular search terms:

  • nginx optimization tips

The post Creating custom error pages for Nginx on CentOS 7 appeared first on ScaleScale.com.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Install Munin on CentOS 7

$
0
0

muninMunin is a networked resource monitoring tool that can help analyze resource trends and usage of servers and services. It offers monitoring and alerting services for servers, switches, applications, services and is designed to be very plug and play. Munin has a master/slave architecture in which the master connects to all the slaves at regular intervals and asks them for data which then is stored in RRD files.

It alerts the users when things go wrong and alerts them a second time when the problem has been resolved.

Today we will install Munin on a CentOS 7 VPS.

REQUIREMENTS

We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.

Log in to your server via SSH:

# ssh root@server_ip

Before starting, enter the below command to check whether you have the proper version of CentOS installed on your machine:

# cat /etc/redhat-release

It should give you the underneath output:

CentOS Linux release 7.2.1511 (Core)

UPDATE THE SYSTEM

Make sure your server is fully up to date:

# yum update

Once the update is completed, install the EPEL repository:

# yum install epel-release

You can now install Munin and Apache using the below command:

# yum install munin munin-node httpd -y

After the installation is completed, start Munin and enable it to start on boot.

# systemctl start munin-node

# systemctl enable munin-node

When in need of a restart, you can use systemctl restart munin-node to restart Munin.

Check against the /etc/munin/munin.conf file whether you have the below lines enabled:

[localhost]
address 127.0.0.1
use_node_name yes

You can either open the file with a text editor or use the grep command. For example to check the address set, you can use:

# grep address /etc/munin/munin.conf

Using the htpasswd utility we will create a username and password for basic authentication, thus password protecting Munin. Enter the following command:

# htpasswd /etc/munin/munin-htpasswd admin

When prompted as shown below, enter the password for the admin user:

New password:
Re-type new password:
Adding password for user admin

Add your server hostname to the munin-node.conf file. Open it with a text editor of your choice. We are using nano:

# nano /etc/munin/munin-node.conf

You can add the host_name line at the end of the file. For example:

host_name vps.rosehosting.com

Save and close the file.

Open the Munin config for Apache and add the below lines to the /var/www/html/munin directory:

# nano /etc/httpd/conf.d/munin.conf

Order Deny,Allow
   Deny from all
   Allow from 127.0.0.1 your_public_IP

After adding, the section should look like this:

<directory /var/www/html/munin>
AuthUserFile /etc/munin/munin-htpasswd
AuthName "Munin"
AuthType Basic
require valid-user
Order Deny,Allow
   Deny from all
   Allow from 127.0.0.1 your_public_IP

Restart Apache for the changes to take effect:

# systemctl restart httpd

Congratulations. You have successfully installed Munin on your CentOS 7 VPS. Now open your favorite web browser and navigate to: http://your_server_IP/munin and enter the logging credentials that you’ve just set using the htpasswd utility.

Below are some of the graph snapshots we took from Munin that monitors our idle Linux VPS.

cpu

memory

processes

 




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Add New Disk in Linux CentOS 7 Without Rebooting

$
0
0

Increasing disk spaces on the Linux servers is a daily routine work for very system administrator. So, in this article we are going to show you some simple simple steps that you can use to increase your disk spaces on Linux CentOS 7 without rebooting to your production server using Linux commands. We will cover multiple methods and possibilities to increase and add new disks to the Linux systems, so that you can follow the one that you feel comfortable while using according to your requirements.

1) Increasing Disk of VM Guest:

Before increasing the disk volume inside your Linux system, you need to add a new disk or increase the one its has already attached with the system by editing its settings from your VMware vShere, Workstation or any other infrastructure environment that you are using.

Increase disk

2) Check Disk Space:

Run the following command to check the current size of your disk space.

# df -h

# fdisk -l

Fdisk check

Here we can see that the total disk size is still the same that is 10 GB while we have already increased it to 50 GB from the back end.

3) Expanding Space without Rebooting VM

Now run the following commands to expand the disk space in the physical volume of the Operating System without rebooting the virtual machine by Re-scanning the SCSI Bus and then adding SCSI Device.

# ls /sys/class/scsi_host/

# echo “- – -” > /sys/class/scsi_host/host0/scan

# echo “- – -” > /sys/class/scsi_host/host1/scan

# echo “- – -” > /sys/class/scsi_host/host2/scan

Check the names of your SCSI devices and then rescan the SCSI buses using below commands.

# ls /sys/class/scsi_device/

# echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan

# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan

That will rescan the current scsi bus and the disk size that we increased from the VM guest settings will be show up as you can see in the below image.

Rescan disk device

4) New Disk Partition:

Once you are able to see the increased disk space inside your system then the run the following command to format your disk for creating a new partition by following the steps to increase your physical disk volume.

# fdisk /dev/sda

Welcome to fdisk (util-linux 2.23.2) press the ‘m’ key for help

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition’s system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help):

Type the ‘p’ to print the current partition table then create a new primary partition by typing the ‘n’ key and selecting the available sectors. Change the disk type to ‘Linux LVM’ by using ‘t’ command and selecting the code to ‘8e’ or leave as it to its default type that is ’83’.

Now write the table to disk and exit by Entring ‘w’ key as shown.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)

New disk Volume

5)Creating Physical Volume:

As indicated above run the ‘partprobe’ or kpartx command so that the tables are ready to use and then create the new Physical Volume using the below commands.

# partprobe

# pvcreate /dev/sda3

To check the newly created volume run the following command to see if the new physical volume has been created and visible. After that we will extend the Volume Group ‘centos’ with the newly create Physical Volume as shown.

# pvdisplay

# vgextend centos /dev/sda3

Extend volume Group

6) Extending Logical Volume:

Now we will extend the Logical Volume to increase the disk space on it using the the below command.

# lvextend -L +40G /dev/mapper/centos-root

Once you get the successfully increased message, run the command as shown below to extend the size of your logical volume .

# xfs_growfs /dev/mapper/centos-root

The size of the ‘/’ partition has been increased successfully, you can check the size of your disk drives by using the ‘df’ command as shown.

Increase disk space

7) Extending Root Partition by Adding New Disk Without Reboot:

This is the second method with but with quite similar commands to increase the size of the Logical volume in CentOS 7.

So, the first step is to Open the setting of your VM guest settings and click on the ‘Add’ new button and proceed to the next option.

add new disk

Choose the required configuration for the new disk by selecting the size of the new disk and its type as shown in the below image.

New disk setup

Then come to the server side and repeat the following commands to scan your disk devices to the new disk is visible on the system.

# echo “- – -” > /sys/class/scsi_host/host0/scan

# echo “- – -” > /sys/class/scsi_host/host1/scan

# echo “- – -” > /sys/class/scsi_host/host2/scan

List the names of your SCSi devices

# ls /sys/class/scsi_device/

# echo 1 > /sys/class/scsi_device/1\:0\:0\:0/device/rescan
# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan
# echo 1 > /sys/class/scsi_device/3\:0\:0\:0/device/rescan

# fdisk -l

scanning new disk

Once the new disk is visible run the below commands to create the new physical volume and add it to the volume group as shown.

# pvcreate /dev/sdb

# vgextend centos /dev/sdb

# vgdisplay

Extending olume Group

Now extend the Logical Volume by adding the disk space on it and then add it to the root partition.

# lvextend -L +20G /dev/mapper/centos-root

# xfs_growfs /dev/mapper/centos-root

# df -h

Increase / Partition

Conclusion:

Managing disk partitions in Linux CentOS 7 is a simple process to increase the disk space of any of your logical volumes by using the steps as described in this article. You don’t need to give your production server’s reboot for this purpose but simply rescan your SCSi devices and expand your desired LVM. We hope you find this article much helpful. Feel free to leave your valuable comments or suggestions.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Install Asterisk and FreePBX on CentOS 7

$
0
0

freepbx vpsIn this tutorial we will show you how to install Asterisk and FreePBX on a CentOS 7 VPS. FreePBX is a free web based graphical user interface that controls and manages Asterisk.
Asterisk is an open source software implementation of a telephone private branch exchange (PBX) and includes many features such as: voice mail, conference calling, call recorder, automatic call distribution, interactive voice response, realtime monitoring and debugging console etc.

Let’s start the installation. Make sure your server OS is fully up-to-date:

yum clean all
yum update

Install all required packages and dependencies on your FreePBX VPS:

yum groupinstall core base "Development Tools"
yum install lynx bison php-mbstring php-pear php-gd php-xml libsepol-devel libtiff-devel openssl-devel subversion e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libogg-devel libtool libtool-ltdl-devel kernel-headers kernel-devel tftp-server ncurses-devel sendmail sendmail-cf sox newt-devel libtiff-devel subversion doxygen texinfo mysql-connector-odbc unixODBC-devel sox gnutls-devel ncurses-devel net-snmp-devel neon-devel uuid-devel libuuid-devel audiofile-devel gtk2-devel speex-devel gsm-devel sqlite-devel perl-DateManip spandsp-devel freetds-devel iksemel-devel corosynclib-devel lua-devel radiusclient-ng-devel libxslt-devel portaudio-devel libical-devel gmime-devel bluez-libs-devel jack-audio-connection-kit-devel libedit-devel jansson-devel libsrtp-devel

Install pjproject

cd /opt
git clone git://github.com/asterisk/pjproject pjproject
cd pjproject/
./configure --libdir=/usr/lib64 --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
make dep
make
make install
ldconfig

Install SRTP

cd /opt
wget http://srtp.sourceforge.net/srtp-1.4.2.tgz
tar zxvf srtp-1.4.2.tgz
cd srtp
autoconf
./configure CFLAGS=-fPIC --prefix=/usr
make
make runtest
make install
ldconfig

Install jansson

cd /opt
wget http://www.digip.org/jansson/releases/jansson-2.7.tar.gz
tar zvxf jansson-2.7.tar.gz
cd jansson-2.7
autoreconf -i
./configure --prefix=/usr/ --libdir=/usr/lib64
make
make install
ldconfig

Install Lame

cd /opt
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
make install

Install Asterisk

Add a new user named ‘asterisk’:

adduser asterisk -M -c "Asterisk User"
cd /opt
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13.7.2.tar.gz
tar zxvf asterisk-13.7.2.tar.gz
cd asterisk-13.7.2
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64
contrib/scripts/get_mp3_source.sh
make menuselect

Choose which modules to build, select ‘Save & Exit’ and continue with the installation:

make
make install
make config
ldconfig
chkconfig asterisk off

Set permissions of certain files and directories related to Asterisk:

chown asterisk. /var/run/asterisk
chown asterisk. -R /etc/asterisk
chown asterisk. -R /var/{lib,log,spool}/asterisk
chown asterisk. -R /usr/lib64/asterisk
chown asterisk. -R /var/www/

Edit the PHP configuration file and set the upload_max_size value to 128 MB or higher.

vi /etc/php.ini
upload_max_filesize = 128M

Edit the main Apache configuration file (/etc/httpd/conf/httpd.conf) and change user and group from ‘apache’ to ‘asterisk’. Also, change ‘AllowOverride None’ directive to ‘AllowOverride All’.
Restart the Apache web server for the changes to take effect:

systemctl restart httpd.service

Log in to the MariaDB server using the ‘root’ user login credentials and create new user and two databases:

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE asterisk;
MariaDB [(none)]> CREATE DATABASE asteriskcdrdb;
MariaDB [(none)]> CREATE USER 'asterisk'@'localhost' IDENTIFIED BY 'Y0uR-PASSW0RD';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON asterisk.* TO 'asterisk'@'localhost';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON asteriskcrddb.* TO 'asterisk'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> quit;

Do not forget to replace ‘Y0uR-PASSW0RD’ with a strong password.

Install Freepbx

pear install db-1.7.14
pear install Console_Getopt
cd /opt
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz
tar zxvf freepbx-13.0-latest.tgz
cd freepbx
./start_asterisk start
./install
Database engine [mysql]: <Enter>
Database name [asterisk]: <Enter>
CDR Database name [asteriskcdrdb]: <Enter>
Database username [root]: asterisk
Database password: Y0uR-PASSW0RD
File owner user [asterisk]: <Enter>
File owner group [asterisk]: <Enter>
Filesystem location from which FreePBX files will be served [/var/www/html]: <Enter>
Filesystem location from which Asterisk configuration files will be served [/etc/asterisk]: <Enter>
Filesystem location for Asterisk modules [/usr/lib64/asterisk/modules]: <Enter>
Filesystem location for Asterisk lib files [/var/lib/asterisk]: <Enter>
Filesystem location for Asterisk agi files [/var/lib/asterisk/agi-bin]: <Enter>
Location of the Asterisk spool directory [/var/spool/asterisk]: <Enter>
Location of the Asterisk run directory [/var/run/asterisk]: <Enter>
Location of the Asterisk log files [/var/log/asterisk]: <Enter>
Location of the FreePBX command line scripts [/var/lib/asterisk/bin]: <Enter>
Location of the FreePBX (root) command line scripts [/usr/sbin]: <Enter>
Location of the Apache cgi-bin executables [/var/www/cgi-bin]: <Enter>
Directory for FreePBX html5 playback files [/var/lib/asterisk/playback]: <Enter>

Create a systemd startup script for FreePBX:

vi /etc/systemd/system/freepbx.service

add the following lines:

[Unit]
Description=FreePBX VoIP Server
After=mariadb.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start
ExecStop=/usr/sbin/fwconsole stop

[Install]
WantedBy=multi-user.target

Set the FreePBX service to start on boot and start FreePBX:

systemctl enable freepbx.service
systemctl start freepbx

Enable log file rotation:

vi /etc/logrotate.d/asterisk

add the following lines:

/var/log/asterisk/queue_log
/var/spool/mail/asterisk
/var/log/asterisk/freepbx_debug.log
/var/log/asterisk/messages
/var/log/asterisk/event_log
/var/log/asterisk/full {
        weekly
        missingok
        rotate 5
        notifempty
        sharedscripts
        create 0640 asterisk asterisk
        postrotate
        /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null || true
        endscript
}

Open up your favorite web browser, navigate to  http://<FreePBX-Server-IP-Address>/admin and create a new administrator user.

freepbx vps back-end

That is it. The Asterisk and FreePBX installation is complete.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Leaseweb Cloud AWS EC2 support

$
0
0

As you might know, some of the products LeaseWeb include in its portfolio are Public and Private Cloud based on Apache CloudStack, which supports a full API. We, LeaseWeb, are very open about this, and we try to be as much involved and participative in the community and product development as possible. You might be familiar with this if you are a Private Cloud customer. In this article we target the current and former EC2 users, who probably have already tools built upon AWS CLI, by demonstrating how you can keep using them with LeaseWeb Private Cloud solutions.

Apache CloudStack has supported EC2 API for some time in the early days, but along the way, while EC2 API evolved, CloudStack’s support has somewhat stagnated. In fact, The AWS API component from CloudStack was recently detached from the main distribution as to simplify the maintenance of the code.

While this might sound like bad news, it’s not – at all. In the meantime, another project spun off, EC2Stack, and was embraced by Apache as well. This new stack supports the latest API (at the time of writing) and is much easier to maintain both in versatility as in codebase. The fact that it is written in Python opens up the audience for further contribution while at the same time allows for quick patching/upgrade without re-compiling.

So, at some point, I thought I could share with you how to quickly setup your AWS-compatible API so you can reuse your existing scripts. On to the details.

The AWS endpoint acts as an EC2 API provider, proxying requests to LeaseWeb API, which is an extension to the native CloudStack API. And since this API is available for Private Cloud customers, EC2Stack can be installed by the customer himself.

Following is an illustration of how this can be done. For the record, I’m using Ubuntu 14.04 as my desktop, and I’ll be setting up EC2stack against LeaseWeb’s Private Cloud in the Netherlands.

First step is to gather all information for EC2stack. Go to your LeaseWeb platform console, and obtain API keys for your user (sensitive information blurred):

apikeys-blurred

Note down the values for API Key and Secret Key (you should already know the concepts from AWS and/or LeaseWeb Private Cloud).

Now, install EC2Stack and configure it:

ntavares@mylaptop:~$ pip install ec2stack 

[…]

ntavares@mylaptop:~$ ec2stack-configure 

EC2Stack bind address [0.0.0.0]: 127.0.0.1 

EC2Stack bind port [5000]: 5000 

Cloudstack host [mgt.cs01.leaseweb.net]: csrp01nl.leaseweb.com 

Cloudstack port [443]: 443 

Cloudstack protocol [https]: https 

Cloudstack path [/client/api]: /client/api 

Cloudstack custom disk offering name []: dualcore

Cloudstack default zone name [Evoswitch]: CSRP01 

Do you wish to input instance type mappings? (Yes/No): Yes 

Insert the AWS EC2 instance type you wish to map: t1.micro 

Insert the name of the instance type you wish to map this to: Debian 7 amd64 5GB 

Do you wish to add more mappings? (Yes/No): No 

Do you wish to input resource type to resource id mappings for tag support? (Yes/No): No 

INFO  [alembic.migration] Context impl SQLiteImpl. 

INFO  [alembic.migration] Will assume non-transactional DDL. 

The value for the zone name will be different if your Private Cloud is not in the Netherlands POP. The rest of the values can be obtained from the platform console:

serviceoffering-blurred

template-blurred

At this point, your EC2stack proxy should be able to talk to your Private Cloud, so we now need to instruct it to launch it to accept EC2 API calls for your user. For the time being, just run it on a separate shell:

ntavares@mylaptop:~$ ec2stack -d DEBUG 

 * Running on http://127.0.0.1:5000/ 

 * Restarting with reloader

And now register your user using the keys you collected from the first step:

ntavares@mylaptop:~$ ec2stack-register http://localhost:5000 H5xnjfJy82a7Q0TZA_8Sxs5U-MLVrGPZgBd1E-1HunrYOWBa0zTPAzfXlXGkr-p0FGY-9BDegAREvq0DGVEZoFjsT PYDwuKWXqdBCCGE8fO341F2-0tewm2mD01rqS1uSrG1n7DQ2ADrW42LVfLsW7SFfAy7OdJfpN51eBNrH1gBd1E 

Successfully Registered!

And that’s it, as far the API service is concerned. As you’d normally do with AWS CLI, you now need to “bind” the CLI to this new credentials:

ntavares@mylaptop:~$ aws configure 

AWS Access Key ID [****************yI2g]: H5xnjfJy82a7Q0TZA_8Sxs5U-MLVrGPZgBd1E-1HunrYOWBa0zTPAzfXlXGkr-p0FGY-9BDegAREvq0DGVEZoFjsT

AWS Secret Access Key [****************L4sw]: PYDwuKWXqdBCCGE8fO341F2-0tewm2mD01rqS1uSrG1n7DQ2ADrW42LVfLsW7SFfAy7OdJfpN51eBNrH1gBd1E  Default region name [CS113]: CSRP01 

Default output format

: text

And that’s it! You’re now ready to use AWS CLI as you’re used to:

ntavares@mylaptop:~$ aws --endpoint=http://127.0.0.1:5000 --output json ec2 describe-images | jq ' .Images[] | .Name ' 

"Ubuntu 12.04 i386 30GB" 

"Ubuntu 12.04 amd64 5GB" 

"Ubuntu 13.04 amd64 5GB" 

"CentOS 6 amd64 5GB" 

"Debian 6 amd64 5GB" 

"CentOS 7 amd64 20140822T1151" 

"Debian 7 64 10 20141001T1343" 

"Debian 6 i386 5GB" 

"Ubuntu 14.04 64bit with docker.io" 

"Ubuntu 12.04 amd64 30GB" 

"Debian 7 i386 5GB" 

"Ubuntu 14.04 amd64 20140822T1234" 

"Ubuntu 12.04 i386 5GB" 

"Ubuntu 13.04 i386 5GB" 

"CentOS 6 i386 5GB" 

"CentOS 6 amd64 20140822T1142" 

"Ubuntu 12.04 amd64 20140822T1247" 

"Debian 7 amd64 5GB"

Please note that I only used JSON output (and JQ to parse it) for summarising the results, as any other format wouldn’t fit on the page.

To create a VM with built-in SSH keys, you should create/setup your keypair in LeaseWeb Private Cloud, if you didn’t already. In the following example I’m generating a new one, but of course you could load your existing keys.

ssh-keypairs-blurred

You will want to copy paste the generated key (in Private Key) to a file and protect it. I saved mine in $HOME/.ssh/id_ntavares.csrp01.key .

ssh-keypairs2-blurred

This key will be used later to log into the created instances and extract the administrator password. Finally, instruct the AWS CLI to use this keypair when deploying your instances:

ntavares@mylaptop:~$ aws --endpoint=http://127.0.0.1:5000 ec2 run-instances \

 --instance-type dualcore \

 --image-id 7c123f01-9865-4312-a198-05e2db755e6a \

 --key-name ntavares-key 

INSTANCES	KVM	7c123f01-9865-4312-a198-05e2db755e6a	a0977df5-d25e-40cb-9f78-b3a551a9c571	dualcore	ntavares-key	2014-12-04T12:03:32+0100	10.42.1.129 

PLACEMENT	CSRP01 

STATE	16	running 

Note that the image-id is taken from the previous listing (the one I simplified with JQ).

Also note that although EC2stack is fairly new, and there are still some limitations to this EC2-CS bridge – see below for a mapping of supportedAPI calls. For instance, one that you can could run into at the time of writing this article (~2015) was the inability to deploy an instance if you’re using multiple Isolated networks (or multiple VPC). Amazon shares this concept as well, so a simple patch was necessary.

For this demo, we’re actually running in an environment with multiple isolated networks, so if you ran the above command, you’d get the following output:

ntavares@mylaptop:~$ aws --endpoint=http://127.0.0.1:5000 ec2 run-instances \

 --instance-type dualcore \

 --image-id 7c123f01-9865-4312-a198-05e2db755e6a \

 --key-name ntavares-key

A client error (InvalidRequest) occurred when calling the RunInstances operation: More than 1 default Isolated networks are found for account Acct[47504f6c-38bf-4198-8925-991a5f801a6b-rme]; please specify networkIds

In the meantime, LeaseWeb’s patch was merged, as many others, which both demonstrates the power of Open Source and the activity on this project.

Naturally, the basic maintenance tasks are there:

ntavares@mylaptop:~$ aws --endpoint=http://127.0.0.1:5000 ec2 describe-instances 

RESERVATIONS	None 

INSTANCES	KVM	7c123f01-9865-4312-a198-05e2db755e6a	a0977df5-d25e-40cb-9f78-b3a551a9c571	dualcore	ntavares-key	2014-12-04T12:03:32+0100	10.42.1.129	10.42.1.129 

PLACEMENT	CSRP01	default 

STATE	16	running

I’ve highlighted some information you’ll need now to login to the instance: the instance id, and IP address, respectively. You can login either with your ssh keypair:

[root@jump ~]# ssh -i $HOME/.ssh/id_ntavares.csrp01.key root@10.42.1.129 

Linux localhost 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 



[...] 

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent 

permitted by applicable law. 

root@a0977df5-d25e-40cb-9f78-b3a551a9c571:~#

If you need, you can also retrieve the password the same way you do with EC2:

ntavares@mylaptop:~$ aws --endpoint=http://127.0.0.1:5000 ec2 get-password-data --instance-id a0977df5-d25e-40cb-9f78-b3a551a9c571 

None dX5LPdKndjsZkUo19Z3/J3ag4TFNqjGh1OfRxtzyB+eRnRw7DLKRE62a6EgNAdfwfCnWrRa0oTE1umG91bWE6lJ5iBH1xWamw4vg4whfnT4EwB/tav6WNQWMPzr/yAbse7NZHzThhtXSsqXGZtwBNvp8ZgZILEcSy5ZMqtgLh8Q=

As it happens with EC2, password is returned encrypted, so you’ll need your key to display it:

ntavares@mylaptop:~$ aws --endpoint=http://127.0.0.1:5000 ec2 get-password-data --instance-id a0977df5-d25e-40cb-9f78-b3a551a9c571 | awk '{print $2}' > ~/tmp.1

ntavares@mylaptop:~$ openssl enc -base64 -in tmp.1 -out tmp.2 -d -A 

ntavares@mylaptop:~$ openssl rsautl -decrypt -in tmp.2 -text -inkey $HOME/.ssh/id_ntavares.csrp01.key 

ntavares@mylaptop:~$ cat tmp.3 ; echo 

hI5wueeur

ntavares@mylaptop:~$ rm -f tmp.{1,2,3} 
[root@jump ~]# sshpass -p hI5wueeur ssh root@10.42.1.129 

Linux localhost 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 



[...]

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent 

permitted by applicable law. 

Last login: Thu Dec  4 13:33:07 2014 from jump.rme.leasewebcloud.com 

root@a0977df5-d25e-40cb-9f78-b3a551a9c571:~#

The multiple isolated networks scenario

If you’re already running multiple isolated networks in your target platform (be either VPC-bound or not), you’ll need to pass argument –subnet-id to the run-instances command to specify which network to deploy the instance into; otherwise CloudStack will complain about not knowing in which network to deploy the instance. I believe this is due to the fact that Amazon doesn’t allow the use the Isolated Networking as freely as LeaseWeb – LeaseWeb delivers you the full flexibility at the platform console.

Since EC2stack does not support describe-network-acls (as of December 2014) in order to allow you to determine which Isolated networks you could use, the easiest way to determine them is to go to the platform console and copy & paste the Network ID of the network you’re interested in:

Then you could use –subnet-id:

ntavares@mylaptop:~$ aws --endpoint=http://127.0.0.1:5000 ec2 run-instances \

 --instance-type dualcore \

 --image-id 7c123f01-9865-4312-a198-05e2db755e6a \

 --key-name ntavares-key \

 --subnet-id 5069abd3-5cf9-4511-a5a3-2201fb7070f8

PLACEMENT	CSRP01 

STATE	16	running 

I hope I demonstrated a bit of what can be done in regards to compatible EC2 API. Other funtions are avaiable for more complex tasks although, as wrote earlier, EC2stack is quite new, for which you might need community assistance if you cannot develop the fix on your own. At LeaseWeb we are very interested to know your use cases, so feel free to drop us a note.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Install MariaDB 10 on CentOS 7 CPanel Server

$
0
0

MariaDB is a enhanced open source and drop-in replacement for MySQL. It is developed by MariaDB community and available under the terms of the GPL v2 license. Software Security is the main focus for the MariaDB developers. They maintain its own set of security patches for each MariaDB releases. When any critical security issues are discovered, the developers introduces a new release of MariaDB to get the fix out as soon as possible.

MariaDB is always up-to-date with the latest MySQL releases. It is highly compatible and works exactly like the MySQL. Almost all commands, data, table definition files, Client APIs, protocols, interfaces, structures, filenames, binaries, ports, database storage locations etc are same as the MySQL. It isn’t even needed to convert databases to switch to MariaDB.

Advantages of MariaDB

  • Truly Open source
  • More quicker and transparent security releases
  • Highly Compatible with MySQL
  • Improved Performance
  • More storage engines compared to MySQL

In this article, I provides guidelines on how to upgrade MySQL 5.5 to the latest MariaDB on a CentOS 7 CPanel server. Let’s walk through the Pre-installation steps.

Pre-requisites:

1. Stop current MySQL Service

root@server1 [/var/# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5859
Server version: 5.5.47-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

root@server1 [~]# systemctl stop mysql
root@server1 [~]# systemctl status mysql
● mysql.service – LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysql)
Active: failed (Result: exit-code) since Sun 2016-01-31 10:00:02 UTC; 1min 31s ago
Docs: man:systemd-sysv-generator(8)
Main PID: 23430 (code=exited, status=203/EXEC)

Jan 31 10:00:02 server1.centos7-test.com systemd[1]: Started MySQL Server.
Jan 31 10:00:02 server1.centos7-test.com systemd[1]: Starting MySQL Server…
Jan 31 10:00:02 server1.centos7-test.com systemd[1]: mysql.service: main process exited, code=exited, status=203/EXEC
Jan 31 10:00:02 server1.centos7-test.com systemd[1]: Unit mysql.service entered failed state.
Jan 31 10:00:02 server1.centos7-test.com systemd[1]: mysql.service failed.

2. Move all configuration files and databases prior to the upgrade

Move the DB storage path and MySQL configuration files

root@server1 [~]# cp -Rf /var/lib/mysql /var/lib/mysql-old

root@server1 [/var/lib/mysql]# cat /etc/my.cnf
[mysqld]
default-storage-engine=MyISAM
innodb_file_per_table=1
max_allowed_packet=268435456
open_files_limit=10000

root@server1 [~]#mv /etc/my.cnf /etc/my.cnf-old

3. Remove and uninstall all MySQL rpms from the server

Run the following commands to disable the MySQL RPM targets. By running this commands, cPanel will no longer handle MySQL updates, and mark these rpm.versions as uninstalled on the system.

/scripts/update_local_rpm_versions –edit target_settings.MySQL50 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL51 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL55 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL56 uninstalled

Now run the this command:

/scripts/check_cpanel_rpms –fix –targets=MySQL50,MySQL51,MySQL55,MySQL56 to remove all existing MySQL rpms on the server and leave a clean environment for MariaDB installation. Please see its output below:

root@server1 [/var/lib/mysql]# /scripts/check_cpanel_rpms –fix –targets=MySQL50,MySQL51,MySQL55,MySQL56
[2016-01-31 09:53:59 +0000]
[2016-01-31 09:53:59 +0000] Problems were detected with cPanel-provided files which are RPM controlled.
[2016-01-31 09:53:59 +0000] If you did not make these changes intentionally, you can correct them by running:
[2016-01-31 09:53:59 +0000]
[2016-01-31 09:53:59 +0000] > /usr/local/cpanel/scripts/check_cpanel_rpms –fix
[2016-01-31 09:53:59 +0000]
[2016-01-31 09:53:59 +0000] The following RPMs are unneeded on your system and should be uninstalled:
[2016-01-31 09:53:59 +0000] MySQL55-client-5.5.47-1.cp1148
[2016-01-31 09:53:59 +0000] MySQL55-devel-5.5.47-1.cp1148
[2016-01-31 09:53:59 +0000] MySQL55-server-5.5.47-1.cp1148
[2016-01-31 09:53:59 +0000] MySQL55-shared-5.5.47-1.cp1148
[2016-01-31 09:53:59 +0000] MySQL55-test-5.5.47-1.cp1148
[2016-01-31 09:53:59 +0000] compat-MySQL50-shared-5.0.96-4.cp1136
[2016-01-31 09:53:59 +0000] compat-MySQL51-shared-5.1.73-1.cp1150
[2016-01-31 09:53:59 +0000] Removing 0 broken rpms:
[2016-01-31 09:53:59 +0000] rpm: no packages given for erase
[2016-01-31 09:53:59 +0000] No new RPMS needed for install
[2016-01-31 09:53:59 +0000] Disabling service monitoring.
[2016-01-31 09:54:01 +0000] Uninstalling unneeded rpms: MySQL55-test MySQL55-server MySQL55-client compat-MySQL51-shared compat-MySQL50-shared MySQL55-shared MySQL55-devel
[2016-01-31 09:54:04 +0000] Removed symlink /etc/systemd/system/multi-user.target.wants/mysql.service.
[2016-01-31 09:54:04 +0000] Restoring service monitoring.

With these steps, we’ve uninstalled existing MySQL RPMs, marked targets to prevent further MySQL updates and made the server ready and clean for the MariaDB installation.

To startup with the installation, we need to create a yum repository for MariaDB depending on the MariaDB & CentOS versions. This is how I did it!

Installation procedures:

Step 1: Creating a YUM repository.

root@server1 [~]# vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
root@server1 [/etc/yum.repos.d]# cat /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Step 2: Open the /etc/yum.conf and modify the exclude line as below:

Remove this line exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* mysql* nsd* php* proftpd* pure-ftpd* spamassassin* squirrelmail*

And replace with this line exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* nsd* proftpd* pure-ftpd* spamassassin* squirrelmail*
**IMPORTANT ***

We need to make sure, we’ve removed the MySQL and PHP from the exclude list.

Step 3: Run the following command to install MariaDB and related packages.

yum install MariaDB-server MariaDB-client MariaDB-devel php-mysql

root@server1 [~]#yum install MariaDB-server MariaDB-client MariaDB-devel php-mysql

Dependencies Resolved

===============================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================
Installing:
MariaDB-client x86_64 10.0.23-1.el7.centos mariadb 10 M
MariaDB-devel x86_64 10.0.23-1.el7.centos mariadb 6.3 M
MariaDB-server x86_64 10.0.23-1.el7.centos mariadb 55 M
php-mysql x86_64 5.4.16-36.el7_1 base 99 k
Installing for dependencies:
MariaDB-common x86_64 10.0.23-1.el7.centos mariadb 43 k
MariaDB-shared x86_64 10.0.23-1.el7.centos mariadb 1.2 M
libzip x86_64 0.10.1-8.el7 base 48 k
php-common x86_64 5.4.16-36.el7_1 base 563 k
php-pdo x86_64 5.4.16-36.el7_1 base 97 k

Transaction Summary
===============================================================================================================================================
Install 4 Packages (+5 Dependent package)

Step 4: Restart and make sure the MySQL service is up.

root@server1 [~]# systemctl start mysql
root@server1 [~]#
root@server1 [~]#
root@server1 [~]# systemctl status mysql
● mysql.service – LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysql)
Active: active (exited) since Sun 2016-01-31 10:01:46 UTC; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 23717 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=0/SUCCESS)
Main PID: 23430 (code=exited, status=203/EXEC)

Jan 31 10:01:46 server1.centos7-test.com systemd[1]: Starting LSB: start and stop MySQL…
Jan 31 10:01:46 server1.centos7-test.com mysql[23717]: Starting MySQL SUCCESS!
Jan 31 10:01:46 server1.centos7-test.com systemd[1]: Started LSB: start and stop MySQL.

Step 5 : Run mysql_upgrade command

It will examine all tables in all databases for incompatibilities with the current installed version and upgrades the system tables if necessary to take advantage of new privileges or capabilities that might have added with the current version.

root@server1 [~]# mysql_upgrade
MySQL upgrade detected
Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Phase 2/6: Fixing views from mysql
Phase 3/6: Running ‘mysql_fix_privilege_tables’
Phase 4/6: Fixing table and database names
Phase 5/6: Checking and upgrading tables
Processing databases
cphulkd
cphulkd.auths OK
cphulkd.blacklist OK
cphulkd.brutes OK
cphulkd.good_logins OK
cphulkd.ip_lists OK
cphulkd.known_netblocks OK
cphulkd.login_track OK
cphulkd.logins OK
cphulkd.report OK
cphulkd.whitelist OK
eximstats
eximstats.defers OK
eximstats.failures OK
eximstats.sends OK
eximstats.smtp OK
information_schema
leechprotect
leechprotect.hits OK
modsec
modsec.hits OK
performance_schema
roundcube
roundcube.cache OK
roundcube.cache_index OK
roundcube.cache_messages OK
roundcube.cache_shared OK
roundcube.cache_thread OK
roundcube.contactgroupmembers OK
roundcube.contactgroups OK
roundcube.contacts OK
roundcube.cp_schema_version OK
roundcube.dictionary OK
roundcube.identities OK
roundcube.searches OK
roundcube.session OK
roundcube.system OK
roundcube.users OK
saheetha_test
saheetha_test.authors OK
whmxfer
whmxfer.sessions OK
Phase 6/6: Running ‘FLUSH PRIVILEGES’
OK

Step 6 : Restart the MySQL service once again to ensure everything works perfect.

root@server1 [~]# systemctl restart mysql
root@server1 [~]#
root@server1 [~]# systemctl status mysql
● mysql.service – LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysql)
Active: active (running) since Sun 2016-01-31 10:04:11 UTC; 9s ago
Docs: man:systemd-sysv-generator(8)
Process: 23831 ExecStop=/etc/rc.d/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 23854 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=0/SUCCESS)
Main PID: 23430 (code=exited, status=203/EXEC)
CGroup: /system.slice/mysql.service
├─23861 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –pid-file=/var/lib/mysql/server1.centos7-test.com.pid
└─23933 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/v…

Jan 31 10:04:10 server1.centos7-test.com systemd[1]: Starting LSB: start and stop MySQL…
Jan 31 10:04:11 server1.centos7-test.com mysql[23854]: Starting MySQL. SUCCESS!
Jan 31 10:04:11 server1.centos7-test.com systemd[1]: Started LSB: start and stop MySQL.

Step 7: Run EasyApache to rebuild Apache/PHP with MariaDB and ensure all PHP modules remains intact.

root@server1 [~]#/scripts/easyapache –build

****IMPORTANT *****
If you forget to rebuild Apache/PHP after the MariaDB installation, it will report the library error as below:

root@server1 [/etc/my.cnf.d]# php -v
php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

Step 8: Now verify the installation and databases.

root@server1 [/var/lib/mysql]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.0.23-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show storage engines;
+——————–+———+—————————————————————————-+————–+——+————+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+——————–+———+—————————————————————————-+————–+——+————+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MyISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| FEDERATED | YES | FederatedX pluggable storage engine | YES | NO | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO |
+——————–+———+—————————————————————————-+————–+——+————+
10 rows in set (0.00 sec)

That’s all :). Now we’re all set to go with MariaDB with its improved and efficient features. Hope you enjoyed reading this documentation. I would recommend your valuable suggestions and feedback on this!




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Install Sentora on CentOS 7

$
0
0

sentoraIn this tutorial we will cover the steps needed for installing Sentora on a CentOS 7 VPS. Sentora is a web hosting control panel that is free for download. It is developed for Linux, UNIX and BSD based servers or computers. Using Sentora software you can turn a domestic or commercial server into a completely developed, easy to use and manage web hosting server.
Sentora is written in PHP and it is designed to host and manage multiple clients on a single server. Sentora installs pre-configured packages that only work with control panel itself. Below is the list:

  •     MySql -5.5.29
  •     Apache – 2.4.3
  •     PHP -5.3.20
  •     Bind – 9.9.2-P1
  •     phpMyAdmin – 3.5.8.1 *
  •     RoundCube – 0.9.2 *
  •     Dovecot  – 2.0.9
  •     Postfix  – 2.6.6
  •     proFTPd – 1.3.3g

Therefore, a minimum installation of CentOS 7 is required if you want to successfully install Sentora.

UPDATE THE SYSTEM

Log in to your Linux VPS as user root and first of all make sure that all packages are up to date:

# yum -y update

INSTALL SENTORA

Navigate to the /home directory.

# cd

Install the wget command line utility:

# yum install wget

Download the installation script:

# wget sentora.org/install

Make the script executable:

# chmod +x install

Start the installation of Sentora by running the script:

# ./install

You will be welcomed by the following:

############################################################
#  Welcome to the Official Sentora Installer 1.0.1  #
############################################################

Checking that minimal requirements are ok
Detected : CentOs  7  x86_64
Ok.
DB server will be mariaDB

As you can see, our CentOS 7 VPS fulfills the minimal requirements by Sentora. Next, you need to select your timezone from the list:

Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.

After you set up your timezone, you will see the following on your screen:

=== Informations required to build your server ===
The installer requires 2 pieces of information:
1) the sub-domain that you want to use to access Sentora panel,
- do not use your main domain (like domain.com)
- use a sub-domain, e.g panel.domain.com
- or use the server hostname, e.g server1.domain.com
- DNS must already be configured and pointing to the server IP
for this sub-domain
2) The public IP of the server.

What this means is that you must have a DNS propagated subdomain that you will enter after which you will be able to access the Sentora control panel by using that subdomain. The second information is the public IP address of the server.

For example, if you don’t configure sentora.yourdomain.tld the following error will stop you from continuing with the installation:

WARNING: sentora is not a subdomain!
WARNING: sentora is not defined in your DNS!
You must add records in your DNS manager (and then wait until propagation is done).
For more information, read the Sentora documentation:
- http://docs.sentora.org/index.php?node=7 (Installing Sentora)
- http://docs.sentora.org/index.php?node=51 (Installer questions)
If this is a production installation, set the DNS up as soon as possible.

There are some warnings...
Are you really sure that you want to setup Sentora with these parameters?
(y):Accept and install, (n):Change domain or IP, (q):Quit installer? n

So, if you accept the settings without solving the warnings, Sentora will not work on your server.

Therefore, you must configure a working subdomain. The installation takes less than 5 minutes and after it is completed you will be prompted with the following:

########################################################
Congratulations Sentora has now been installed on your
server. Please review the log file left in /root/ for
any errors encountered during installation.

Login to Sentora at http://http://panel.yourdomain.tld
Sentora Username  : zadmin
Sentora Password  : Ehj3qpNTkDciRJc3

MySQL Root Password      : Nrj1xRKSGbDcodQX
MySQL Postfix Password   : tF0qEGTGvpXLyUEV
MySQL ProFTPd Password   : brrNJ6YS8FvD9vOP
MySQL Roundcube Password : DEBRUAJSl4tdfJMS
(theses passwords are saved in /root/passwords.txt)
########################################################

Of course, the above values are the ones that we got from our installation and are completely unrelated to your Sentora instance.

Congratulations, you have successfully installed Sentora on your CentOS 7 VPS.

By default, the Sentora login page is displayed when a user browses to the FQDN specified during install (http://panel.yourdomain.tld), but also when the root domain name (ie http://yourdomain.tld) is opened.

So, open your favorite web browser and navigate to http://panel.yourdomain.tld.

For further configuration on Sentora please visit the official Configuration & How-to page for Sentora.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Install and configure Jenkins with Nginx as a reverse proxy on CentOS 7

$
0
0

jenkinsIn this article we will install and configure Jenkins with Nginx as a reverse proxy on a CentOS 7 VPS.

Jenkins is a leading open source automation server built with Java that monitors executions of repeated jobs, such as building a software project or jobs run by cron. With Jenkins, organizations can accelerate the software development process through automation. It manages and controls development life-cycle processes of all kinds, including build, document, test, package, stage, deployment, static analysis and many more.

Builds can be started by various means, including being triggered by commit in a version control system, scheduling via a cron-like mechanism, building when other builds have completed, and by requesting a specific build URL.

REQUIREMENTS

We will be using our SSD 1 Linux VPS hosting plan for this tutorial.

Log in to your server via SSH:

# ssh root@server_ip

Before starting, enter the below command to check whether you have the proper version of CentOS installed on your machine:

# cat /etc/redhat-release

It should give you the underneath output:

CentOS Linux release 7.2.1511 (Core)

UPDATE THE SYSTEM

Make sure your server is fully up to date:

# yum update

INSTALL JAVA NGINX AND PHP-FPM

Your next step is to install Nginx and PHP-FPM along some needed dependencies and the nano text editor so you can edit some config files. Of course, you can use your favorite text editor.

Install the official Nginx repository for CentOS 7 and then install Nginx, PHP-FPM etc… Use the below commands to do that:

# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

# yum install nginx php-fpm php-mysql wget nano

Start Nginx and PHP-FPM and enable them to start on boot:

# systemctl start nginx

# systemctl enable nginx

# systemctl start php-fpm

# systemctl enable php-fpm

Now create a host directive for the domain from which you will access Jenkins. Open a file, let’s say called ‘your_domain.conf’ in the ‘/etc/nginx/conf.d/’ directory:

# nano /etc/nginx/conf.d/your_domain.conf

Paste the following:

upstream jenkins {
    server 127.0.0.1:8080;
}

server {
    listen      80 default;
    server_name your_jenkins_site.com;

    access_log  /var/log/nginx/jenkins.access.log;
    error_log   /var/log/nginx/jenkins.error.log;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    location / {
        proxy_pass  http://jenkins;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;
    }

}

Replace the ‘your_jenkins_site.com’ value with your own domain, save and close the file.

Test if the Nginx configuration is OK:

# nginx -t

If everything is OK, restart Nginx for the changes to take effect:

# service nginx restart

Since Jenkins is built with Java, let’s install it with the yum package manager:

# yum install java

You can check the installed Java version:

# java -version

openjdk version "1.8.0_71"
OpenJDK Runtime Environment (build 1.8.0_71-b15)
OpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)

INSTALL JENKINS

Download the Jenkins repo and install Jenkins with the following commands:

# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo

# rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

# yum install jenkins

Start the Jenkins server and enable it to start on boot with:

# service jenkins start

# systemctl enable jenkins

Congratulations, you have successfully installed Jenkins on your CentOS 7 VPS. You can now open your favorite web browser and access Jenkins using the domain you configured in the Nginx conf file.

However, the installation is insecure and allows anyone on the network to launch processes on your behalf. Therefore enable authentication to discourage misuse. Go to Manage Jenkins (in the left menu).

Click ‘Setup Security’ on the page loaded. Enable security by checking the box next to ‘Enable security’.

Configure Jenkins to use it’s own user database and disable sign ups:

Navigate to Matrix-based security under Authorization and check the box next to it. Then make sure that Anonymous has only the Read right under the View group to prevent Jenkins from crashing.

Click save at the bottom of the page. After that, you’ll see a sign up form.

Enter a username, password, name and email. Use a lower case username to avoid confusion because Jenkins is assuming a lower case username will be used. After signing up, you will be the administrator of this fresh Jenkins install.

Once everything is up and running, it is up to you to create and schedule your first job, install plugins etc…




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Install OpenSIPS Server on Ubuntu 15.04

$
0
0

OpenSIPS is an open source SIP Proxy program that runs on Linux platforms and play in the infrastructure of an Internet Telephony Service Provider. There are number of open source applications available that are used to build IP Telephony solutions. OpenSIPS may not be as well-known as Asterisk, but it is widely used by VOIP service providers as a core part of their infrastructure because of its robustness, speed and capacity.

In this article we will take you through the steps needed for downloading OpenSIPS sources and then compiling and installing it on the Ubuntu 15 server. So at the end of this article you’ll see a working openSIPS server and able to see that how it will generate a working configuration file based on your desired functionalities.

Prerequisites:

OpenSIPS server installation requires some basic modules to be installed on the Ubuntu server that can be installed using the simple ‘apt-get’ command. Once your back end server is ready to deploy the OpenSIPS then login using the sudo or root user to perform the following tasks.

1) System Update

Once you are connected to your CentOS 7 server, run the following command as a root user to update your system with latest updates and security patches.

# apt-get update

system update

2) Installing Dependencies:

After system update you need to install the missing packages using the ‘apt-get’ command if these are not already installed.

# apt-get install build-essential openssl bison flex

To continue the installation you will be asked to type ‘y’ key. This will install all required missing packages including their dependencies as shown .

OpenSips Dependencies

Still few more dependencies left that need to be installed, to do so run the following command.

# apt-get install perl libdbi-perl libdbd-mysql-perl libdbd-pg-perl libfrontier-rpc-perl libterm-readline-gnu-perl libberkeleydb-perl ncurses-dev

Opesips dependencies

3) Installing MySQL Server:

In order setup database for the OpenSIPS server we need a Database server. So, we are going to use MySQL-Server by using the community repository. Let’s run the following commands to install MySQL server and it development libraries.

# apt-get install mysql-server libmysqlclient-dev

Installing Mysql

Now you will be able to install the MySQL local server and MySQL headers by press the ‘y’ key. During its setup you will be asked to configure the root password for MySQL server, so type your secure password and press ‘OK’ to proceed.

set mysql password

4) Download OpenSIPS Package:

Open the Official OpenSIPS Source Page to download the package.

OpenSIPS Source

We are going to download the package into the following directory using ‘wget’ command and the extract within th esame directory.

# cd /usr/src

# wget http://opensips.org/pub/opensips/latest/opensips-2.1.2.tar.gz

# tar -zxvf opensips-2.1.2.tar.gz

download opensips

5) Compiling OpenSIPS Source:

Moving step ahead let’s move into the opensips directory and run the command below to start the compilation process.

# cd opensips-2.1.2/
# make all

Compiling Opensips

6) Installing OpenSIPS Source:

Once the compilation process completes, you can start making its installation as shown below.

# make install

make install

7) OpenSIPS Configuration:

The OpenSIPS has been installed, now we are going to configure some of its basic parameters and startup script. Let’s first create a new directory for the OpenSIPS run files.

# mkdir /var/run/opensips

Now move to the following ‘debians’ directory and list the files in it.

# cd packaging/debian/

Debian Files

Here you see the opensips default and init files that we will copying to the ‘/etc/default/’ directory using the following commands.

# cp opensips.default /etc/default/opensips
# cp opensips.init /etc/init.d/opensips

Then run the following commands to give executable permissions to the opensips startup script, create and new user and then update its default boot configurations as shown below.

# chmod +x /etc/init.d/opensips
# useradd opensips
# update-rc.d opensips defaults 99

Opensips settings

Open the default file of Opensips using any of your editor to configure its startup options.

# vim /etc/default/opensips

Here you need to replace the ‘RUN_OpenSIPS’ to ‘Yes’. You can also change the user and group and name that you wish to use for the Opensips services and also change the shared memory to minimum 128 which is recommended for the OpenSIPS server.

Opensips Statup

we also need to update the daemon on OpenSIP and change it location in its startup script and update its state from ‘off’ to ‘on’ and then close the file after making changes as shown in the below image.

# vim /etc/init.d/opensips

opensips daemon

Starting OpenSIPS Service:

All necessary configurations has been setup to proceed on starting OpenSIPS service. Simply run the following command to start OpenSIPS and the check its status, that should be active and running as shown in the image.

# /etc/init.d/opensips start

# systemctl status opensips

start opensips

You can also check the state of OpenSIPS services and the port on which its running that is ‘5060’ by using the below commands.

# ps -ef | grep opensips
# netstat -alnp | grep opensips

opensips processes

Conclusion

OpenSIPS server has been installed successfully on Ubuntu 15.04 including of its required dependencies. But there are alot of things to work on and explore. In the next article we show you its web control panel installation. We have you enjoyed following this article and did not face any issue. Feel free to comment us back in case of any difficulty and leave you valuable suggestions.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Install Sysdig System Diagnosing Tool on Ubuntu 15 / CentOS 7

$
0
0

Hello and welcome to our todays article on Linux system exploration and troubleshooting tool Sysdig with first class support for containers. Sysdig capture system state and activity from a running Linux instance, then save, filter and analyze. You can use this awesome tool as a replacement of many Linux troubleshooting commands like top, lsof, strace, iostat, ps, etc. It also combines the benefits of many utilities such as strace, tcpdump, and lsof into one single application which is packed with a set of scripts called Chisels that make it easier to extract useful information and do troubleshooting.

In this article we’ll show you its installation steps and basic usage of sysdig to perform system monitoring and troubleshooting on Linux CentOS 7 and Ubuntu 15 Operating system.

1) Installing Sysdig on Ubuntu 15:

Sysdig included the latest versions of Debian , RHEL and Container based OS; however, it is updated with new functionality all the time. We are going to install Sysdig using ‘apt’ command, but first we need to setup the apt repository maintained by Draios by running the following ‘curl’ commands with root user.

Using below commands will trust the Draios GPG key and configure the apt repository.

# curl -s https://s3.amazonaws.com/download.draios.com/DRAIOS-GPG-KEY.public | apt-key add –

# curl -s -o /etc/apt/sources.list.d/draios.list http://download.draios.com/stable/deb/draios.list

Now you need to update the package list by executing the following command.

# apt-get update

installing sysdig

Once your system update is complete you need to install the kernel headers package using the command as shown below.

# apt-get -y install linux-headers-$(uname -r)

Now you can install sysdig on ubuntu using the following command.

# apt-get -y install sysdig

Sysdig installation

2) Installing Sysdig on CentOS 7

The installation process on the CentOS 7 is similar to the one that we have performed for Ubuntu server but you need to repeat the same step by setting up the yum repository that will use its own key to verify the authenticity of the package.

Let’s run the following command to use the ‘rpm’ tool with the ‘–import’ to manually add the Draios key to your RPM key.

# rpm –import https://s3.amazonaws.com/download.draios.com/DRAIOS-GPG-KEY.public

After this download the Draios repository and configure yum to use it on your CentOS 7 server.

# curl -s -o /etc/yum.repos.d/draios.repo http://download.draios.com/stable/rpm/draios.repo

Now you need to update the package list by executing the following command before starting installation of Sysdig package.

# yum update

Sysdig Repo

The EPEL repository is needed in order to download the Dynamic Kernel Module Support (DKMS) package used by sysdig tool. So, the following below commands to enable EPEL repository.

# yum -y install epel-release

Enable EPEL Repo

Now install the kernel headers in order to setup sysdig-probe module and then flow the command to install the Sysdig package on the server.

# yum install kernel-devel-$(uname -r)

# yum install sysdig

Installing Sysdig

3) Using Sysdig

After successful installation of sysdig tool, now we will show you some of its most useful examples to use this for troubleshooting your system. The simplest and easiest method to use sysdig is by invoking it without any argument as shown below.

# sysdig

By default, sysdig prints the information for each captured event on a single line in the format of its event number, event time, event cpu number, name of the process (PID), event direction for out, event type and event arguments.

Using Sysdig

The output is so much huge and mostly not very useful by itself, so you can write the output of the Sysdig in a file by using the ‘-w’ flag and specifying the file name in ‘.dump’ as shown in below command.

# sysdig -w result.dump

Ten run the following command with parameter ‘-r’ to read the output from the saved file.

# sysdig -r result.dump

Sysdig Filters

You can use filters that allow you to filter the output of sysdig results to specific information. run the following command to find a list of available filters as shown.

# sysdig -l

———————-
Field Class: fd

fd.num the unique number identifying the file descriptor.
fd.cport for TCP/UDP FDs, the client port.
fd.rproto for TCP/UDP FDs, the remote protocol.

———————-
Field Class: process

proc.pid the id of the process generating the event.
proc.name the name (excluding the path) of the executable generating the
event.
proc.args the arguments passed on the command line when starting the proc
ess generating the event.
proc.env the environment variables of the process generating the event.
proc.cmdline full process command line, i.e. proc.name + proc.args.
proc.exeline full process command line, with exe as first argument, i.e. pro
c.exe + proc.args.
proc.cwd the current working directory of the event.
proc.duration number of nanoseconds since the process started.
proc.fdlimit maximum number of FDs the process can open.
proc.fdusage the ratio between open FDs and maximum available FDs for the pr
ocess.
.
thread.pfminor number of minor page faults since thread start.
thread.ismain ‘true’ if the thread generating the event is the main one in th
e process.

So you can filter the results using its powerful filtering system. You can use the “proc.name” filter to capture all of the sysdig events for a specific process.
Let’s for example filter the process of ‘MySQLD’ using proc.name argument using below command.

# sysdig -r result.dump proc.name=mysqld

140630 02:20:30.848284977 2 mysqld (2899) io_getevents
140632 02:20:30.848289674 2 mysqld (2899) > switch next=2894(mysqld) pgft_maj=0 pgft_min=1 vm_size=841372 vm_rss=85900 vm_swap=0
140633 02:20:30.848292784 2 mysqld (2894) io_getevents
140635 02:20:30.848297142 2 mysqld (2894) > switch next=2901(mysqld) pgft_maj=0 pgft_min=4 vm_size=841372 vm_rss=85900 vm_swap=0
140636 02:20:30.848300414 2 mysqld (2901) io_getevents
140638 02:20:30.848307954 2 mysqld (2901) > switch next=0 pgft_maj=0 pgft_min=1 vm_size=841372 vm_rss=85900 vm_swap=0
140640 02:20:30.849340499 1 mysqld (2900) io_getevents
140642 02:20:30.849348907 1 mysqld (2900) > switch next=2895(mysqld) pgft_maj=0 pgft_min=1 vm_size=841372 vm_rss=85900 vm_swap=0
140643 02:20:30.849357633 1 mysqld (2895) io_getevents
140645 02:20:30.849362258 1 mysqld (2895) > switch next=26329(tuned) pgft_maj=0 pgft_min=1 vm_size=841372 vm_rss=85900 vm_swap=0
140702 02:20:30.995763869 1 mysqld (2898) io_getevents
140704 02:20:30.995777232 1 mysqld (2898) > switch next=2893(mysqld) pgft_maj=0 pgft_min=1 vm_size=841372 vm_rss=85900 vm_swap=0
140705 02:20:30.995782563 1 mysqld (2893) io_getevents
140707 02:20:30.995795720 1 mysqld (2893) > switch next=0 pgft_maj=0 pgft_min=3 vm_size=841372 vm_rss=85900 vm_swap=0
140840 02:20:31.204456822 1 mysqld (2933) futex addr=7F1453334D50 op=129(FUTEX_PRIVATE_FLAG|FUTEX_WAKE) val=1
140842 02:20:31.204464336 1 mysqld (2933) futex addr=7F1453334D8C op=393(FUTEX_CLOCK_REALTIME|FUTEX_PRIVATE_FLAG|FUTEX_WAIT_BITSET) val=12395
140844 02:20:31.204569972 1 mysqld (2933) > switch next=3920 pgft_maj=0 pgft_min=1 vm_size=841372 vm_rss=85900 vm_swap=0
140875 02:20:31.348405663 2 mysqld (2897) io_getevents

To filter the live process of ‘sshd’ you can use following command with proc.name argument.

# sysdig proc.name=sshd

Sysdig Filter

Network and System Diagnosing with Sysdig

To see the top processes in terms of network bandwidth usage run the below sysdig command.

# sysdig -c topprocs_net

Bytes Process PID
——————————————————————————–
304B sshd 3194

To capture all processes that open a specific file, use below command.

# sysdig fd.name=/var/log

Capture Process

In order to capturing all processes that open a specific file system you can use the following command. Use comparison operators with filters such as contains, =, !=, =, . You will see that filters can be used for both reading from a file or the live event stream.

# sysdig fd.name contains /etc

Capture All processes

Using Chisels in Sysdig

Sysdig’s chisels are little scripts that analyze the sysdig event stream to perform useful actions. If you’ve used system tracing tools like dtrace, you’re probably familiar with running scripts that trace OS events. Chisels work well on live systems, but can also be used with trace files for offline analysis.

To get the list of available chisels, just type the following command to get a short description for each of the available chisels.

# sysdig -cl

Sysdig Chipsels

To run one of the chisels, you use the ‘–c’ flag. For instance, let’s run the topfiles_bytes chisel as shown below.

# sysdig -c topfiles_bytes

Sysdig topfiles

Or if you want to see the top files in a specific folder then use below command.

# sysdig -c topfiles_bytes “fd.name contains /root”

To see the top files by a specific user use below.

# sysdig -c topfiles_bytes “user.name=admin”

Conclusion

Thank you for reading this detailed article and I hope you have found this much helpful as your favorite system and network diagnosing tool. There are still a lot more features that you can explore using sysdig. Don’t forget to share with us about your finding and leave us your valuable comments.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Install PrestaShop on CentOS 7

$
0
0

PrestaShop is the most powerful, dynamic and fully-featured free eCommerce software enriched with innovative tools. It is used by more than 2,50,000 people around the world for making their online stores at no cost. It’s been used widely across the globe due to its simplicity and efficiency.

If you’re planing to start with an online webstore, then you’re on the right place. In this article, I’m providing the guidelines on how I installed PrestaShop on my CentOS 7 server to build up my online store.

Pre-requisites

  •  Disable Selinux
  • Install the LAMP stack
  • Create a Database/User
  • Confirm the installation of the PHP modules GD, Mcrypt, Mbstring and PDO MySQL

1. Disable Selinux

Need to edit the selinux configuration file located at : /etc/selinux/config

Modify the SELINUX parameter to disabled and reboot the server.

2. Install the LAMP stack

I’ve set a proper hostname for my server and start with the LAMP installation. Firstly, install Apache.

[root@server1 ~]# yum install httpd -y

This will install all the required Apache packages. Make sure it is enabled and working in the server.

root@server1 ~]# systemctl enable httpd
ln -s ‘/usr/lib/systemd/system/httpd.service’ ‘/etc/systemd/system/multi-user.target.wants/httpd.service’

[root@server1~]# systemctl status httpd.service
httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: active (running) since Tue 2016-02-23 09:18:28 UTC; 2s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 15550 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 15561 (httpd)
Status: “Processing requests…”
CGroup: /system.slice/httpd.service
├─15561 /usr/sbin/httpd -DFOREGROUND
├─15562 /usr/sbin/httpd -DFOREGROUND
├─15563 /usr/sbin/httpd -DFOREGROUND
├─15564 /usr/sbin/httpd -DFOREGROUND
├─15565 /usr/sbin/httpd -DFOREGROUND
└─15566 /usr/sbin/httpd -DFOREGROUND

Now create the VHOST for the domain which we’re planning to install Prestashop. I’m installing Prestashop for my domain saheetha.com.
Here is my Vhost for the domain. Make sure you create the document root and log folders, here it is /var/www/saheetha.com/public_html/ and /var/www/saheetha.com/logs/ before restarting the Apache.

[root@server1 ~]# cat /etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost 139.162.54.130:80>
ServerAdmin webmaster@saheetha.com
ServerName saheetha.com
ServerAlias www.saheetha.com
DocumentRoot /var/www/saheetha.com/public_html/
ErrorLog /var/www/saheetha.com/logs/error.log
CustomLog /var/www/saheetha.com/logs/access.log combined
</VirtualHost>

Now install MySQL, I’m installing MySQL 5.5. Download your MySQL Community Repository in your Linux distribution. I downloaded the latest MySQL repo. And installed MySQL 5.5 in my server. Please see the steps I did to choose my required version.

[root@server1 ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
[root@server1 ~]# yum localinstall mysql57-community-release-el7-7.noarch.rpm
root@server1 ~]# yum install -y yum-utils *//Install the yum-utility packages //*

[root@server1 ~]# yum repolist enabled | grep “mysql.*-community.*” *//Checked the enabled repo before installation //*
mysql-connectors-community/x86_64 MySQL Connectors Community 17
mysql-tools-community/x86_64 MySQL Tools Community 31
mysql57-community/x86_64 MySQL 5.7 Community Server 56

[root@server1 ~]# yum-config-manager –disable mysql57-community *//Disabling MySQL 5.7 repo from installing*//

Loaded plugins: fastestmirror
=========================================================== repo: mysql57-community ===========================================================
[mysql57-community]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/
cache = 0
cachedir = /var/cache/yum/x86_64/7/mysql57-community
check_config_file_age = True
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 0
enablegroups = True
exclude =
failovermethod = priority
gpgcadir = /var/lib/yum/repos/x86_64/7/mysql57-community/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/mysql57-community/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
hdrdir = /var/cache/yum/x86_64/7/mysql57-community/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = MySQL 5.7 Community Server
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/mysql57-community
pkgdir = /var/cache/yum/x86_64/7/mysql57-community/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = mysql57-community/x86_64
ui_repoid_vars = releasever,
basearch
username =

[root@server1 ~]# yum-config-manager –enable mysql55-community *//Enabling the MySQL 5.5 Repo from the Yum repository //*
Loaded plugins: fastestmirror
=========================================================== repo: mysql55-community ===========================================================
[mysql55-community]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/
cache = 0
cachedir = /var/cache/yum/x86_64/7/mysql55-community
check_config_file_age = True
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
gpgcadir = /var/lib/yum/repos/x86_64/7/mysql55-community/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/mysql55-community/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
hdrdir = /var/cache/yum/x86_64/7/mysql55-community/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist =
mirrorlist_expire = 86400
name = MySQL 5.5 Community Server
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/mysql55-community
pkgdir = /var/cache/yum/x86_64/7/mysql55-community/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = mysql55-community/x86_64
ui_repoid_vars = releasever,
basearch
username =

[root@localhost ~]# yum repolist enabled | grep “mysql.*-community.*” *//Confirm the enabled MySQL repo versions //*
mysql-connectors-community/x86_64 MySQL Connectors Community 17
mysql-tools-community/x86_64 MySQL Tools Community 31
mysql55-community/x86_64 MySQL 5.5 Community Server 199
Now install the MySQL 5.5 from the Repo.

[root@server1~]# yum install mysql-community-server

After completing with the installation, start the MySQL service and confirm its status.

[root@server1 ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@server1 ~]#
[root@server1 ~]#
[root@server1 ~]# systemctl status mysqld.service
mysqld.service – MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled)
Active: active (running) since Tue 2016-02-23 09:27:44 UTC; 8s ago
Process: 15717 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
Process: 15664 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 15716 (mysqld_safe)
CGroup: /system.slice/mysqld.service
├─15716 /bin/sh /usr/bin/mysqld_safe
└─15862 /usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –log-error=/var/log/mysqld…

Feb 23 09:27:42 server1.centos7-test.com mysql-systemd-start[15664]: Alternatively you can run:
Feb 23 09:27:42 server1.centos7-test.com mysql-systemd-start[15664]: /usr/bin/mysql_secure_installation
Feb 23 09:27:42 server1.centos7-test.com mysql-systemd-start[15664]: which will also give you the option of removing the test
Feb 23 09:27:42 server1.centos7-test.com mysql-systemd-start[15664]: databases and anonymous user created by default. This is
Feb 23 09:27:42 server1.centos7-test.com mysql-systemd-start[15664]: strongly recommended for production servers.
Feb 23 09:27:42 server1.centos7-test.com mysql-systemd-start[15664]: See the manual for more instructions.
Feb 23 09:27:42 server1.centos7-test.com mysql-systemd-start[15664]: Please report any problems at http://bugs.mysql.com/
Feb 23 09:27:42 server1.centos7-test.com mysqld_safe[15716]: 160223 09:27:42 mysqld_safe Logging to ‘/var/log/mysqld.log’.
Feb 23 09:27:42 server1.centos7-test.com mysqld_safe[15716]: 160223 09:27:42 mysqld_safe Starting mysqld daemon with databases from /v…/mysql
Feb 23 09:27:44 server1.centos7-test.com systemd[1]: Started MySQL Community Server.
Hint: Some lines were ellipsized, use -l to show in full.

[root@server1 ~]# mysql –version
mysql Ver 14.14 Distrib 5.5.48, for Linux (x86_64) using readline 5.1

Now you can run the MySQL secure installation script to secure your MySQL installation by removing remote root login, setting root password, disabling anonymous users etc as needed.

root@server1 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
… Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
… Success!

By default, MySQL comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
… skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Now it’s time for PHP. Install the PHP with all required modules.

[root@server1 ~]# yum install php-mcrypt php php-common php-pdo php-cli php-mysql php-gd php-xml libtool-ltdl mhash mcrypt -y

[root@server1 ~]# php -v
PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

3. Create a Database/User

Now create a database for Prestashop installation. I created a database namely prestashopdb and user prestashopuser prior to the installation. You can do it from MySQL CLI or you can install PhpMyadmin and manage databases using that.

[root@server1 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 9
Server version: 5.5.48 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

mysql> create database prestashopdb;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON prestashopdb.* TO prestashopuser@localhost IDENTIFIED BY ‘prestashop123#’;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

4. Confirm the installation of the PHP modules GD, Mcrypt, Mbstring and PDO MySQL

PHP modules like GD and PDO MySQL are installed during the initial PHP setup. I need to enable the Mcrypt and MBstring module to complete the pre-requisites for the Prestashop installation.

Mcrypt Installation:

Install EPEL repo for YUM
yum -y install epel-release
yum install php-mcrypt -y

MBstring installation

yum install php-mbstring -y

Installing Prestashop

Download the latest Prestashop version from the link and extract it in the home folder. Modify the permissions of the folders/files to 755.

root@server1 home]# unzip prestashop_1.6.1.2.zip
root@server1 prestashop]# chmod -R 755 *.*
[root@server1 prestashop]# ll
total 160
drwxr-xr-x 2 root root 4096 Feb 23 09:45 Adapter
drwxr-xr-x 9 root root 4096 Feb 23 09:45 admin
-rwxr-xr-x 1 root root 12320 Oct 29 16:16 architecture.md
drwxr-xr-x 8 root root 4096 Feb 23 09:45 cache
drwxr-xr-x 17 root root 4096 Feb 23 09:45 classes
drwxr-xr-x 3 root root 4096 Feb 23 09:45 config
-rwxr-xr-x 1 root root 3617 Oct 29 16:16 CONTRIBUTING.md
-rwxr-xr-x 1 root root 5847 Oct 29 16:17 CONTRIBUTORS.md
drwxr-xr-x 4 root root 4096 Feb 23 09:45 controllers
drwxr-xr-x 4 root root 4096 Feb 23 09:45 Core
drwxr-xr-x 2 root root 4096 Feb 23 09:45 css
drwxr-xr-x 4 root root 4096 Feb 23 09:45 docs
drwxr-xr-x 2 root root 4096 Feb 23 09:45 download
-rwxr-xr-x 1 root root 2454 Oct 29 16:16 error500.html
-rwxr-xr-x 1 root root 1218 Oct 29 16:16 footer.php
-rwxr-xr-x 1 root root 1247 Oct 29 16:16 header.php
-rwxr-xr-x 1 root root 4717 Oct 29 16:16 images.inc.php
drwxr-xr-x 18 root root 4096 Feb 23 09:45 img
-rwxr-xr-x 1 root root 1068 Oct 29 16:16 index.php
-rwxr-xr-x 1 root root 1154 Oct 29 16:16 init.php
drwxr-xr-x 12 root root 4096 Feb 23 09:45 install
drwxr-xr-x 7 root root 4096 Feb 23 09:45 js
drwxr-xr-x 2 root root 4096 Feb 23 09:45 localization
drwxr-xr-x 2 root root 4096 Feb 23 09:45 log
drwxr-xr-x 3 root root 4096 Feb 23 09:45 mails
drwxr-xr-x 79 root root 4096 Feb 23 09:45 modules
drwxr-xr-x 5 root root 4096 Feb 23 09:45 override
drwxr-xr-x 2 root root 4096 Feb 23 09:45 pdf
-rwxr-xr-x 1 root root 6576 Oct 29 16:16 README.md
drwxr-xr-x 3 root root 4096 Feb 23 09:45 themes
drwxr-xr-x 18 root root 4096 Feb 23 09:45 tools
drwxr-xr-x 3 root root 4096 Feb 23 09:45 translations
drwxr-xr-x 2 root root 4096 Feb 23 09:45 upload
drwxr-xr-x 2 root root 4096 Feb 23 09:45 webservice

root@server1 home]# cp -rp prestashop/* /var/www/saheetha.com/public_html/

Now copy the prestashop folder contents from /home to document root of the required domain which is meant to be our online store. It is this path “/var/www/saheetha.com/public_html/” in my case.

Now open up in your browser the URL >>http://domain.com/install/

Please navigate through the screenshots which describes each installation stage.

Stage 1 : Language Selection

prest1

Stage 2 : License Agreement 

Agree the terms and conditions in the license agreement and click “Next” to proceed further.

license2

Stage 3 : System Compatibility check 

It will check for the installation of the required PHP modules and folders/file permissions to continue with the installation.

prestashop3

Stage 4: Creating your own Store information:

Pres5DBconnec

Stage 6 : Installation Stage

pres6config

Stage 7 : Final Stage

It will provide you with the login credentials to manages your Online store.

pres7

Now you’re all set with your installation.  Please make sure to delete your “Install” folder from your domain document root for security reasons.

How can we access the Admin Panel?

Before accessing the admin Panel for our installation, you need to rename your “admin” folder under the installation domain document root to some other name for security reasons. Or else you will get a message like this on the browser while accessing your admin panel.

For security reasons, you cannot connect to the back office until you have
renamed the /admin folder (e.g. admin847v0u8kk/)
Please then access this page by the new URL (e.g. http://saheetha.com/admin847v0u8kk/)

I renamed my admin folder and accessed my admin panel with the login credentials.  You can manage your products, orders, customers, price details etc from this.

prestashop_saheethaadmin

Now you can head over to the Prestashop user manuals  to learn more about managing your Online store.

You see how easy you can build up an online webstore using this software. Congratulation on your new venture with e-shops :).  I hope you enjoyed reading this article. I recommend your valuable comments and suggestions on this.

Have a Good Day!




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Review Of CentOS 7

$
0
0

As mentioned in my previous review (Q4OS), I recently updated a guide designed to help people choose the right Linux distribution for them by going through the top 25 Linux distributions on Distrowatch and providing a short excerpt about each one, listing who they are for and what users can expect.
There were a handful that I hadn’t tried myself and so I had to use other people’s words to describe them. Q4OS was one of them and CentOS was another. I can now say that I have tried both of these distributions.
So what is CentOS? According to the CentOS website’s about page, CentOS is a stable, predictable, manageable and reproducable platform derived from the sources of Red Hat Linux.
If we were talking in terms of Ghostbusters, Fedora Linux would be Venkman and CentOS would be Spengler. Fedora is basically more up to date but can be unpredictable whereas CentOS is more like Debian in that it is stable and trustworthy.
CentOS is basically a community version of Red Hat Linux without the branding. That means it should be good right?
Well let’s find out.

How To Get CentOS Linux

To download the latest version of CentOS visit https://www.centos.org/download/.
The download page has 3 big orange buttons with options as follows:

  • DVD ISO
  • Everything ISO
  • Minimal ISO

The DVD is a large download (over 4 gigabytes) which is ok if you have a nice fiberoptic broadband connection but for many people too big.
If the DVD ISO is too big then the Everything ISO is even bigger at 7.1 gigabytes.
The minimal ISO is much smaller but it is like the Ubuntu minimal ISO or the Debian minimal ISO in that it just gives the basic operating system with no GUI.
What we really want is a live DVD and the three big orange buttons don’t provide it.
This link provides a list of download mirrors for CentOS. Clicking on a mirror will show a list of available ISO files. You should find the following live versions:

  • KDE Desktop
  • GNOME Desktop

If all that seems too much effort you can always buy a CentOS DVD or USB drive.
I chose to use the GNOME version because I just so happen to prefer GNOME to KDE.

Installation

The tool I used to create a live USB drive was Win32 Disk Imager (Windows) or if you are using Linux you can use the dd command.
The CentOS installer is the same one used by Fedora.
This guide shows how to create a bootable Fedora USB drive and this guide shows how to install Fedora.These guides will also work for CentOS.

First Impressions


After installing from the live GNOME dvd CentOS boots into the Gnome Classic desktop.
A browser appears with a getting started guide. The best place for information about CentOS however is the CentOS Wiki.
The desktop has the CentOS 7 wallpaper and two panels (one at the top and bottom).
The panel at the top has the applications and places menus on the left side and system icons on the right side for audio, bluetooth, network, power and user settings.
Personally I prefer the actual Gnome desktop to the classic one. If you feel the same way then switch to the Gnome desktop. Log out by clicking on your username in the top right corner and select “Log Out”.
When logging back in click on the settings cog and choose the Gnome desktop instead of the Gnome Classic desktop.

The GNOME desktop is easy to navigate with an activities menu in the top corner and the same system icons on the top right.
Use the keyboard to bring up the activities by pressing the super key (windows key).
The activities window has a search box in the top middle, a launch bar with icons to your favourite applications on the left and workspaces on the right. Any open applications will appear in the centre and you can scroll through them.
I have written a guide listing all of the Gnome keyboard shortcuts.

Applications


CentOS has a decent set of applications which come as default:

  • Boxes – Virtualisation (like VirtualBox)
  • Brasero – DVD burner
  • Calculator
  • Cheese – Webcam Viewer
  • Clock
  • Contacts
  • Documents – Document Viewer
  • Ekiga Softphone – VOIP
  • Empathy – Chat client
  • Evolution – Email Client
  • Files – File Manager
  • FireFox – Web Browser
  • gEdit – Text Editor
  • LibreOffice – Office Suite
  • Rhythmbox – Audio Player
  • Shotwell – Photo Manager
  • Youtube Browser

I used Boxes to get some screenshots for the installation process and loaded CentOS 7 as a virtual machine. (I am thinking of loading another CentOS 7 in the boxes on the virtual machine and keep doing it, like one of those window within window effects).
Boxes wouldn’t allow me to add a virtual machine however due to the way SELinux is working. I had to change the SELinux settings to be permissive.
Evolution is the standard email client, which coincidentally was top of my list of best Linux email clients which I produced recently.
FireFox is the default web browser and is my second choice web browser behind Chrome (as highlighted in my list of the best Linux web browsers).
Other than that there isn’t much to report. There is LibreOffice which pretty much every distribution ships with as an alternative to MS Office and Rhythmbox which is a decent audio player which ships with GNOME anyway.

Flash, Multimedia Codecs and Video

As CentOS is a community distribution you should not be surprised to find out that Flash doesn’t work without a little bit of extra work. Flash, who cares right?
The point of this section therefore is to make you aware of this webpage which shows how to install Flash, multimedia codecs and other useful packages like Handbrake, SMPlayer and VLC.
(https://wiki.centos.org/TipsAndTricks/MultimediaOnCentOS7)
Whilst I am here it is also worth sending you in the direction of these two articles from the Dedoimedo site which show how to create the perfect CentOS experience.
http://www.dedoimedo.com/computers/centos-7-perfect-desktop.html
http://www.dedoimedo.com/computers/centos-7-perfect-desktop-more.html

Installing Applications

The graphical package manager is the GNOME software tool.
It has a simple interface with categories down the left, found packages in the top right and a description in the bottom right, as well as buttons for installing packages, visiting the package’s website, and highlighting dependencies.
The most important part of this software is the menu which in GNOME will appear on the top bar away from the main application itself. I highlight this point because it is easy to forget the menus are there sometimes.
The menu has an option called “only show native packages”. If left on, this can lead to frustration as you will search for software which you know should be there but doesn’t show up in the list.
The menu also has a link to the software sources. This is where you can get access to the non-free repositories and CentOS extra repositories.

Connecting To Network Storage


I have a WD MyCloud as a network storage device. To be honest it drives me mad but not because of Linux but because it keeps losing it’s network connection.
Anyhow, none of this is CentOS’s concern because connecting to it is a breeze. Simply open Nautilus (the file manager) and select “Browse Network”. As you can see from the picture above, CentOS has no issues with regards to accessing the device.

Printing

As with accessing the network storage, setting up the printer did not cause me any headaches either.
Simply search for print settings from the search menu and then click add.
As I have a network printer it was found straight away with no extra work required to get it to print.

Issues

There were no major issues found whilst using CentOS. Like I mentioned before there was a permissions issue whilst trying to use Boxes but that is about it.
All in all after 2 weeks use I am happy to say that there have been no dramas and that really is what CentOS is all about. Steady, run of the mill, desktop computing.

Summary

CentOS is everything I expected it would be. It is reasonably easy to install, solid and dependable.
If you are new to Linux then you shouldn’t find this too difficult to master.
There are no oddballs nor are there any real quirks. In fact it is really hard to summarise CentOS in great detail.
It is just good.
The CentOS WIKI will become your best friend though whilst using it.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Configure Postfix to use Gmail as a Mail Relay

$
0
0

Configure Postfix to use Gmail as a Mail Relay

If you have a Gmail account, you can configure your MTA to relay outgoing mail through Gmail. This gives you the benefit of Gmail’s reliability and robust infrastructure, and provides you with a simple means of sending email from the command line.

In this tutorial, we will use Postfix as our MTA. Postfix is a free, open-source, actively maintained, and highly secure mail transfer agent.

At each step, we’ll cover instructions specific to the following operating systems:

  • Debian 8
  • Ubuntu 15.10
  • CentOS 7
  • OpenSUSE 13.2
  • Arch Linux 2016.02.01
  • FreeBSD 10.2

We will also install mailutils/mailx so that we can send a test email. Where necessary, we will install supplemental SASL libraries.

All commands beginning with # require root privileges.

1. Install Required Software

Debian, Ubuntu:

apt-get update && apt-get install postfix mailutils

When prompted for “General type of mail configuration,” choose Internet Site.

When prompted for a “Mail name,” choose a hostname to be used in mail headers as the origin of your emails. A fully-qualified domain name is preferred, but using your machine’s simple hostname is OK. Regardless of what you enter here, your return address will appear to recipients as your Gmail address.

You may be prompted to set the “Root and postmaster mail recipient.” Enter root, or another user who should receive mail subsystem notifications.

For any other prompts, you can choose the default values.

Fedora:

dnf update && dnf install postfix mailx

CentOS:

yum update && yum install postfix mailx cyrus-sasl cyrus-sasl-plain

OpenSUSE:

zypper update && zypper install postfix mailx cyrus-sasl

Arch Linux:

pacman -Sy postfix mailutils

FreeBSD:

Compile Postfix from the ports collection to incorporate support for SASL:

portsnap fetch extract update

cd /usr/ports/mail/postfix

make config

In the configuration dialogs, select SASL support. All other options can remain the same. Then:

make install clean

Mailx can be installed from the binary package:

pkg install mailx

2. Configure Gmail Authentication

Create or modify a password file which will be used by Postfix to establish authentication with Gmail. In the authentication information below, replace username with your Gmail username and password with your Gmail password. If you are using a custom Gmail Apps domain name, you may replace gmail.com with your Google Apps domain.

The password file will reside in the Postfix configuration directory. The file can be named whatever you like, but the recommended filename is sasl_passwd.

Debian, Ubuntu, Fedora, CentOS, OpenSUSE, Arch Linux:

Postfix configuration files reside in the directory /etc/postfix. Create or edit the password file:

vi /etc/postfix/sasl_passwd

Add the line:

[smtp.gmail.com]:587
email:password

Save and close the file. Your Gmail password is stored as plaintext, so make the file accessible only by root:

# chmod 600 /etc/postfix/sasl_passwd

FreeBSD:

Postfix configuration files reside in the directory /usr/local/etc/postfix. Create or edit the password file:

vi /usr/local/etc/postfix/sasl_passwd

Add the line:

[smtp.gmail.com]:587    email:password

Save and close the file. Make it accessible only by root:

chmod 600 /usr/local/etc/postfix/sasl_passwd

3. Configure Postfix

There are six parameters which must be set in the Postfix configuration file main.cf. The parameters are:

relayhost, which specifies the mail relay host and port number. The host name will be enclosed in brackets to specify that no MX lookup is required.

smtp_use_tls, which enables (or disables) transport layer security.

smtp_sasl_auth_enable, which enables (or disables) SASL authentication.

smtp_sasl_security_options, which in the following configuration will be set to empty, to ensure that no Gmail-incompatible security options are used.

smtp_sasl_password_maps, which specifies the password file to use. This file will be compiled and hashed by postmap in a later step.

smtp_tls_CAfile, which specifies the list of certificate authorities to use when verifying server identity.

Debian, Ubuntu, Arch Linux:

Edit the main Postfix configuration file:

vi /etc/postfix/main.cf

Add or modify the following values:

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Save and close the file.

Fedora, CentOS:

Edit the main Postfix configuration file:

vi /etc/postfix/main.cf

Add or modify the following values:

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt

Save and close the file.

OpenSUSE:

Edit the main Postfix configuration file:

vi /etc/postfix/main.cf

Add or modify the following values:

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/ca-bundle.pem

Save and close the file.

OpenSUSE also requires that the Postfix master process configuration file master.cf be modified. Open it for editing:

vi /etc/postfix/master.cf

Locate the line which reads:

#tlsmgr unix - - n 1000? 1 tlsmg

Uncomment it, so it reads:

tlsmgr unix - - n 1000? 1 tlsmg

Save and close the file.

FreeBSD:

Edit the main Postfix configuration file:

vi /usr/local/etc/postfix/main.cf

Add or modify the following values:

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/mail/certs/cacert.pem

Save and close the file.

4. Process Password File

Use postmap to compile and hash the contents of sasl_passwd. The results will be stored in your Postfix configuration directory in the file sasl_passwd.db.

Debian, Ubuntu, Fedora, CentOS, OpenSUSE, Arch Linux:

postmap /etc/postfix/sasl_passwd

FreeBSD:

postmap /usr/local/etc/postfix/sasl_passwd

5. Restart Postfix

Restart the Postfix service, putting your changes into effect.

Debian, Ubuntu, Fedora, CentOS, OpenSUSE, Arch Linux:

systemctl restart postfix.service

FreeBSD:

To start the Postfix service for this session only:

service postfix onestart

To start Postfix automatically when the system initializes, open /etc/rc.conf for editing:

vi /etc/rc.conf

Add the line:

postfix_enable=YES

Save and close the file. You may then run:

service postfix start

To start Postfix.

6. Enable “Less Secure Apps” In Gmail

By default, only the most secure sign-ins, such as logging in to Gmail on the web, are allowed for your Gmail account. To permit relay requests, log in to your Gmail account and turn on Allow less secure apps.

For more information, review the Google Support document “Allowing less secure apps to access your account.”

7. Send A Test Email

Test your new configuration by sending an email using the mail command. Run:

mail -s “Test subject” email

You will be presented with a blank line (or a CC: field, which you can bypass by pressing Enter). Type the body of your message, pressing Enter for new lines. When you are finished composing the email, type CTRL-D to send it. To cancel the email, press CTRL-C twice.

To send a precomposed email, use the command:

mail -s “Subject Here” email < textfile

Where textfile is the name of a file containing the text to be sent.

Troubleshooting

If it’s not working, check the logs for any Postfix errors:

Debian:

less /var/log/mail.log

Ubuntu, Fedora, CentOS, OpenSUSE, Arch Linux:

journalctl

FreeBSD:

less /var/log/maillog

If you receive authentication errors from Gmail, verify that Allow Less Secure Apps is turned on in your Gmail account settings, as specified in Step 6.

Verify that the password file sasl_passwd exists, and that its contents are formatted correctly, as specified in Step 2. If you make any changes to the password file, make sure to repeat Steps 4 and 5 to hash the new password file and restart Postfix.

If you see any TLS errors, double check the configuration in main.cf as specified in Step 3. If you make any configuration changes, restart Postfix as specified in Step 5.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to setup an NFS Server and configure NFS Storage in Proxmox VE

$
0
0

How to setup an NFS Server and configure NFS Storage in Proxmox VE

NFS (Network File System) is a distributed file system protocol developed by Sun Microsystem. NFS allows a server to share files and directories of a folder on a server over the network. When the NFS share is mounted on a client system, then NFS allows a user to access files and directories on the remote system as if they were stored locally.

In this tutorial, I will guide you trough the installation of an NFS server on CentOS 7, I’ll show you how to create a new directory on CentOS 7 and then share it through the NFS protocol. Then we will add the NFS share that we’ve created on the Proxmox server as backup space the virtual machines.

Prerequisites

We need two of the servers.

  1. Proxmox server with IP: 192.168.1.111
  2. CentOS 7 with IP: 192.168.1.102

Step 1 – Install NFS on CentOS 7

Connect to the CentOS server with SSH (and get root privileges with sudo commands if you did not use the root login).

ssh [email protected]
sudo su

Now install nfs with yum:

yum -y install nfs-utils libnfsidmap rpcbind

nfs-utils are the utilities to manage the NFS server. They have to be installed on the server and client.
rpcbind is a daemon that allows an NFS clients to discover the port that is used by the NFS server.
libnfsidmap is a library to help mapping id’s for NFSv4.

If all packages installed successfully, enable rpcbind and nfs-server services to be started when the server is booting.

systemctl enable rpcbind
systemctl enable nfs-server

Then start all services:

systemctl start rpcbind
systemctl start nfs-server
systemctl start rpc-statd
systemctl start nfs-idmapd

Next, we will enable firewalld and open the NFS, mountd and rpc-bind service ports so we can access NFS from other servers in our network.

systemctl start firewalld
firewall-cmd –permanent –zone public –add-service mountd
firewall-cmd –permanent –zone public –add-service rpc-bind
firewall-cmd –permanent –zone public –add-service nfs

Reload the firewalld configuration to apply the changes:

firewall-cmd –reload

To see the services that are allowed in the firewall, use following command:

firewall-cmd –list-all

Show Firewall ports.

Step 2 – Create a shared Directory

In this step, we will create a directory and share it with the proxmox server. I’ll create the directory ‘nfsproxmox‘ under the /var directory and change the permission to 777 so anyone can read and write to it.

mkdir -p /var/nfsproxmox
chmod -R 777 /var/nfsproxmox/

Please note, if this backup server is used for other services or is a multiuser system, then you should use stricter permissions like 755 or even 750 and chown the directory to the user that shall be able to write to it.

Next, modify the /etc/exports file to configure which directory to share, the client IP and other specific options.

vim /etc/exports

Add the configuration below:

/var/nfsproxmox 192.168.1.111(rw,sync,no_root_squash)

Save and exit.

/var/nfsproxmox = shared directory with read and write permission.
192.168.1.111 = nfs client IP address (In this tutorial we use Proxmox Server).
rw = Allow the both to read and write to the shared directory.
sync = Reply to requests only after the changes have been committed to stable storage. (Default)
no_root_squash = Allow the root user on the client machine have the same level and permission with root on the server to the shared directory.

Now export the shared directory with the following command:

exportfs -r

Other useful NFS commands are:

exportfs -a = export all shared directory on /etc/exports file configuration.
exportfs -v = display all shared directory.

The NFS configuration on the server is finished, and now we can move to the next stage, configure proxmox to use NFS.

Step 3 – Configure Proxmox to use NFS Storage

I’ll have a proxmox server with IP 192.168.1.111, installed with this tutorial.

Login to the proxmox server from the web browser:

https://192.168.1.111:8006/

Inside Proxmox web admin, click on “Datacenter” and then go to the tab “Storage”, click on “Add” and select NFS.

Add NFS share in Proxmox.

Now type in the NFS configuration details:

ID = Enter the name of the NFS, I’ll use “nfsproxmox” here.
Server IP = IP address of the NFS server, mine is 192.168.1.102.
Export = NFS shared directory – /var/nfsproxmox.
Content = Type of the file on the NFS server, Disk image, ISO file, Container, VZDump backup file etc.
Enable = Check it.
Max Backups = Maximum allowed backup of each VM.

And click “Add”.

Add nfs share.

Now you can see the new storage on the left side.

NFS Storage in Proxmox.

Step 4 – Backup VM on Proxmox to the NFS Storage

In this tutorial, I’ve one virtual machine with ID 100 named “debian”, and it’s live now. In this step, we will backup that VM to the NFS storage “nfsproxmox”.

Click on the VM name and go to tab “Backup” and click “Backup Now”.
Select all you need:

Storage = Our NFS name/ID.
Mode =
There are 3 backup modes:

  1. Snapshot (No Downtime, Online).
  2. Suspend (Same as Snapshot for KVM), Use suspend/resume and multiple rsync passes (OpenVZ and LXC).
  3. Stop = Shutdown the VM, then start KVM live backup and restart VM (Short Downtime.)

Compression = Available LZO and GZIP compression.

Click “Backup” to start the backup of the VM.

Start the VM backup in Proxmox.

Now you can see the backup task is running:

Backup is running.

To see the backup file, click on the nfs-id “nfsproxmox”, and click on the tab “Content”.

NFS backup content view.

Step 5 – Restore a VM from NFS Storage

To restore the VM, Click on the VM that you want to restore and then click on “Restore” on the NFS storage.

You can see the pop-up box:

Source = backup file.
Storage = On which storage the VM will be stored.
VM ID = ID for restored VM.

Click “Restore” to start the restore VM.

Start vm restore.

Restore VM process:

Proxmox restore process.

Note:

If you want to replace the VM, then you can select the VM that you want to replace and go to the tab “Backup”, there you will also see the backup file, select it and click “Restore”.

Replace VM from Backup

Conclusion

NFS (Network File System) is a distributed file system protocol to allow clients to access the files and directories on the NFS server as if they were stored locally. We can store our data files and directories on the NFS server and then share them with all clients that that we allowed in the exports file. NFS is very useful for virtual server backups. We can use NFS as Proxmox storage, we can put on that storage ISO files, Virtual machine images files and VM Backup files. NFS is easy to install and integrate with Proxmox from within the Proxmox web admin.

 




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Terminix: Promising New Tiling Terminal Emulator For GNOME 3

$
0
0
Terminix GTK3 tiling terminal emulator


Terminix features:

  • layout terminals in any fashion by splitting them horizontally or vertically
  • terminals can be re-arranged using drag and drop both within and between windows;
  • terminals can be detached into a new window via drag and drop;
  • input can be synchronized between terminals so commands typed in one terminal are replicated to the others;
  • the grouping of terminals can be saved and loaded from disk;
  • rerminals support custom titles;
  • color schemes are stored in files and custom color schemes can be created by simply creating a new file;
  • transparent background;
  • supports notifications when processes are completed out of view. Requires the Fedora notification patches for VTE.
Terminix GTK3 tiling terminal emulator
Terminix in GNOME Shell (Ubuntu 16.04) with Solarized Dark color scheme, terminal transparency
Terminix GTK3 tiling terminal emulator
Terminix GTK3 tiling terminal emulator
Terminix in Xfce (Xubuntu 16.04)

(direct video link)

Download Terminix

Arch Linux users can install Terminix via AUR.

On Fedora 23 and CentOS 7, you can install Terminix via the openSUSE Build Service.

sudo apt-get install wget unzip libglib2.0-bin
cd /tmp
wget https://github.com/gnunn1/terminix/releases/download/0.53.0/terminix.zip
sudo unzip terminix.zip -d /
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/

Terminix is currently in beta, so you’ll probably encounter bugs! Report any bug you may find @ GitHub.

 




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Install Interworx on CentOS 7

$
0
0

InterWorx is a hosting control panel purely based on Linux. It relies on the RPM package system for distribution of InterWorx itself, as well as for handling various software packages for web hosting platforms. Hence, It strongly recommends to have an RPM-compatible Linux distribution for installation.

In this article, I’m explaning about the installation of this control panel on a CentOS 7 server which is a RPM compatible Linux distribution. Previously the installation on this OS wasn’t supported. But I believe you guys will be happy to know that the new Interworx release version 5.1.5 is designed to support the latest RHEL/CentOS distribution.
InterWorx Control Panel runs on a variety of systems and hardware including Virtual Private Server (VPS) systems supported on OpenVZ, Virtuazzo, Xen and VMware. It is also supports CloudLinux platforms.

Minimum hardware requirements

  • Memory : at least 256 MB; 512MB is recommended
  • CPU : Pentium III 866 CPU
  • Disk Space : 512 MB; 1GB is recommeded

Pre-requisites

  • A linux server or a supported VPS systems as mentioned above with atleast minimum hardware requirements is needed.
  • A clean install of the RPM-compatible Linux distribution supported OS is needed.
  • A valid and active InterWorx Control Panel license key is required
  • UIDs 102 – 107 and GIDs 102 & 103 should be free to use.

Installation steps

1. Login to the server as root.

2. Download and run the installer script

sh <((curl -sL interworx.com/inst.sh))

This installation script will prompt you to proceed further. If you don’t want to be prompted after each configuration step, you can run the downloader script as below:

sh <((curl -sL interworx.com/inst.sh)) -l

I run the initial installer script to check the installation procedure one by one.

You will receive this prompt on initial setup. You can verify your OS settings ans press “enter” to proceed.

=-=-=-=-= Installing InterWorx-CP =-=-=-=-=-

This script will install InterWorx-CP on your system.
Please make sure that you have backed up any critical
data!

This script may be run multiple times without any
problems. This is helpful if you find an error
during installation, you can safely ctrl-c out of
this script, fix the error and re-start the script.

Details of this installation will be logged in iworx-install.log

TARGET : CentOS Linux release 7.0.1406 (Core)
PLATFORM : GNU/Linux
PROCESSOR : x86_64
RPM TARGET: rhe7x
RPM DISTRO: cos7x
RPM DIR : /usr/src/redhat/RPMS
SRPM DIR : /usr/src/redhat/SRPMS
SRPM HOST : updates.interworx.com
IWORX REPO: release

Press <enter> to begin the install…

Then it will proceed with the installation and remove the following packages listed below if it is pre-existed in the server.

InterWorx-CP needs to remove some packages that may conflict
The following packages will be removed (if they exist)
STATUS: – bind
STATUS: – redhat-config-bind
STATUS: – caching-nameserver
STATUS: – sendmail
STATUS: – postfix
STATUS: – exim
STATUS: – mutt
STATUS: – fetchmail
STATUS: – spamassassin
STATUS: – redhat-lsb
STATUS: – evolution
STATUS: – mod_python
STATUS: – mod_auth_mysql
STATUS: – mod_authz_ldap
STATUS: – mod_auth_pgsql
STATUS: – mod_auth_kerb
STATUS: – mod_perl
STATUS: – mdadm
STATUS: – dovecot
STATUS: – vsftpd
STATUS: – httpd-tools
Is this ok? (Y/n):

After proceeding with this prompt, it will complete the installation and you will get a message which will direct you to the control panel access.

-=-=-=-=-= Installation Complete! Next Step: License Activation! =-=-=-=-=-

To activate your license, go to
http://your-ip:2080/nodeworx/ or
https://your-ip:2443/nodeworx/
Also, check out http://www.interworx.com for news, updates, and support!

-=-=-=-=-= THANK YOU FOR USING INTERWORX! =-=-=-=-=-

You can either activate the license via CLI or you can activate it via browser by logging into the control panel.

Command Line license activation

You can login to the server as root user and run the script as below:

[root@server1 ~]# /home/interworx/bin/goiworx.pex

You will be prompted to provide your license key which will look like this “INTERWORX_XXXXXXXXXX“. Enter these details to activate the license via CLI. Make sure, the port 2443 is opened incase your server is firewalled.

License activation from Control Panel

You can login to the control panel using the URL http://your-ip:2080/nodeworx/ or https://your-ip:2443/nodeworx/. Now you will be directed to the login session as below:

interworx installation

Enter the details to proceed. Now you’ve done with the activation.

Once the license is activated, it will automatically configure the settings for the panel. Wait until the progress bar completes the setup.

interworx_installation_complete

You need to agree the license agreement to proceed and set the DNS to completes the Panel setup.

DNS_intrwx

Now you’ll have a Server Manager Panel (Nodeworx) and a Website Manager Panel (Siteworx). This is how you can access it.

Nodeworx:

nodeworx
You can manage your server from Nodeworx and manage your individual domain using Siteworx.

Siteworx:

Click the Siteworx icon next to the domain to access its siteworx panel.

siteworx1

siteworx

How to create a domain in Interworx

You can login to the Nodeworx and navigate through the options Siteworx >> Accounts >> Add Siteworx account to proceed.

account_creation
You can modify its account settings anytime, with the “Edit” option on the left hand side of the created account.

Advantages of Interworx

  • Provides the best performance with Apache 2.4.10 installed with 5.5.44-MariaDB and PHP 5.4.16 with primary installation
  • Provides SPAM filtering and Virus filtering interfaces which can be managed from Panel
  • Provides SNI support
  • Provides high-Availability Load Balancing At A Fraction Of The Price

I hope you guys enjoyed reading this article. It is a very light control panel which can be installed within a few minutes and it has a user friendly interface to manage the accounts efficiently. Since it is an RPM based Control Panel, all software installations/upgrades are independent and can be carried out easily,

I appreciate your valuable comments on this :).

Thank you and have a good day!!




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Update CURL with CPanel on CentOS 7

$
0
0

CURL is a simple module that allows you to connect and communicate to various types of servers using various types of protocols. Curl mainly supports http, https, ftp, gopher, telnet, dict, file, and ldap protocols. It also supports SMB, SMBS, IMAP, IMAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, TFT, HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, and user/password authentication.

We know that, an increasing amount of web applications has made the HTTP scripting more frequently requested and necessary. There is a high demand for such a tool which helps us to automatically extract information from the Web, upload, proxy or POST data to the web servers.

CURL is a simple commandline tool which can be used to do all these URL manipulations and data transfers. It is powered by libcurl, which is a library created by Daniel Stenberg.

It is mandatory to keep such softwares always updated, since there is a chance of hacking attempts, data diddling or loop holes due to old insecure versions. In this article, I’m discussing a simple method on how to update the Curl in a more efficient way to the latest available versions on a cPanel server.

First of all, check the current version installed on the server. Please see the current CURL version in my server below:

root@server1 [/usr/local/src]# /usr/bin/curl -V
curl 7.38.0 (x86_64-redhat-linux-gnu) libcurl/7.38.0 NSS/3.19.1 Basic ECC zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL UnixSockets

current_curl_status

As you can see the CURL version is 7.38 and is compiled to support these many protocols like dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet and tftp.

We are going to configure CURL with Asynchronous DNS to improve its performance and make the requests more faster without any delays. Let’s start our update process now.

Step 1. Download the latest Curl and Asynchronous DNS Package from their website and extract.

root@server1 [~]# cd /usr/local/src/
root@server1 [/usr/local/src]# wget http://c-ares.haxx.se/download/c-ares-1.10.0.tar.gz
–2016-01-26 06:29:25– http://c-ares.haxx.se/download/c-ares-1.10.0.tar.gz
Resolving c-ares.haxx.se (c-ares.haxx.se)… 2a00:1a28:1200:9::2, 80.67.6.50
Connecting to c-ares.haxx.se (c-ares.haxx.se)|2a00:1a28:1200:9::2|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 809073 (790K) [application/x-gzip]
Saving to: ‘c-ares-1.10.0.tar.gz’

100%[=====================================================================================================>] 8,09,073 1.18MB/s in 0.7s

2016-01-26 06:29:26 (1.18 MB/s) – ‘c-ares-1.10.0.tar.gz’ saved [809073/809073]

root@server1 [/usr/local/src]#tar -xvf c-ares-1.10.0.tar.gz
root@server1 [/usr/local/src]# wget http://curl.haxx.se/download/curl-7.46.0.tar.gz
–2016-01-26 06:29:59– http://curl.haxx.se/download/curl-7.46.0.tar.gz
Resolving curl.haxx.se (curl.haxx.se)… 2a00:1a28:1200:9::2, 80.67.6.50
Connecting to curl.haxx.se (curl.haxx.se)|2a00:1a28:1200:9::2|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 4551902 (4.3M) [application/x-gzip]
Saving to: ‘curl-7.46.0.tar.gz’

100%[=====================================================================================================>] 45,51,902 3.79MB/s in 1.1s

2016-01-26 06:30:01 (3.79 MB/s) – ‘curl-7.46.0.tar.gz’ saved [4551902/4551902]

root@server1 [/usr/local/src]#tar -xvf curl-7.46.0.tar.gz

Step 2. Configure, make and install the Asynchronous DNS package.

root@server1 [/usr/local/src/c-ares-1.10.0]# ./configure

root@server1 [/usr/local/src/c-ares-1.10.0]# make
make all-am
make[1]: Entering directory `/usr/local/src/c-ares-1.10.0′
/bin/sh ./libtool –tag=CC –mode=compile gcc -DHAVE_CONFIG_H -I. -I. -DCARES_BUILDING_LIBRARY -DCARES_SYMBOL_HIDING -fvisibility=hidden -g0 -O2 -Wno-system-headers -MT libcares_la-ares__close_sockets.lo -MD -MP -MF .deps/libcares_la-ares__close_sockets.Tpo -c -o libcares_la-ares__close_sockets.lo `test -f ‘ares__close_sockets.c’ || echo ‘./’`ares__close_sockets.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -DCARES_BUILDING_LIBRARY -DCARES_SYMBOL_HIDING -fvisibility=hidden -g0 -O2 -Wno-system-headers -MT libcares_la-ares__close_sockets.lo -MD -MP -MF .deps/libcares_la-ares__close_sockets.Tpo -c ares__close_sockets.c -fPIC -DPIC -o .libs/libcares_la-ares__close_sockets.o
make[1]: Leaving directory `/usr/local/src/c-ares-1.10.0’

root@server1 [/usr/local/src/c-ares-1.10.0]# make install

/usr/bin/install -c -m 644 ares_version.3 ares_inet_pton.3 ares_inet_ntop.3 ‘/usr/local/share/man/man3’
/usr/bin/mkdir -p ‘/usr/local/lib/pkgconfig’
/usr/bin/install -c -m 644 libcares.pc ‘/usr/local/lib/pkgconfig’
make[1]: Leaving directory `/usr/local/src/c-ares-1.10.0′

Step 3. Now configure CURL with Asynchornous DNS and all other required Protocols.

root@server1 [/usr/local/src/curl-7.46.0]# ./configure –enable-ares=/usr/local/src/c-ares-1.10.0 –enable-http –enable-imap –enable-pop3 –enable-ftp –enable-proxy –enable-tftp –enable-ntlm –enable-static –with-ssl=/usr/local/ssl –enable-ipv6 –enable-shared –disable-ldap –enable-gobher –enable-smtp –with-libidn –disable-rtsp –without-zlib
root@server1 [/usr/local/src/curl-7.46.0]#make
curl version: 7.46.0
Host setup: x86_64-pc-linux-gnu
Install prefix: /usr/local
Compiler: gcc
SSL support: enabled (OpenSSL)
SSH support: no (–with-libssh2)
zlib support: no (–with-zlib)
GSS-API support: no (–with-gssapi)
TLS-SRP support: no (–enable-tls-srp)
resolver: c-ares
IPv6 support: enabled
Unix sockets support: enabled
IDN support: enabled
Build libcurl: Shared=yes, Static=yes
Built-in manual: enabled
–libcurl option: enabled (–disable-libcurl-option)
Verbose errors: enabled (–disable-verbose)
SSPI support: no (–enable-sspi)
ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt
ca cert path: no
LDAP support: no (–enable-ldap / –with-ldap-lib / –with-lber-lib)
LDAPS support: no (–enable-ldaps)
RTSP support: no (–enable-rtsp)
RTMP support: no (–with-librtmp)
metalink support: no (–with-libmetalink)
PSL support: no (libpsl not found)
HTTP2 support: disabled (–with-nghttp2)
Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S SMB SMBS SMTP SMTPS TELNET TFTP
root@server1 [/usr/local/src/curl-7.46.0]# make install
Making install in lib
make[1]: Entering directory `/usr/local/src/curl-7.46.0/lib’
make[2]: Entering directory `/usr/local/src/curl-7.46.0/lib’
/usr/bin/mkdir -p ‘/usr/local/lib’
/bin/sh ../libtool –mode=install /usr/bin/install -c libcurl.la ‘/usr/local/lib’
libtool: install: /usr/bin/install -c .libs/libcurl.so.4.4.0 /usr/local/lib/libcurl.so.4.4.0
libtool: install: (cd /usr/local/lib && { ln -s -f libcurl.so.4.4.0 libcurl.so.4 || { rm -f libcurl.so.4 && ln -s libcurl.so.4.4.0 libcurl.so.4; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libcurl.so.4.4.0 libcurl.so || { rm -f libcurl.so && ln -s libcurl.so.4.4.0 libcurl.so; }; })
libtool: install: /usr/bin/install -c .libs/libcurl.lai /usr/local/lib/libcurl.la
libtool: install: /usr/bin/install -c .libs/libcurl.a /usr/local/lib/libcurl.a
libtool: install: chmod 644 /usr/local/lib/libcurl.a
libtool: install: ranlib /usr/local/lib/libcurl.a
libtool: finish: PATH=”/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/sbin” ldconfig -n /usr/local/lib
———————————————————————-
Libraries have been installed in:
/usr/local/lib

Step 4 . Edit the file /var/cpanel/easy/apache/rawopts/all_php5 to enable custom CURL module with our downloaded latest asynchronous DNS package as below

root@server1 [~]# vim /var/cpanel/easy/apache/rawopts/all_php5
–with-gssapi
–with-curl=/usr/local/src/curl-7.46.0
–enable-ares=/usr/local/src/c-ares-1.10.0

Step 5. Run EasyApache to configure and install the latest CURL package.

root@server1 [~]#/scripts/easyapache

Step 6. Check and confirm the version and settings of the newly installed Curl version.

root@server1 [~]# curl-config –version
libcurl 7.46.0
root@server1 [/usr/local/src/curl-7.46.0]# curl-config –features –protocols
SSL
IPv6
UnixSockets
AsynchDNS
IDN
NTLM
NTLM_WB
DICT
FILE
FTP
FTPS
GOPHER
HTTP
HTTPS
IMAP
IMAPS
POP3
POP3S
SMB
SMBS
SMTP
SMTPS
TELNET
TFTP
root@server1 [/usr/local/src/curl-7.46.0]# curl –version
curl 7.46.0 (x86_64-pc-linux-gnu) libcurl/7.46.0 OpenSSL/1.0.1e c-ares/1.10.0 libidn/1.28
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL UnixSockets

Now you see our CURL is updated to the latest version available CURL 7.46.0 and it’s compiled with Asynchronous DNS to support all the required protocols. You can confirm the compiled curl status with a PHPINFO page.

curl_latest

PHP can be coded to make use of these asynchronous CURL requests to fasten the script execution more efficiently. I hope you find this article useful and informative. I would recommend your valuable comments and suggestions on this.

Enjoy!!




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

How to Set Nginx as Reverse Proxy on Centos7 CPanel

$
0
0

Nginx is one of the fastest and most powerful web-server. It is known for its high performance and low resource utilization. It can be installed as both a standalone and a Reverse Proxy Web-server. In this article, I’m discussing about the installation of Nginx as a reverse proxy along with Apache on a CPanel server with latest CentOS 7 installed.

Nginx as a reverse proxy will work as a frontend webserver serving static contents along with Apache serving the dynamic files in backend. This setup will boost up the overall server performance.

Let’s walk through the installation steps for Nginx as reverse proxy in CentOS7 x86_64 bit server with cPanel 11.52 installed.

First of all, we need to install the EPEL repo to start-up with the process.

Step 1 : Install the EPEL repo.

root@server1 [/usr]# yum -y install epel-release
Loaded plugins: fastestmirror, tsflags, universal-hooks
Loading mirror speeds from cached hostfile
* EA4: 66.23.237.210
* base: mirrors.linode.com
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Resolving Dependencies
–> Running transaction check
—> Package epel-release.noarch 0:7-5 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================
Installing:
epel-release noarch 7-5 extras 14 k

Step 2: After installing the repo, we can start with the installation of the nDeploy RPM repo for CentOS to install our required nDeploy Webstack and Nginx plugin.

root@server1 [/usr]# yum -y install http://rpm.piserve.com/nDeploy-release-centos-1.0-1.noarch.rpm
Loaded plugins: fastestmirror, tsflags, universal-hooks
nDeploy-release-centos-1.0-1.noarch.rpm | 1.7 kB 00:00:00
Examining /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm: nDeploy-release-centos-1.0-1.noarch
Marking /var/tmp/yum-root-ei5tWJ/nDeploy-release-centos-1.0-1.noarch.rpm to be installed
Resolving Dependencies
–> Running transaction check
—> Package nDeploy-release-centos.noarch 0:1.0-1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================
Installing:
nDeploy-release-centos noarch 1.0-1 /nDeploy-release-centos-1.0-1.noarch 110

Step 3: Install the nDeploy and Nginx nDeploy plugins.

root@server1 [/usr]# yum –enablerepo=ndeploy install nginx-nDeploy nDeploy
Loaded plugins: fastestmirror, tsflags, universal-hooks
epel/x86_64/metalink | 9.9 kB 00:00:00
epel | 4.3 kB 00:00:00
ndeploy | 2.9 kB 00:00:00
(1/4): ndeploy/7/x86_64/primary_db | 14 kB 00:00:00
(2/4): epel/x86_64/group_gz | 169 kB 00:00:00
(3/4): epel/x86_64/primary_db | 3.7 MB 00:00:02

Dependencies Resolved

===============================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================
Installing:
nDeploy noarch 2.0-11.el7 ndeploy 80 k
nginx-nDeploy x86_64 1.8.0-34.el7 ndeploy 36 M
Installing for dependencies:
PyYAML x86_64 3.10-11.el7 base 153 k
libevent x86_64 2.0.21-4.el7 base 214 k
memcached x86_64 1.4.15-9.el7 base 84 k
python-inotify noarch 0.9.4-4.el7 base 49 k
python-lxml x86_64 3.2.1-4.el7 base 758 k

Transaction Summary
===============================================================================================================================================
Install 2 Packages (+5 Dependent packages)

With these steps, we’ve completed with the installation of Nginx plugin in our server. Now we need to configure Nginx as reverse proxy and create the virtualhost for the existing cPanel user accounts. For that we can run the following script.

Step 4: To enable Nginx as a front end Web Server and create the default configuration files.

root@server1 [/usr]# /opt/nDeploy/scripts/cpanel-nDeploy-setup.sh enable
Modifying apache http and https port in cpanel

httpd restarted successfully.
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_watcher.service to /usr/lib/systemd/system/ndeploy_watcher.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/ndeploy_backends.service to /usr/lib/systemd/system/ndeploy_backends.service.
ConfGen:: saheetha
ConfGen:: satest

As you can see these script will modify the Apache port from 80 to another port to make Nginx run as a front end web server and create the virtual host configuration files for the existing cPanel accounts. Once it is done, confirm the status of both Apache and Nginx.

Apache Status:

root@server1 [/var/run/httpd]# systemctl status httpd
● httpd.service – Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2016-01-18 06:34:23 UTC; 12s ago
Process: 25606 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 24760 (httpd)
CGroup: /system.slice/httpd.service
‣ 24760 /usr/local/apache/bin/httpd -k start

Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Starting Apache Web Server…
Jan 18 06:34:23 server1.centos7-test.com apachectl[25606]: httpd (pid 24760) already running
Jan 18 06:34:23 server1.centos7-test.com systemd[1]: Started Apache Web Server.

Nginx Status:

root@server1 [~]# systemctl status nginx
● nginx.service – nginx-nDeploy – high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2016-01-17 17:18:29 UTC; 13h ago
Docs: http://nginx.org/en/docs/
Main PID: 3833 (nginx)
CGroup: /system.slice/nginx.service
├─ 3833 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
├─25473 nginx: worker process
├─25474 nginx: worker process
└─25475 nginx: cache manager process

Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Starting nginx-nDeploy – high performance web server…
Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jan 17 17:18:29 server1.centos7-test.com nginx[3804]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jan 17 17:18:29 server1.centos7-test.com systemd[1]: Started nginx-nDeploy – high performance web server.

Nginx act as a frontend webserver running on port 80 and Apache configuration is modified to listen on http port 9999 and https port 4430. Please see their status below:

root@server1 [/usr/local/src]# netstat -plan | grep httpd
tcp 0 0 0.0.0.0:4430 0.0.0.0:* LISTEN 17270/httpd
tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 17270/httpd
tcp6 0 0 :::4430 :::* LISTEN 17270/httpd
tcp6 0 0 :::9999 :::* LISTEN 17270/httpd

apacheport
root@server1 [/usr/local/src]# netstat -plan | grep nginx
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 17802/nginx: master
tcp 0 0 45.79.183.73:80 0.0.0.0:* LISTEN 17802/nginx: master

The virtualhost entries created for the existing users as located in the folder “/etc/nginx/sites-enabled“. This file path is included in the Nginx main configuration file.

root@server1 [/etc/nginx/sites-enabled]# ll | grep .conf
-rw-r–r– 1 root root 311 Jan 17 09:02 saheetha.com.conf
-rw-r–r– 1 root root 336 Jan 17 09:02 saheethastest.com.conf

Sample Vhost for a domain:

server {

listen 45.79.183.73:80;
#CPIPVSIX:80;

# ServerNames
server_name saheetha.com www.saheetha.com;
access_log /usr/local/apache/domlogs/saheetha.com main;
access_log /usr/local/apache/domlogs/saheetha.com-bytes_log bytes_log;

include /etc/nginx/sites-enabled/saheetha.com.include;

}

We can confirm the working of the web server status by calling a website in the browser. Please see the web server information on my server after the installation.

root@server1 [/home]# ip a | grep -i eth0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
inet 45.79.183.73/24 brd 45.79.183.255 scope global dynamic eth0
root@server1 [/home]# nginx -v
nginx version: nginx/1.8.0

webserver-status

Nginx will create the virtual host automatically for any newly created accounts in cPanel. With these simple steps we can configure Nginx as reverse proxy on a CentOS 7/CPanel server.

Advantages of Nginx as Reverse Proxy:

  1. Easy to install and configure
  2. Performance and efficiency
  3. Prevent DDOS attacks
  4. Allows .htaccess PHP rewrite rules

I hope this article is useful for you guys. Thank you for referring to this. I would appreciate your valuable comments and suggestions on this for further improvements.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Install miniBB forum on CentOS 7

$
0
0

minibbminiBB or Mini Bulletin Board is a PHP based standalone, open source program for building your own Internet forums. In this tutorial we will install miniBB on a CentOS 7 VPS with Apache, PHP and MariaDB.

 

Log in to your CentOS server via SSH as user root

ssh rooot@your_IP

and first of all make sure that all packages installed on your server are up to date:

yum -y update

miniBB requires and empty database, so we will have to install a database server. Run the following command to install MariaDB server:

yum install mariadb mariadb-server

Start the MariaDB database server and enable it to start at the boot time:

systemctl start mariadb
systemctl enable mariadb

Run the ‘mysql_secure_installation’ script to secure the database server and set your MariaDB root password.

Log in to the MariaDB server using the MySQL ‘root’ user and create new database and user for miniBB:

mysql -u root -p

CREATE DATABASE minibb;
CREATE USER 'minibbuser'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON `minibb`.* TO 'minibbuser'@'localhost';
FLUSH PRIVILEGES;

Don’t forget to replace ‘PASSWORD’ with a strong password.

Install Apache web server

yum install httpd

Start the web server and add it to automatically start on the system start-up:

systemctl start httpd
systemctl enable httpd

miniBB is a PHP based application and it requires PHP. So, install PHP on your server:

yum install php php-common

Download the latest stable release of miniBB forum from their official website. At the moment of writing this article it is version 3.2.1.

Unpack the downloaded zip archive to the document root directory on your server:

unzip minibb.zip -d /var/www/html

If you are not sure where is your document root directory you can use the following command to find out:

grep -i '^documentroot' /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"

Change the ownership of the miniBB files:

chown -R apache:apache /var/www/html/minibb

Now, open the ‘setup_options.php’ file which contains almost every common option of miniBB. We will enter the information of the MySQL database we created in this post and create a new administrator user.

vim /var/www/html/minibb/setup_options.php

$DBhost='localhost';
$DBname='minibb';
$DBusr='minibbuser';
$DBpwd='PASSWORD';
$admin_usr = 'ADMIN_USR';
$admin_pwd = 'ADMIN_PASSWORD';
$admin_email = 'admin@yourdomain.com';
$main_url='http://yourdomain.com';

More information about the options available in the configuration file you can find at miniBB’s official website

Next, create Apache virtual host for your domain. Create ‘/etc/httpd/conf.d/vhosts.conf’ file with the following content

vim /etc/httpd/conf.d/vhosts.conf

IncludeOptional vhosts.d/*.conf

and create the virtual host

vim /etc/httpd/vhosts.d/yourdomain.com.conf

<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot "/var/www/html/minibb/"
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ErrorLog "/var/log/httpd/yourdomain.com-error_log"
CustomLog "/var/log/httpd/yourdomain.com-access_log" combined

<Directory "/var/www/html/minibb/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Restart the Apache web server for the changes to take effect.

systemctl restart httpd

Now, navigate your favorite web browser to http://yourdomain.com/_install.php to finish the miniBB installation.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back

Install Ghost with Nginx on CentOS 7

$
0
0

ghostGhost is a free and open source blogging platform written in JavaScript and built on Node.js, designed to simplify the process of online publishing for individual bloggers as well as online publications.

The Ghost user interface is very simple and straightforward making it great for beginners as well as advanced users.

In this article we will install Ghost with Nginx on a CentOS 7 VPS. We will use our SSD 1 Linux VPS hosting plan with a clean CentOS environment which means that there is no PHP, Nginx and MySQL installed. We will only need PHP-FPM and Nginx for this tutorial, but if you need to install a full LEMP stack on CentOS 7 then you can easily do that by following our excellent article.

UPDATE THE SYSTEM

As always, make sure your server is fully up-to-date. Also install unzip and a text editor of your choice. We will use nano:

# yum update && yum install unzip nano

Install the EPEL repository after which you will be able to install Node.js and npm:

# yum install epel-release -y

Now install Node.js and npm:

# yum install nodejs npm --enablerepo=epel

Next, install a process manager so you can control your Node.js applications. This process manager will allow you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks. Enter the following command:

# npm install pm2 -g

Your next step is to install Nginx and PHP-FPM along with some much needed dependencies:

# yum install nginx php php-fpm php-cli php-mysql php-curl php-gd

Start Nginx and enable it to start on boot:

# systemctl start nginx
# systemctl enable nginx

INSTALL GHOST

First, create a directory for your Ghost website:

# mkdir /var/www/html/your_site

Enter the newly created dir:

# cd /var/www/html/your_site

Download the latest Ghost version:

# curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip

Unzip the archive:

# unzip ghost.zip

Delete the archive:

# rm ghost.zip

Now install the app with the npm installer:

# npm install -production

After the installation is completed, configure Ghost and update the URL in the config file with your domain. Copy the example config into a new file:

# cp config.example.js config.js

Open the file:

# nano config.js

Find the ‘Production’ section and update the URL with your domain. After modifying it should look like this:

// ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://your_domain',

Save and close the file.

Now you can use the process manager that we installed earlier to configure Ghost to run forever. Execute the below command:

# NODE_ENV=production pm2 start index.js --name "Ghost"

To start/stop/restart Ghost you can use:

# pm2 start Ghost

# pm2 stop Ghost

# pm2 restart Ghost

Your next step is to configure Nginx to act as a reverse proxy for your Ghost application. Open a config file:

# nano /etc/nginx/conf.d/your_domain.conf

Paste the following:

upstream ghost {
    server 127.0.0.1:2368;
}

server {
    listen      80;
    server_name your_domain;

    access_log  /var/log/nginx/ghost.access.log;
    error_log   /var/log/nginx/ghost.error.log;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

location / {
        proxy_pass  http://ghost;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;
    }

}

Don’t forget to replace your_domain with your actual domain. Save and close the file.

Test the Nginx configuration and restart Nginx so the changes can take effect:

# nginx -t

# service nginx restart

Congratulations, you have successfully installed Ghost on your CentOS 7 VPS. Now open your favorite web browser and navigate to http://your_domain/ghost and create an admin user.

For more information about how manage your Ghost blog ,please refer to the their website.




FacebookTwitterDiggStumbleUponGoogle Plus



RSS Feed Powered by MaxBlogPress Bring My Blog Visitors Back
Viewing all 4268 articles
Browse latest View live