To install fail2ban on CentOS, first, enable the epel repo by running
yum install epel-release -y
Now install fail2ban with
yum install fail2ban -y
Enable fail2ban with
systemctl enable fail2ban
Basck to fail2ban
To install fail2ban on CentOS, first, enable the epel repo by running
yum install epel-release -y
Now install fail2ban with
yum install fail2ban -y
Enable fail2ban with
systemctl enable fail2ban
Basck to fail2ban
First you need to install Remi repository
Enable epel repo with
yum install epel-release -y
On CentOS 7
rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-7.rpm
On CentOS 6
rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-6.rpm
Enable PHP 7.2
yum install yum-utils yum-config-manager --enable remi-php72
To install PHP, run
yum install -y php php-bcmath php-cli php-common php-devel php-gd \ php-imap php-intl php-json php-ldap php-lz4 php-mbstring php-mysqlnd \ php-soap php-intl php-opcache php-xml php-pdo
Downgrading PHP version
if you ever want to change PHP version, lets say PHP 7.0, do the following. Remove current PHP
rpm -qa | grep php | xargs yum remove -y
Disable PHP 7.2 repo.
yum-config-manager --disable remi-php72
Enable PHP 7.0 repo
yum-config-manager --enable remi-php70
Now install PHP as above.
PHp Binary
PHP cli will be installed in /usr/bin/php72, you can create a symlink if you want.
PHP-FPM
To install php-fpm module, run
yum install php72-php-fpm -y
To start php-fpm, run
systemctl start php72-php-fpm
To install Google Chrome on CentOS 7 (Chrome won’t work on CentOS 6 as it is using older version of libraries required for Chrome).
First create repo file
vi /etc/yum.repos.d/google-chrome.repo
Add following content
[google-chrome] name=google-chrome baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64 enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
Now you can install google chrome with command
yum -y install google-chrome-stable
See CentOS
When i install software on CentOS server, i get following warning
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
You can install deltaparm package
yum install deltarpm -y
This will save you some bandwidth as yum will only download difference between previous package.
To set hostname for your server in CentOS 7, run
hostnamectl set-hostname YOUR_HOST_NAME
To install sysstat/sar on CentOS, run
yum install sysstat
Enable and start sysstat
systemctl enable sysstat systemctl start sysstat systemctl status sysstat
Allow several minutes to collect data, then you will be able to see stats with sar ommand.
See sar
tmux is a terminal emulator. It work like screen, but have more features.
CentOS 6 do not come with tmux, you need to enable rpmforge repository.
On CentOS 6 64 bit, run
rpm -ivh http://repository.it4i.cz/mirrors/repoforge/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm yum install tmux
When install redis php module, i get error
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
[root@vps154294 phpredis]# /usr/serverok/php-7.1.12/bin/phpize Configuring for: PHP Api Version: 20160303 Zend Module Api No: 20160303 Zend Extension Api No: 320160303 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. [root@vps154294 phpredis]#
This is fixed by installing autoconf package with yum.
yum install -y autoconf
Once autoconf installed, phpize command worked properly.
[root@vps154294 phpredis]# /usr/serverok/php-7.1.12/bin/phpize Configuring for: PHP Api Version: 20160303 Zend Module Api No: 20160303 Zend Extension Api No: 320160303 [root@vps154294 phpredis]#
When compiling PHP 7 on CentOS 7, i got error
configure: error: Cannot find libtidy
To fix this, install libtidy-devel module.
yum install -y libtidy-devel
Lets search for available redis packages
[root@vps154294 smartfst]# yum search redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirror.us.leaseweb.net
* remi-safe: repo1.ash.innoscale.net
============================================================================================ N/S matched: redis ============================================================================================
collectd-redis.x86_64 : Redis plugin for collectd
collectd-write_redis.x86_64 : Redis output plugin for collectd
hiredis.x86_64 : Minimalistic C client library for Redis
hiredis-devel.x86_64 : Development files for hiredis
hiredis-last.x86_64 : Minimalistic C client library for Redis
opensips-redis.x86_64 : Redis connector
pcp-pmda-redis.x86_64 : Performance Co-Pilot (PCP) metrics for Redis
perl-Apache-Session-Redis.noarch : Redis driver for Apache::Session::NoSQL
perl-Redis.noarch : Perl binding for Redis database
php-nrk-Predis.noarch : PHP client library for Redis
php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php-phpiredis.x86_64 : Client extension for Redis
php54-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php54-php-phpiredis.x86_64 : Client extension for Redis
php55-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php55-php-phpiredis.x86_64 : Client extension for Redis
php56-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php56-php-phpiredis.x86_64 : Client extension for Redis
php70-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php70-php-phpiredis.x86_64 : Client extension for Redis
php71-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php71-php-phpiredis.x86_64 : Client extension for Redis
php72-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store
php72-php-phpiredis.x86_64 : Client extension for Redis
python-redis.noarch : Python 2 interface to the Redis key-value store
python-trollius-redis.noarch : Redis client for the Python event loop PEP3156 for Trollius.
python2-django-redis.noarch : Full featured redis cache backend for Django
redis-trib.noarch : Cluster management script for Redis
rubygem-redis.noarch : A Ruby client library for Redis
rubygem-redis-doc.noarch : Documentation for rubygem-redis
syslog-ng-redis.x86_64 : redis support for syslog-ng
uwsgi-logger-redis.x86_64 : uWSGI - redislog logger plugin
uwsgi-router-redis.x86_64 : uWSGI - Plugin for Redis router support
redis.x86_64 : A persistent key-value database
Name and summary matches only, use "search all" for everything.
[root@vps154294 smartfst]#
In this server, we have PHP 7.0 installed. So we need to install packages for PHP 7.0
Here are the two packages for PHP 7.0
php70-php-pecl-redis.x86_64 : Extension for communicating with the Redis key-value store php70-php-phpiredis.x86_64 : Client extension for Redis
Install it with yum
yum install -y php70-php-pecl-redis.x86_64 php70-php-phpiredis.x86_64
Now you need to restart web server, generally restarting apache will do. In this cause PHP is running as php-fpm under nginx, so we need to restart php-fpm with
systemctl restart php-fpm
To install Redis on CentOS, run
yum install redis
Start redis with
service redis start
Set redis to start on boot
systemctl enable redis
Verify redis is running with
[root@vps154294 ~]# netstat -antp | grep redis tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 32367/redis-server [root@vps154294 ~]#