How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

August 5, 2015

Make apt-get use IPv4 instead of IPv6

Filed under: Linux — Tags: , , , — admin @ 2:15 pm

I have try today to run some apt-get update and it take some time to figure the ipv6 ip . So I wanted to not use ipv6.
The fix is to un comment the line 54 from this file
/etc/gai.conf
precedence ::ffff:0:0/96 100

after this all run smooth.

July 21, 2015

Manually unban ip blocked by fail2ban

Filed under: Linux — Tags: , , , , — admin @ 9:46 am

Well if you have an ip banned then you should deleted as this

iptables -L --line-numbers

And then run this where chain-name you should replace it with what name you have there for example fail2ban-ssh
iptables -D chain-name 2

 

Short update on this

You can run also

fail2ban-client status

and after this

With Fail2Ban before v0.8.8:

fail2ban-client get YOURJAILNAMEHERE actionunban IPADDRESSHERE

With Fail2Ban v0.8.8 and later:

fail2ban-client set YOURJAILNAMEHERE unbanip IPADDRESSHERE

July 9, 2015

How To Restore a cPanel Server from old hard drive

Filed under: Linux — Tags: , , — admin @ 11:52 am

First of all this is a tutorial that you run it on your risk . Any way if you are in this situation a reinstall was done, and you have a snapshot mounted or old hard drive .
Also this is in case that you don’t have backup from whm and you can’t import them .

We are assuming that your old hard drive is mounted as ‘old-drive’

We sync important configuration from etc . Please after this don’t log out and try to log on your server . Here we re sync also the shadow this mean you will log using old password
cd /old-drive/etc/
rsync -avHz user* trueuser* domainips secondarymx domainalias valiases vfiltersexim* backupmxhosts proftpd* pure-ftpd* logrotate.conf passwd* group* *domain* *named* wwwacct.conf cpbackup.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts spammer* skipsmtpcheckhosts relay* localdomains remotedomains my.cnf /etc

Next is apache configuration
rsync -avHz /old-drive/usr/local/apache/conf /usr/local/apache
rsync -avHz /old-drive/usr/local/apache/modules /usr/local/apache
rsync -avHz /old-drive/usr/local/apache/domlogs /usr/local/apache

Dns configuration
rsync -avHz /old-drive/var/named /var

Cpanel restore
rsync -avHz /old-drive/usr/local/cpanel /usr/local

Mysql restoration
rsync -avHz /old-drive/var/lib/mysql /var/lib

cPanel files and templates
rsync -avHz /old-drive/var/cpanel /var

SSl certificates
rsync -avHz /old-drive/usr/share/ssl /usr/share

User bandwidth
rsync -avHz /old-drive/var/log/bandwidth /var/log

Mail queue
rsync -avHz /old-drive/var/spool/cron /var/spool

Mysql root password
rsync -avHz /old-drive/root/.my.cnf /root

Home user information ( this will take some time if you have huge websites )
rsync -avHz --exclude=virtfs/ /old-drive/home/* /home

We need to recompile and rebuild some files after copy this

/scripts/upcp --force
/scripts/easyapache
/scripts/initquotas
/scripts/eximup --force
/scripts/mysqlup --force
/etc/init.d/cpanel restart
/scripts/restartsrv_apache
/scripts/restartsrv_exim
/scripts/restartsrv_named

April 8, 2015

ERROR: `/var/tmp/geoip/configure’ failed

Filed under: Linux — Tags: , , , — admin @ 10:49 am

I am trying to install geoip using
pecl install geoip
And I get this error “ERROR: `/var/tmp/geoip/configure’ failed”

The solution is to install
yum install geoip-devel

February 17, 2015

How to enable Core Dumps in CentOS

Filed under: Linux — Tags: , , , — admin @ 12:17 pm

To enable core dumps for all daemon, please follow these steps:
Edit the /etc/profile. At line 26 of the file, replace this line:
ulimit -S -c 0 > /dev/null 2>&1

with this line:
ulimit -c unlimited >/dev/null 2>&1

Replace this line (around line 138 ) in /etc/init.d/functions
ulimit -S -c 0 >/dev/null 2>&1

with this:
ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1

Enable core-dumping globally by editing the /etc/sysconfig/init file and adding the line:
DAEMON_COREFILE_LIMIT=’unlimited’

Enable it for specific daemons by adding this line in the /etc/sysconfig/$daemon:
DAEMON_COREFILE_LIMIT=’unlimited’

Optionally, enable core dump for SUID programs:
echo 2 > /proc/sys/fs/suid_dumpable

mkdir /tmp/core
chmod 777 /tmp/core

Edit the /etc/sysctl.conf and add the following:

fs.suid_dumpable = 2
kernel.core_uses_pid = 1
kernel.core_pattern = /tmp/core
Then reload the settings in /etc/sysctl.conf:
sysctl -p

« Newer PostsOlder Posts »

Powered by WordPress