Posts Tagged with centos

posted by qubix on December 26, 2020

Well I had this old monitoring VM that needed to go from a nagios based monitoring to a zabbix based one.


The first culprit was that centos 6 was EOL forever and many things didn't work or needed some kind of fix.

Well this thing was stuck now at 6.6 centos. Since ver 6 is EOL, we have to use vault repos to update to latest 6 sources

So lets change the base repo contents with these: [C6.10-base] name=CentOS-6.10 - Base baseurl=$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=1 metadata_expire=never [C6.10-updates] name=CentOS-6.10 - Updates baseurl=$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=1 metadata_expire=never [C6.10-extras] name=CentOS-6.10 - Extras baseurl=$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=1 metadata_expire=never [C6.10-contrib] name=CentOS-6.10 - Contrib baseurl=$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=0 metadata_expire=never [C6.10-centosplus] name=CentOS-6.10 - CentOSPlus baseurl=$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=0 metadata_expire=never

before doing anything else lets grub the EPEL repo for this centos rpm --import rpm -Uvh yum install -y

now lets update stuff

yum clean && yum update

ok now we have updated our system in the latest possible software


The second culprit was that zabbix frontend requires php 5.4 and up, but centos 6 has 5.3.3 We will not use remi repos here, they are not complete and noone knows how long will support this centos version Instead...lets install php from source! yeaaahh :P

  • install required packages for compilation yum install autoconf libtool re2c bison libxml2-devel bzip2-devel libcurl-devel libpng-devel libicu-devel gcc-c++ libmcrypt-devel libwebp-devel libjpeg-devel openssl-devel libxslt-devel -y

  • grub php 5.6.40 (latest php 5.6) and untar/unzip the contents curl -O -L

tar -xvf php-5.6.40.tar.gz cd php-src-php-5.6.40/

now lets compile php

./buildconf --force

after we buildconf, we can customize with what we want to compile php. See ./configure --help about that to satisfy your needs

lets continue with our config ./configure --prefix=/usr/local/php56 --with-apxs2=/usr/sbin/apxs --with-freetype-dir=/usr/include/freetype2 --disable-short-tags --enable-xml --enable-cli --with-openssl --with-pcre-regex --with-pcre-jit --with-zlib --enable-bcmath --with-bz2 --with-curl --enable-exif --with-gd --enable-intl --with-mysqli --enable-pcntl --with-pdo-mysql --enable-soap --enable-sockets --with-xmlrpc --enable-zip --with-webp-dir --with-jpeg-dir --with-png-dir --enable-json --enable-hash --enable-mbstring --with-mcrypt --enable-libxml --with-libxml-dir --enable-ctype --enable-calendar --enable-dom --enable-fileinfo --with-mhash --with-incov --enable-opcache --enable-phar --enable-simplexml --with-xsl --with-pear

oops error, apxs what? (used to build to apache php module) install httpd-devel

yum install httpd-devel

ok lets run again the above aaand... oops error, freetype something... ok install freetype-devel yum install freetype-devel

finally we move on make clean make make test make install

(make test will execute maaany tests. Probably will fail in some and will ask you to submit a report to php devs)

copy development php.ini to our new shine php 5.6 install cp php.ini-development /usr/local/php56/lib/php.ini

edit it and change max_execution_time, max_post_size max_upload_size etc to what zabbix expects (16MB for post, upload, 300 for execution time) also change date.timezone to your timezone


Fortunately we can install a recent mysql , not that archaic 5.1 that comes with centos 6.

Let's install mysql community edition 8 !

rpm -ivh yum update yum install mysql-community-server service mysqld start

Well..that was it...


By now I think I have setup my weird environment, so it is time to install zabbix!

rpm -Uvh yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

Now lets copy the apache configuration file from the docs of zabbix

cp /usr/share/doc/zabbix-web-*/httpd22-example.conf /etc/httpd/conf.d/zabbix.conf

Edit the configuration file to update the timezone to something like php_value date.timezone Europe/Athens

vi /etc/httpd/conf.d/zabbix.conf

Ok now we can create the zabbix database mysql -u root -p

oops...mysql root user already has a password set? Hmmm it seems that although I didn't run the mysql_secure_installation utility, mysql installation has set some root pass. Where can it be..maybe in /var/log/mysql.log

grep 'temporary password' /var/log/mysqld.log

and yes there was a temporary password set. I think it is a good time to run the mysql secure utility , set a new pass (the temp was expired anyway) and answer "Y" at the security options.

After that I can login to mysql to create zabbix database.

create database zabbix_db character set utf8 collate utf8_bin; GRANT ALL ON zabbix_db.* TO zabbix_dbuser@localhost IDENTIFIED BY 'some_decent_password_folks'; quit;

We can import the db schema like this cd /usr/share/doc/zabbix-server-mysql*/ zcat create.sql.gz | mysql -u zabbix_dbuser -p zabbix_db

After creating the db, update the zabbix_server.conf file with our new database, user and creds.

Ok I am ready to start everything and make them start on boot also, so lets do it service zabbix-server start service zabbix-agent start service httpd start chkconfig zabbix-server on chkconfig zabbix-agent on chkconfig httpd on chkconfig mysqld on

Now that everything is up, I'll visit our new and polished web interface to finalize setup http://mydomain.tld/zabbix/

and ofcourse..another error at the database step: Error connecting to database: No such file or directory

Wait ... zabbix web interface cannot find the mysql socket file? Let's try instead of localhost...

...aaaand yet another error but predictable this time: Error connecting to database: Server sent charset unknown to the client. Please, report to the developers

It seems that mysql 8 has default charset "utfmb8" and that old zabbix doesn't know this. This is easily fixable though, just put these is /etc/my.cnf (if there isn't one, make it)

[client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] collation-server = utf8_unicode_ci character-set-server = utf8 default_authentication_plugin = mysql_native_password

Restart mysqld service and this error is gone.

So, this took forever, but it is over. Or not? Wait..there is a newer version that I can use.. zabbix 4.4 which has the newer agent2.I SHOULD DO AN UPGRADE!! Oh well that is easy, install the newer rpm release and upgrade. Right? RIGHT?

rpm -Uvh yum clean yum upgrade offer for zabbix updates other than the agent. This sucks, but lets see, where is the packages I want? Yum says nowhere but looking at the online repository I found that they are moved to the "deprecated" sub-repo.

Ok but why I don't see them? That's because this subrepo is disabled in the zabbix yum repo file

[zabbix-deprecated] name=Zabbix Official Repository deprecated - $basearch baseurl=$basearch/deprecated enabled=0

Enabled this, and now I got the binaries I need for the upgrade to go smoothly.

Let's visit the web interface to confirm everything works ok and the newer version at the bottom should say 4.4.10 instead of 4.2.8, and yes ANOTHER error because the database is older than the just upgraded zabbix.

It seems that I forgot to start the services I stopped :P and after the upgrade when the zabbix-server process starts, it checks the db and if it finds it outdate, and update begins and after a couple of minutes the interface was back online!

Now that everything is in order, just two more things:

  • If you use a firewall, you should open some necessary ports for zabbix and apache. I don't know what you use so I'll just throw some generic iptables: iptables -I INPUT -p tcp -m tcp --dport 10051 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 10050 -j ACCEPT iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT /etc/init.d/iptables save

  • If you have another php installed (maybe the default 5.3.3) you can use the 5.6.40 from a .htaccess file at /usr/share/zabbix/ (make it if it is not there) like this:

AddHandler application/x-httpd-php56 .php .php5 .phtml
Wish me happy monitoring!

posted by qubix on April 18, 2014

Πάμε τώρα να εγκαταστήσουμε το snmp σε έναν centos server, ώστε με κάποιο cacti πχ να κάνουμε monitoring εκ του μακρώθεν...
Αρχίζουμε με τα βασικά, δηλαδή να εγκαταστήσουμε τα απαραίτητα πακέτα στο σύστημα:

yum install net-snmp net-snmp-utils

αφού μπούν τα πακέτα και κάνα δυο εξαρτήσεις, πάμε να βάλουμε τον snmp daemon να ξεκινά με την κάθε εκκίνηση του συστήματος:
chkconfig snmpd on

τώρα στα ενδιαφέροντα πράγματα, το configuration. Χωρίς πολλά πολλά αυτό είναι ένα minimal configuration:

rwuser   noauth
rouser   noauth
rocommunity  mycommunity
syslocation  "datacenter"
proc  init 1 1
proc  httpd 10 1
disk  /
load  12 12 12

Όπως λοιπόν είναι προφανές:
- δεν έχουμε authentication
- βάλαμε μια community read-only η οποία είναι συγκεκριμένη ip και της δώσαμε το όνομα mycommunity
- και καλά το location είναι το "datacenter", προφανώς μπορεί να έχει κάποιο όνομα με ..νόημα!
- τσεκάρουμε την init process ώστε να ξέρουμε αν τρέχει ο server
- τσεκάρουμε την process του web server και βάζουμε όρια να τρέχουν 10 το πολύ και μία το λιγότερο processes
- τσεκάρουμε το μέγεθος του root partition, προφανώς μπορούμε να προσθέσουμε και άλλα partions/δισκους/arrays σε ανάλογες directives
- και τέλος τσεκάρουμε το load με 1minute, 5minutes, 15minutes max averages

μετά από αυτά, κάνουμε restart τον snmpd και βλέπουμε αν όλα παίζουν καλά από το remote cacti μας

προφανώς πρέπει να έχουμε ανοίξει την 161 udp port για να παίξει το οτιδήποτε!

posted by qubix on February 23, 2014

install on cpanel centos server svn

mkdir /usr/local/src/subversion
cd /usr/local/src/subversion
tar xjvf subversion-1.7.14.tar.bz2
cd subversion-1.7.14
./configure --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apache/bin/apr-1-config --with-apr-util=/home/cpeasyapache/src/httpd-2.2/srclib/apr-util/apu-1-config

Θα δούμε το σφάλμα:

checking for sqlite3.h... no
checking sqlite library version (via pkg-config)... no
An appropriate version of sqlite could not be found.  We recommmend, but require at least 3.6.18.
Please either install a newer sqlite on this system
get the sqlite amalgamation from:
unpack the archive using tar/gunzip and copy sqlite3.c from the
resulting directory to:
Οπότε πάμε να βάλουμε το αρχείο που λείπει!

mkdir sqlite-amalgamation
mv sqlite-amalgamation/
cd sqlite-amalgamation/
cp sqlite-amalgamation-3080200/sqlite3.c ../

Ξανά configure το svn και make , make install

./configure --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/local/apache/bin/apr-1-config --with-apr-util=/home/cpeasyapache/src/httpd-2.2/srclib/apr-util/apu-1-config
make install

posted by qubix on August 9, 2013

Το boinc (Berkeley Open Infrastructure for Network Computing) είναι ένα λογισμικό που μας επιτρέπει να συμμετέχουμε δίνοντας τον αδρανή χρόνο του υπολογιστή μας σε ένα από τα πολλά projects που χρειάζονται επεξεργαστική ισχύ όπως για την θεραπεία ασθενειών, τη μελέτη της παγκόσμιας ανόδου της θερμοκρασίας, την ανακάλυψη άστρων pulsar, και πολλά άλλα είδη επιστημονικής έρευνας

enable epel repo and install
Καταρχήν χρειάζεται να ενεργοποιήσουμε το epel repository για να κατεβάσουμε το boinc:
- Κατεβάζουμε την τελευταία έκδοση του epel σε rpm από το
- Την εγκαθιστούμε epel-release:
rpm -Uvh epel-release*rpm
- Τώρα εγκαθιστούμε τον boinc client και manager:
yum install boinc-client
yum install boinc-manager

Ενεργοποιούμε το X forwarding
Στον σέρβερ βεβαιωνόμαστε πως στο /etc/ssh/sshd_config υπάρχουν τα:

X11Forwarding yes
X11DisplayOffset 10
Αν όχι τα βάζουμε και κάνουμε restart τον ssh daemon

Τέλος αν δεν το έχουμε ήδη, εγκαθιστούμε το xauth
user@server:~$ which xauth
Χωρίς το xauth θα βρεθούμε μπροστά στο σφάλμα:"empty DISPLAY environment variable"

Στο local μηχάνημά σας συνδεθείτε με ssh βάζοντας την παράμετρο -Χ ώστε να επιτρέπεται το Χ11 forwarding. Κάτι σαν αυτό δλδ:

ssh -X user@the-server

τρέξτε τον daemon και τον manager

/etc/init.d/boinc start και

κάντε τις ρυθμίσεις και attach σε κάποιο project

Πριν κάνετε attach σε κάποιο από τα projects που υποστηρίζουν τον boinc, βεβαιωθείτε πως έχετε κάνει τις ρυθμίσεις που θέλετε (cpu utilization, disk usage, limits etc..) από τη σελίδα του project που σας ενδιαφέρει και μετά κάντε το attach από τον manager.

Αφού όλα αρχίσουν να δουλεύουν, μπορείτε από τον manager να δείτε τι tasks τρέχουν, τη χρήση του δίσκου, μηνύματα και άλλα διάφορα.