Browsing the blog archives for December, 2014.

Apt-get update error

linux, server

As Debian big fan, sometime I found that apt-get update command reveal this error:
“E: Some index files failed to download. They have been ignored, or old ones used instead.”

This command is very simple solution I found:

# rm /var/lib/apt/lists/partial/*

After that, apt-get update && apt-get upgrade command should be fine.

Source:
http://forums.debian.net/viewtopic.php?f=10&t=108618

Comments Off on Apt-get update error

Clean /boot Partition in CentOS 6

linux, server

/boot Partition in CentOS 6 can be cleaned by removing old kernels.

These are the steps:

1. Check /boot partition (98% used)

# df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1        93M   86M  2.1M  98% /boot
...

2. Check installed kernel

# rpm -q kernel
kernel-2.6.32-431.el6.x86_64
kernel-2.6.32-431.29.2.el6.x86_64
kernel-2.6.32-504.1.3.el6.x86_64

3. Install package-cleanup

# yum install yum-utils
# package-cleanup --oldkernels --count=2
=======================================================================================================================================
 Package              Arch                 Version                        Repository                                              Size
=======================================================================================================================================
Removing:
 kernel               x86_64               2.6.32-431.el6                 @anaconda-CentOS-201311272149.x86_64/6.5               121 M

Transaction Summary
=======================================================================================================================================
Remove        1 Package(s)

Installed size: 121 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : kernel-2.6.32-431.el6.x86_64                                                                                        1/1 
  Verifying  : kernel-2.6.32-431.el6.x86_64                                                                                        1/1 

Removed:
  kernel.x86_64 0:2.6.32-431.el6                                                                                                       

Complete!

4. Check /boot partition (67% used)

# df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1        93M   59M   30M  67% /boot
...

5. Limit only 2 latest kernel for later updates

# vim /etc/yum.conf
   ...[edit yum.conf]...
   installonly_limit=2
   ...[edit yum.conf]...

Source:
http://www.if-not-true-then-false.com/2012/delete-remove-old-kernels-on-fedora-centos-red-hat-rhel/

Comments Off on Clean /boot Partition in CentOS 6

SSH Server Administration

linux, server

Having several Linux Servers, SSH access is mandatory communication between me and those servers. These are several tips for SSH Server administration that save the day:

Add these line on /etc/ssh/sshd_config:

  • Allow only specific user (never use root login for remote SSH access)
    AllowUsers username
    DenyUsers All
  • Disable DNS and GSSAPI (solving slow login respond, especially from private network)
    UseDNS no
    GSSAPIAuthentication no

Make sure to restart SSH service after changing sshd_config:

# service ssh restart

or

# /etc/init.d/ssh restart

Additional tip:

  • Add this options on /etc/resolv.conf (solving slow login respond on RHEL/CentOS)
options single-request-reopen

Source:

http://injustfiveminutes.com/2013/03/13/fixing-ssh-login-long-delay/

Comments Off on SSH Server Administration