Install Zabbix on Centos 7

Zabbix requires Apache-Mysql-PHP stack to be installed in order to run. You can follow this previous post.
Let’s download and install Zabbix

rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

We have to edit timezone in /etc/httpd/conf.d/zabbix

php_value date.timezone Europe/Athens
service httpd restart

Create a database or Zabbix

mysql -u root -p
create database zabbix character set utf8;
grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'password';
flush privileges;
exit
mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.3/create/schema.sql
mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.3/create/images.sql
mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.3/create/data.sql

Edit /etc/zabbix/zabbix_server.conf to set up zabbix database credentials
Start the zabbix-server process

service zabbix-server start
systemctl enable zabbix-server.service

Finally add the necessary firewall rules for snmp and zabbix agent

firewall-cmd --permanent --add-port=161/udp
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --reload

Windows agent
Download from:
http://www.zabbix.com/download.php
Unpack and copy to C:\
edit conf/zabbix_agentd.win.conf and add serverip under ‘Passive’ mode
Rename file to zabbix_agentd.conf
Run from command propmt in C:\install_dir –> zabbix_agentd.exe –install

Posted in Linux | Leave a comment

Install LAMP and WordPress on Centos 7

Install Mysql (MariaDB) and set password

yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation

Install Apache

yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service

Open ports in firewall

firewall-cmd --permanent --zone=public --add-service=http 
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

Install PHP

yum -y install php
systemctl restart httpd.service
yum -y install php-mysql
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
systemctl restart httpd.service

Now we are ready to install WordPress. Let’s create a database and a user for wordpress to work with.

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER [email protected] IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO [email protected] IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit

Now let’s download and install WordPress

wget http://wordpress.org/latest.tar.gz 
tar xzvf latest.tar.gz
rsync -avP ~/wordpress/ /var/www/html/
mkdir /var/www/html/wp-content/uploads
chown -R apache:apache /var/www/html/*

Next we will configure WordPress

cd /var/www/html
cp wp-config-sample.php wp-config.php

Now we need to modify the following parameters that hold our database information in “wp-config.php” file

vim wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

Now we can complete the WordPress installation through the web interface. In your web browser, navigate to your server’s domain name or public IP address and fill the required information.

Posted in Linux | Leave a comment

Centos 7 – initial setup

Here I am assuming that we started with the minimal installation of Centos 7.
Let’s install some useful packages

yum install wget vim mc ntp net-tools

Now let’s configure the timezone and start the ntp service

timedatectl list-timezones | grep Athens
timedatectl set-timezone Europe/Athens
systemctl start ntpd.service
systemctl enable ntpd.service

Next we will change ssh default port. Edit ssh config file and uncomment Port putting your desired port number.

vim /etc/ssh/ssh_config
systemctl reload sshd.servive

Now let’s disable SElinux changing config file to SELINUX=disabled

vim /etc/sysconfig/selinux

Finally let’s configure firewall

systemctl status firewalld

Show configuration

firewall-cmd --permanent --list-all

Allow port

firewall-cmd --permanent --add-port=4311/tcp

Allow service

firewall-cmd --get-services
firewall-cmd --permanent --add-service=http

Remove service or port

firewall-cmd --permanent --remove-service=http
firewall-cmd --permanent --remove-port=4311/tcp

Reload and start at boot

firewall-cmd --reload
systemctl enable firewalld
Posted in Linux | Leave a comment

Working with mysql CLI

Login

mysql -u username -p

Show databases;

show databases;

Use database;

use db_name;

List tables;

show tables;

Show table fields

describe table_name;

OR

show columns from table_name;

Select fields from table

select column1,column2 from table_name;

Update record

update table_name set column='test1' where column='test2';

Delete record

delete from table_name where column='test';

Backup database (not logged in to mysql)

mysqldump -u username -ppassword db_name > db_backup_file.sql

Backup certain tables from database

mysqldump -u username -ppassword db_name table_name1 table_name2 > db_backup_file.sql

Backup more than one database

mysqldump -u username -ppassword --databases db_name1 db_name2 > db_backup_file.sql

Backup all databases

mysqldump -u username -ppassword --all-databases > db_backup_file.sql

Restore database (if database does not exist)

mysql -u username -p password db_name < db_backup_file.sql

Restore database (existing database)

mysqlimport -u username -p password db_name < db_backup_file.sql

Show Database size

SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" 
FROM information_schema.TABLES GROUP BY table_schema ;
Posted in Web | Leave a comment

Getting things done from command prompt

Find windows install date

systeminfo | find "Original Install Date"

Find computer name

hostname

Find domain

echo %userdomain%

Restart service

net stop "Print Spooler" && net start "Print Spooler"

Manage firewall
–ON

NetSh Advfirewall set allrprofiles state on

–OFF

NetSh Advfirewall set allrprofiles state off

–Check status

Netsh Advfirewall show allprofiles

Check if Remote Desktop is enabled

nestat -an | find "3389"

Find logged in username

echo %username%

List users

net users 

Details about a user

net users administrator

List network connections and ports

netsat -an

Find logged in username/domain

whoami

Show admin shares

net share
Posted in Windows | Leave a comment

HP MSA P2000 G3 – View live performance statistics in CLI

The HP P2000 G3 MSA Arrays have statistical counters that provide array performance measurements across different levels, such as disks, Vdisks, host ports, controllers, and volumes. Each component supports a list of performance metrics such as IOPS, Queue Depth, and Bytes per second.With the following commands we can get these live performance statistics.

show controller-statistics
show Vdisk-statistics
show disk-statistics
show volume-statistics
show host-port-statistics
Posted in Datacenter | Leave a comment

Useful Windows keyboard shortcuts

Open Task Manager –> ctrl+shift+esc
Quit program –> alt+F4
Right click –> shift+F10
Main window menu(minimize…) –> alt+space
Open menu in a program –> alt
open properties –> alt+enter
create new folder –>ctrl+shift+n
Cursor in address bar –> alt+d
Search –> F3
New tab –> ctrl+t
Use the arrow keys to switch between open items –> alt+tab+arrows(alt pressed)
Go up one level –> alt+up arrow
Move through tabs –> ctrl+tab
move backwards through tabs –> ctrl+shift+tab
System properties –> win+pause
Focus on the taskbar –> win+t
Shutdown menu –> alt+F4
Preview the desktop –> win+space
Maximize window –> win+up arrow
Minimize window –> win+down arrow
Projector –> win+p

Posted in Windows | Leave a comment