Friday 22 January 2016

How to Install MRTG On Centos/RHEL 6


Install MRTG On Centos/RHEL 6

Install MRTG (Multi Router Traffic Grapher) to see network traffic data on the web


Step 1:Install Apache HTTP Server

# yum -y install httpd httpd-devel

Step 2:Install MRTG, SNMP

#  yum -y install net-snmp net-snmp-utils mrtg

Step 3: Configure SNMP (Simple Network Management Protocol)

# vi /etc/snmp/snmpd.conf

# line 41: comment out

#com2sec notConfigUser   default       public

# line 74,75: uncomment and change
# change to your local network for "mynetwork" section
# change comunity name except public or private

com2sec local localhostServerworld
com2sec mynetwork 10.0.0.0/24Serverworld

# line 78,79: uncomment
group MyRWGroup  any        local
group MyROGroup  any        mynetwork

# line 85: uncomment
view all    included  .1                               80

# line 93,94: uncomment
access MyROGroup ""      any       noauth    0      all    none   none
access MyRWGroup ""      any       noauth    0      all    all    all

--- save and quit (:wq) ---

Then start the snmp service:

# service snmpd start
# chkconfig snmpd on

## show status (replace the "Serverworld" to your comunity name)

# snmpwalk -v2c -c Serverworld localhost system

SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.server.world 2.6.32-504.3.3.el6.x86_64 #1 SMP
Wed Dec 17 01:55:02 UTC 2014 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (168142) 0:28:01.42
...
...
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (4) 0:00:00.04
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (4) 0:00:00.04

Step 4: Configure MRTG

# cfgmaker --ifref=descr --ifdesc=descr Serverworld@10.0.0.30 > /etc/mrtg/mrtg.cfg
# vi /etc/mrtg/mrtg.cfg

# line 9: add
WorkDir: /var/www/mrtg

# line 16: uncomment
Options[_]: growright, bits

# near line 73: make sure lines like follows are uncommented (change ip as your and

'Serverworld' as your community name)

Target[10.0.0.30_eth0]: \eth0:Serverworld@192.168.100.156:
SetEnv[10.0.0.30_eth0]: MRTG_INT_IP="10.0.0.30" MRTG_INT_DESCR="eth0"
MaxBytes[10.0.0.30_eth0]: 125000000
Title[10.0.0.30_eth0]: eth0 -- dlp.server.world
PageTop[10.0.0.30_eth0]: <h1>eth0 -- dlp.server.world</h1>

## execute mrtg 3 times (display warnings until 3 times)

# for (( i=1 ; i <= 3 ; i++ )); do env LANG=C mrtg /etc/mrtg/mrtg.cfg; done

2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup could not read the primary log file for

10.0.0.30_eth0
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup The backup log file for 10.0.0.30_eth0

was invalid as well
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup Can't remove 10.0.0.30_eth0.old updating

log file
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup Can't rename 10.0.0.30_eth0.log to

10.0.0.30_eth0.old updating log file
2015-01-25 21:33:23, Rateup WARNING: /usr/bin/rateup Can't remove 10.0.0.30_eth0.old updating

log file

## generate index file

# indexmaker --columns=1 /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html

# updating is done automatically by cron

# cat /etc/cron.d/mrtg

*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file

/var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok

Step 5: Configure httpd to access MRTG

# vi /etc/httpd/conf.d/mrtg.conf

# line 11: add IP address you allow to access
Allow from 127.0.0.1 10.0.0.0/24

##restart httpd:

#  /etc/rc.d/init.d/httpd restart
or
# service httpd restart

Step 6: Access to the MRTG Panel from a client with HTTP

http://(MRTG hostname or IP address)/mrtg/

then it's possible to see MRTG site.


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog.

How to Install zen-cart on centos 6


Install ZenCart on Centos/RHEL 6.X

Step 1: Configure LAMP

A. Install LAMP 


Step 2: Download the latest version of Zen Cart and Install

# wget http://nchc.dl.sourceforge.net/project/zencart/CURRENT%20-%20Zen%20Cart%201.5.x

%20Series/zen-cart-v1.5.4-12302014.zip
# unzip zen-cart-*.zip -d /var/www/html/
# mv /var/www/html/zen-cart-* /var/www/html/zen-cart/

Step 3: Create Database

# mysql -u root -predhat

mysql> CREATE DATABASE zencart;
mysql> CREATE USER 'zencartuser'@'localhost' IDENTIFIED BY 'your-password-here';
mysql> GRANT ALL PRIVILEGES ON zencart.* TO 'zencartuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> \q

Step 4: Also, create a new virtual host in Apache, for example

# vi /etc/httpd/conf.d/zen-cart.conf

<VirtualHost *:80>
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/zen-cart/
ServerName your-domain.com
ServerAlias www.your-domain.com
ErrorLog logs/your-domain.com-error_log
CustomLog logs/your-domain.com-access_log common
</VirtualHost>

-- save and quit (:wq) --

Step 5: Set the permissions for these files and directories to 777 using the following commands

# cd /var/www/html/zen-cart/
# mv admin/includes/dist-configure.php admin/includes/configure.php
# mv includes/dist-configure.php includes/configure.php
# chmod 777 admin/includes/configure.php
# chmod 777 includes/configure.php
# chmod 777 cache
# chmod 777 includes/languages/english/html_includes
# chmod 777 logs
# chmod 777 media
# chmod 777 pub
# chmod 777 images/
# chmod 777 admin/backups
# chmod 777 admin/images/graphs

Step 6: Open the following and follow the instructions

http://Your-IP-Address/zen-cart/zc_install/index.php


Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog.

How to Install PHP 7 on Centos



Install PHP 7 on Centos


Step 1: you must add the Webtatic EL yum repository information corresponding to your CentOS/RHEL version to yum


CentOS/RHEL 7.x:


# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:


# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Step 2: Now you can install PHP 7.0 (along with an opcode cache) by doing

# yum install -y --enablerepo=webtatic-testing php70w php70w-opcache php70w-bcmath php70w-cli
php70w-common php70w-dba php70w-devel php70w-embedded php70w-enchant php70w-fpm php70w-gd php70w-imap php70w-interbase php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysql php70w-mysqlnd php70w-odbc php70w-pdo php70w-pdo_dblib php70w-pgsql php70w-process php70w-pspell php70w-recode php70w-snmp php70w-soap php70w-tidy php70w-xml php70w-xmlrpc

Step 3: Changes on the Module File for Php

# vi /etc/httpd/conf.d/php.conf

-- Line number 6 and 10 replace with these Lines

LoadModule php7_module modules/libphp7.s (replace with line nuber 6)
LoadModule php7_module modules/libphp7-zts.so (replace with line number 10)
AddHandler php7-script .php (replace with line number 16)

-- save and quit (:wq) --

Step 4: Create a php info file and check

# vi /var/www/html/info.php

<?php
phpinfo();
?>

-- save and quit (:wq) --

# service httpd restart

Step 5: check in browser http://IP-Address/info.php or check through CLI

# php -v

PHP 7.0.0RC2 (cli) (built: Sep  4 2015 21:04:20)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog.

How to Install Mysql 5.7 on Centos 6.X/7.X


Mysql 5.7 on Centos 6.X/7.X

Step 1: Save the Repo File for The MySql 5.7 or Install the RPM for Mysql 5.7

# vi /etc/yum.repos.d/mysql-community.repo

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

--- save n quit (:wq) ---

or,

On RHEL/CentOS 7

# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
# yum localinstall mysql57-community-release-el7-7.noarch.rpm

On RHEL/CentOS 6

# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
# yum localinstall mysql57-community-release-el6-7.noarch.rpm

Step 2: Install Mysql 5.7

# yum install mysql-community-server -y

Step 3: Reset the Mysql Temporary root Password and Chacge the password Policy

# vi /etc/my.cnf

add these lines below [mysqld]

validate_password_policy=LOW
validate_password_length=6
validate_password_dictionary_file=YES
validate_password_special_char_count =0
validate_password_mixed_case_count = 0

--- save and quit (:wq) ---

# service mysqld start


# cat /var/log/mysqld.log |grep "temporary password"
2015-09-06T16:46:46.109066Z 1 [Note] A temporary password is generated for root@localhost: <Password>

# mysql_secure_installation

Enter password for user root: <Enter the Temporary Password>

The existing password for the user account root has expired. Please set a new password.

New password: <New Password>

Re-enter new password: <Retype the Password>

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
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? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

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

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

Step 4: Check the Version and Mysql Once

# mysql -u root -p<password>

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.10 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.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> \q
Bye

# mysql --version

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog.