Miralinux Blog

  • Home
  • Linux
    • Scripts
    • CentOS
  • Apple
  • Microsoft
    • Features
    • Office
    • Windows
  • Learning
  • Games
  • Multimedia
    • XBMC
  • Other
    • About WordPress
  • Links
    • General
    • Software
      • Autocad
    • Hardware
      • BIOS
    • Linux
    • WiKieS

Tag Archives: Linux

Linux WiFi access

Posted on 2012/05/18 by arno Posted in Linux

source: http://blog.sudonetworks.com/2010/03/configuring-wpawpa2-on-linux-clients.html

Configuring WPA/WPA2 for WiFi access on Linux Clients

Configuring a Linux WiFi client is not always as easy as with Windows or MAC OS X. In this first post I will show you how to configure your Linux client to associate with an access point. For this example, I use Ubuntu version 8.x. This procedure may vary from one Linux variant to another. The SSID I want to connect to is APN and my WiFi interface is wlan1. Here are the steps for WPA/WPA2 PSK (commands are in boldface):

1. Generate your WPA/WPA2 passphrase

~# wpa_passphrase [APN]
# reading passphrase from stdin
[enter yoursecretkey]
network={
ssid="APN"
#psk="yoursecretkey"
psk=9ae7a5f631ecc688db8dcc6bbf317b4a551b39e9ee9c20effb5393e342bd954b
}

2. Copy your wpa_passphrase

output to /etc/wpa_supplicant/wpa_supplicant.conf from the above step, it starts with “Network={” and ends with a closing curly brace “}”.
You may want delete the comment “#psk=yoursecretkey”

~# wpa_passphrase [APN] > /etc/wpa_supplicant/wpa_supplicant.conf
[enter yoursecretkey]
~# vi /etc/wpa_supplicant/wpa_supplicant.conf

3. Enable your wireless interface

~# ifconfig wlan1 up

4. Scan for existing WLANs or SSIDs

~# iwlist wlan1 scanning | grep -i essid

ESSID:”BELL078″
ESSID:”APN”
ESSID:”2mix”

You now have a confirmation your target SSID APN is detected.

5. Configure your wireless interface for your specific SSID

~# iwconfig wlan1 essid APN

6. Start WPA/WPA2 authentication

~# wpa_supplicant -i wlan1 -c /etc/wpa_supplicant/wpa_supplicant.conf
ioctl[SIOCGIWSCAN]: Resource temporarily unavailable
CTRL-EVENT-SCAN-RESULTS
Trying to associate with 00:25:4b:0a:a3:f5 (SSID='APNSmallBang' freq=2437 MHz)
CTRL-EVENT-SCAN-RESULTS
Associated with 00:25:4b:0a:a3:f5
WPA: Key negotiation completed with 00:25:4b:0a:a3:f5 [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection to 00:25:4b:0a:a3:f5 completed (auth) [id=0 id_str=]

7. Assign IP address via DHCP

Open a new shell to type the following command:

~# dhclient wlan1
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/wlan1/00:c0:ca:2f:94:0d
Sending on   LPF/wlan1/00:c0:ca:2f:94:0d
Sending on   Socket/fallback
DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 3
DHCPOFFER of 172.16.22.5 from 172.16.22.1
DHCPREQUEST of 172.16.22.5 on wlan1 to 255.255.255.255 port 67
DHCPACK of 172.16.22.5 from 172.16.22.1
bound to 172.16.22.5 -- renewal in 33064 seconds.

8. Check if IP address assigned correctly

ifconfig wlan1

wlan1     Link encap:Ethernet  HWaddr 00:c0:ca:2f:94:0d
inet addr:172.16.22.5  Bcast:172.16.22.255  Mask:255.255.255.0
inet6 addr: fe80::2c0:caff:fe2f:940d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1092 (1.0 KB)  TX bytes:1580 (1.5 KB)

At this point, you should be connected to your AP

Linux

Linux CentOS 6.x

Posted on 2011/08/30 by arno Posted in CentOS, Linux

Repositories

RPM packages for Red Hat Enterprise Linux (RPMforge) | NTFS support# yum install fuse-ntfs-3g |

Extra Packages for Enterprise Linux (EPEL) | collectd | Icecast |

pkgbox | collectd plugins |

CentOS 6.x mount NTFS file systems

source: http://www.cyberciti.biz/faq/redhat-fedora-enable-ntfs3g-support/

1. open the terminal window with the root account.

2. setup rpmforge for centos 6 to your system:

http://xmodulo.com/2013/01/how-to-set-up-rpmforge-repoforge-repository-on-centos.html

3. just install/update the package fuse-ntfs-3g:

# yum update fuse-ntfs-3g

CentOS 6.x howtos

Virtualization With Xen On CentOS 6.2 (x86_64)

PXE_setup

HowToForge.com – Create A Kickstart File | Linuxmoz.com – Kickstartguide |

Create a LiveDVD/USB from custom build Centos 6.2

CentOS Apple Time Machine

Collectd

Clone Disk

OpenVPN

https://safesrv.net/install-openvpn-on-centos/

http://www.guizmovpn.com/index.php?option=com_content&view=article&id=3&Itemid=3

CentOS 6.x Kickstart

Append the kickstart file location to the boot parameters.

linux initrd=initrd.img ks=http://domain.tld/ks-type-v1.cfg

http://www.howtoforge.com/how-to-create-a-kickstart-file-for-centos-fedora-redhat-rhel

CentOS 6.x disable IPv6

#/etc/sysctl.conf
# disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1

Reload the sysctl configuration:

~# sysctl -p

CentOS 6.x disable APIPA

#/etc/sysconfig/network
# disable APIPA
NOZEROCONF=yes

service network restart

CentOS 6.x disable SELINUX

at installation add “selinux=0” to the installation options

Gnome keyring DISABLE!

source: http://www.linuxquestions.org/questions/linux-software-2/how-to-disable-gnome-keyring-361545/

# killall gnome-keyring-manager
edit /etc/gconf/schemas/gnome-keyring.schemas as root,
and search for “TRUE” in text, there should be one for ssh and one for pkcs,
substitute “TRUE” with “FALSE” and ur done..

Gnome’s Keyring – Remove Password File

source: http://essayboard.com/2009/06/24/gnomes-keyring-tip-how-to-disable-keyring-or-remove-password-file/

Some people complain how Gnome’s Keyring keeps asking them for password whenever they try to get connect to wireless router.

Here is a trick of how to stop Keyring from bothering you for good.
Go to System > Preferences > Startup Applications, disable the check box “Gnome Keyring Daemon.”
That’s it, everything should go as plan if you done this correctly!
I tested this trick on Fedora Core 11 and Ubuntu 9.04, both Linux distribution work fine with this trick.

How to reset Keyring’s password if you forgot it?
“cd ~/.gnome2/keyrings/“  (without the double quotes), then you have to delete login.keyring or any other file that has unwanted Keyring’s encrypted passwords that you want to get rid of.

Kickstart

http://www.centos.org/docs/5/html/Installation_Guide-en-US/ch-kickstart2.html

http://blog.crazytje.be/create-a-kickstart-netinstall-with-centos/

http://smorgasbork.com/component/content/article/35-linux/58-building-a-custom-centos-5-kickstart-disc-part-1

http://www.cyberciti.biz/faq/kvm-install-centos-redhat-using-kickstart-ks-cfg/

Services

Linux 101: A comprehensive list of available Linux services

http://www.cyberciti.biz/faq/linux-default-services-which-are-enabled-at-boot/

Firefox Sync Server | https://wiki.mozilla.org/QA/Sync/Sync_Server_Install_CentOS

Cron

yum-cron (autoupdate)

yum install yum-cron ; vi /etc/sysconfig/yum-cron ; chkconfig yum-cron on ; service yum-cron start

YUM_PARAMETER=”-x kernel*” | mailto=foo@bar.com

Daemons

Deluge – bittorent (web) client

Deluge | CentOS howto

Transmission – bittorent (web) client

Site – http://www.transmissionbt.com | Wiki | Config | configfiles

Sickbeard – TVshow manager

Site – http://sickbeard.com |

sabnzbd – nzb download web client

Site – http://sabnzbd.org | command-line | folders | CentOS howto

Linux

Linux – NAS tools

Posted on 2011/07/30 by arno Posted in CentOS, Linux

rSync

http://dailycupoftech.com/windows-backup-with-rsync-and-freenas/

torrent client

http://markus.revti.com/2009/11/installing-libtorrent-and-rtorrent-on-linux-centos/

http://libtorrent.rakshasa.no/

http://rtwi.jmk.hu/

nzbget daemons

http://nzbget.sourceforge.net/

http://www.techsono.com/supernzb/screenshot.html

http://www.techsono.com/usenet/faqs/nzb-o-matic-plus-nomp

Linux

Linux Ubuntu 10.04 first steps

Posted on 2011/05/01 by arno Posted in Linux, Uncategorized

Introduction to fstab

http://www.techsupportalert.com/content/ubuntu-tips-and-tricks.htm#Customize-the-Panel

Configure resolution

https://wiki.ubuntu.com/X/Config/Resolution

http://www.ubuntugeek.com/how-change-display-resolution-settings-using-xrandr.html

http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

http://jamesmcdonald.id.au/it-tips/getting-higher-screen-resolution-for-a-ubuntu-11-04-guest-in-virtual-box

 

disable Gnome Keyring

Gnome Keyring is a small utility to authorize applications before opening them. But sometimes it feels really annoying when it starts to prompt to enter keyring password every time when you open some application. So this small tutorial teaches you eliminate the need of entering keyring password over and over again.

This method will work both for keyring with a password being set at some point of time by you and as well as default password being set without your knowledge. Follow the steps:

Step 1. If your keyring password is different from your login password, do this before you proceed to step 2, else skip this step.

a) Open your terminal and from navigate to:
cd .gnome2/keyrings/

b) Make sure there is a file called “default.keyring” in the directory by typing:
ls -l

c) Now remove the file by typing the below command:
rm default.keyring

Step 2: Open your terminal and follow these steps:

– Install libpam-keyring:
sudo apt-get install libpam-keyring

– Now to modify gdm login:
sudo gedit /etc/pam.d/gdm

– Now it will open an file, add this line at the end:
@include common-pamkeyring

That’s it. Now restart your Ubuntu and open any app that used to prompt you to enter keyring password. If you had done the above steps properly, it will now prompt you to set a new password. If you want to enter a new password, better set the same password as of your login password or just leave it empty if you totally want to get rid of keyring.

Linux

Links – Linux

Posted on 2010/09/19 by administrator Posted in Links, Linux

Linux Distros

http://en.wikipedia.org/wiki/Comparison_of_BSD_operating_systems

Project

http://www.bacula.org/en/ – Opensource back-up software

 

Linux

Linux Directory Structure

NixCraft

20 Linux Server Hardening Security Tips

Nixcraft – FAQ 2010 09

Making Fedora USB Media in other Linux Distributions

Upgrading Fedora using yum

Linux PPTP

Microsoft Including routing table updates

http://www.cyberciti.biz/tips/howto-configure-ubuntu-fedora-linux-pptp-client.html

http://pptpclient.sourceforge.net/howto-debian.phtml#configure_by_hand

http://www.cyberciti.biz/faq/linux-route-add/

Cisco

Resolve IP Fragmentation, MTU, MSS, and PMTUD Issues with GRE and IPSEC

VNC

http://wiki.centos.org/HowTos/VNC-Server

Scripting

http://www.unixguide.net/unix/sedoneliner.shtml

http://en.wikipedia.org/wiki/Cut_%28Unix%29

http://www.gnu.org/software/gawk/manual/gawk.html – http://people.cs.uu.nl/piet/docs/nawk/nawk_toc.html

Hardware

http://www.jamesonwilliams.com/hardy-r8168

Miscellaneous

Re: icmp unreachable – need to frag

HOWTO: Solve / investigate high Linux system load

Links Linux

Custom kernel compilation fedora

Posted on 2010/09/18 by administrator Posted in Linux

Title: Custom kernel compilation fedora
Desc: Easy kernel compiling
URL: http://www.howtoforge.com/kernel_compilation_fedora, http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Custom_kernel_compilaton_on_RedHat_Fedora_Systems
OS: linux

Linuxquestions.org – Custom kernel compilation
* Pre requisites
* Getting the Kernel
* Configuring the kernel
* Compiling the kernel
* RPM kernels
* 2.6.x kernel notes

-=-
If you have installed the pre requisites and downloaded the kernel quickest way is by configuring the kernel and
after that compile/create rpm package.

– Configuring
# make oldconfig
will attempt to configure the current kernel using the parameters fed from an old configuration file .config.old or .config,
since the file we copied has not this name making oldconfig will result on a series of text based questions, equivalent to make config

# make menuconfig
will result in a text based GUI which lets you load up an already existing configuration file (if you have a .config) or
an alternate configuration file (like our config-2.4.20-20.9 file).
This menu depends on ncurses, so you will have to see if these libraries are installed correctly on your system.

# make xconfig
is yet another GUI X based configuration tool which makes it easier and clearer to configure the kernel,
this option also allows us to load an alternate configuration file (such as config-2.4.20-20.9).
This GUI relys on the TCL-TK library (found in the kernel development section of redhat-config-packages).
This GUI has gone a major change in 2.5/2.6 it requires KDE-devel packages.

# make gconfig
The GTK front end of the Kernel configuration GUI for kernel 2.6.x, it is structured almost identical to that of the new xconfig.
Aimed for the GNOME 2.x Desktop Environment. Requires some GTK development packages.

– Compiling / create rpm
# make rpm
After creation the rpm should be in”~/rpmbuild/RPMS/i386/”
install the kernel with # rpm -ihv kernel-2.6.34.1.i386.rpm
create the ramdisk for booting initrd # mkinitrd /boot/initramfs-2.6.34.1.img 2.6.34.1
check the bootloader for pointing to the correct files  # vi /etc/grub.conf

Linux

Backup and restore your linux system!

Posted on 2010/08/25 by arno Posted in Linux, Uncategorized

Howto: Backup and restore your system!
Hi, and welcome to the Heliode guide to successful backing-up and restoring of a Linux system!

Most of you have probably used Windows before you started using Ubuntu. During that time you might have needed to backup and restore your system. For Windows you would need proprietary software for which you would have to reboot your machine and boot into a special environment in which you could perform the backing-up/restoring (programs like Norton Ghost).
During that time you might have wondered why it wasn’t possible to just add the whole c:\ to a big zip-file. This is impossible because in Windows, there are lots of files you can’t copy or overwrite while they are being used, and therefore you needed specialized software to handle this.

Well, I’m here to tell you that those things, just like rebooting, are Windows CrazyThings ™. There’s no need to use programs like Ghost to create backups of your Ubuntu system (or any Linux system, for that matter). In fact; using Ghost might be a very bad idea if you are using anything but ext2. Ext3, the default Ubuntu partition, is seen by Ghost as a damaged ext2 partition and does a very good job at screwing up your data.

1: Backing-up

“What should I use to backup my system then?” might you ask. Easy; the same thing you use to backup/compress everything else; TAR. Unlike Windows, Linux doesn’t restrict root access to anything, so you can just throw every single file on a partition in a TAR file!

To do this, become root with
Code:

sudo su

and go to the root of your filesystem (we use this in our example, but you can go anywhere you want your backup to end up, including remote or removable drives.)
Code:

cd /

Now, below is the full command I would use to make a backup of my system:

Code:

tar cvpzf backup.tgz –exclude=/proc –exclude=/lost+found –exclude=/backup.tgz –exclude=/mnt –exclude=/sys /

Now, lets explain this a little bit.
The ‘tar’ part is, obviously, the program we’re going to use.

‘cvpfz’ are the options we give to tar, like ‘create archive’ (obviously),
‘preserve permissions'(to keep the same permissions on everything the same), and ‘gzip’ to keep the size down.

Next, the name the archive is going to get. backup.tgz in our example.

Next comes the root of the directory we want to backup. Since we want to backup everything; /

Now come the directories we want to exclude. We don’t want to backup everything since some dirs aren’t very useful to include. Also make sure you don’t include the file itself, or else you’ll get weird results.
You might also not want to include the /mnt folder if you have other partitions mounted there or you’ll end up backing those up too. Also make sure you don’t have anything mounted in /media (i.e. don’t have any cd’s or removable media mounted). Either that or exclude /media.

EDIT : kvidell suggests below we also exclude the /dev directory. I have other evidence that says it is very unwise to do so though.

Well, if the command agrees with you, hit enter (or return, whatever) and sit back&relax. This might take a while.

Afterwards you’ll have a file called backup.tgz in the root of your filessytem, which is probably pretty large. Now you can burn it to DVD or move it to another machine, whatever you like!

EDIT2:
At the end of the process you might get a message along the lines of ‘tar: Error exit delayed from previous errors’ or something, but in most cases you can just ignore that.

Alternatively, you can use Bzip2 to compress your backup. This means higher compression but lower speed. If compression is important to you, just substitute
the ‘z’ in the command with ‘j’, and give the backup the right extension.
That would make the command look like this:

Code:

tar cvpjf backup.tar.bz2 –exclude=/proc –exclude=/lost+found –exclude=/backup.tar.bz2 –exclude=/mnt –exclude=/sys /

2: Restoring

Warning: Please, for goodness sake, be careful here. If you don’t understand what you are doing here you might end up overwriting stuff that is important to you, so please take care!

Well, we’ll just continue with our example from the previous chapter; the file backup.tgz in the root of the partition.

Once again, make sure you are root and that you and the backup file are in the root of the filesystem.

One of the beautiful things of Linux is that This’ll work even on a running system; no need to screw around with boot-cd’s or anything. Of course, if you’ve rendered your system unbootable you might have no choice but to use a live-cd, but the results are the same. You can even remove every single file of a Linux system while it is running with one command. I’m not giving you that command though!

Well, back on-topic.
This is the command that I would use:

Code:

tar xvpfz backup.tgz -C /

Or if you used bz2;

Code:

tar xvpfj backup.tar.bz2 -C /

WARNING: this will overwrite every single file on your partition with the one in the archive!

Just hit enter/return/your brother/whatever and watch the fireworks. Again, this might take a while. When it is done, you have a fully restored Ubuntu system! Just make sure that, before you do anything else, you re-create the directories you excluded:
Code:

mkdir proc
mkdir lost+found
mkdir mnt
mkdir sys
etc…

And when you reboot, everything should be the way it was when you made the backup!

2.1: GRUB restore
Now, if you want to move your system to a new harddisk or if you did something nasty to your GRUB (like, say, install Windows), You’ll also need to reinstall GRUB.
There are several very good howto’s on how to do that here on this forum, so i’m not going to reinvent the wheel. Instead, take a look here:

http://www.ubuntuforums.org/showthre…t=grub+restore

There are a couple of methods proposed. I personally recommend the second one, posted by remmelt, since that has always worked for me.

Well that’s it! I hope it was helpful!
As always, any feedback is appreciated!
__________________
“Windows is something to overcome”

Howto’s by me:
Tweak firefox! (URL now works..)
Backup/Restore your system!
Avoid having to reboot

Compentux.org , the Linux Tip & Howto gathering initiative!
Last edited by aysiu; November 29th, 2006 at 12:15 AM.. Reason: Moved slash to end of command by popular vote
source: http://ubuntuforums.org/showthread.php?t=35087

Linux

Linux Daemons and services – what to disable/enable

Posted on 2010/07/31 by arno Posted in Linux, Uncategorized

Linux Daemons and Services
Linux Default Services Which Are Enabled at Boot

Links Linux

Monitoring harddisk temperature

Posted on 2010/07/25 by arno Posted in Linux, Uncategorized

Monitor temperatures with Linux and DS1820
datasheet DS18S20
Monitor Hard Disks Temperature

Hard Drive Temperature Monitoring using Smartctl and RRDTool on Buffalo Linkstation Quad Pro NAS

Links Linux

Linux: Hardware info

Posted on 2010/06/30 by arno Posted in Linux, Uncategorized

yum install lshw

lspci
lshw | less
lshw -C network
dmidecode | less

cat /proc/cpuinfo
cat /proc/devices
cat /proc/meminfo
dmesg |grep eth

linux network interface reorder eth*

learn awk: http://www.ibm.com/developerworks/library/l-awk1.html

source: http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames

source: http://www.reactivated.net/writing_udev_rules.html

Linux

Manage Linux log files with Logrotate

Posted on 2010/06/29 by arno Posted in Linux

source: http://articles.techrepublic.com.com/5100-10878_11-1052474.html

Takeaway: Learn how to use the Logrotate program to administer, back up, and monitor log files on Linux.

Log files are the most valuable tools available for Linux system security. The logrotate program is used to provide the administrator with an up-to-date record of events taking place on the system. The logrotate utility may also be used to back up log files, so copies may be used to establish patterns for system use. In this Daily Drill Down, I’ll cover the following topics:

  • The logrotate configuration
  • Setting defaults for logrotate
  • Using the include option to read other configuration files
  • Setting rotation parameters for specific files
  • Using the include option to override defaults

The logrotate program
The logrotate program is a log file manager. It is used to regularly cycle (or rotate) log files by removing the oldest ones from your system and creating new log files. It may be used to rotate based on the age of the file or the file’s size, and usually runs automatically through the cron utility. The logrotate program may also be used to compress log files and to configure e-mail to users when they are rotated.

The logrotate configuration
The logrotate program is configured by entering options in the /etc/logrotate.conf file. This is a text file, which may contain any of the configuration options listed in the table below. The options entered in /etc/logrotate.conf may be used to set configuration parameters for any log file on the system. These options may also be used to allow logrotate to read configuration parameters from other log files, by using the include parameter.

Option
Function
compress This is used to compress the rotated log file with gzip.
nocompress This is used when you do not want to compress rotated log files.
copytruncate This is used when processes are still writing information to open log files. This option copies the active log file to a backup and truncates the active log file.
nocopytruncate This copies the log files to backup, but the open log file is not truncated.
create mode owner group This rotates the log file and creates a new log file with the specified permissions, owner, and group. The default is to use the same mode, owner, and group as the original file.
nocreate This prevents the creation of a new log file.
delaycompress When used with the compress option, the rotated log file is not compressed until the next time it is cycled.
nodelaycompress This overrides delaycompress. The log file is compressed when it is cycled.
errors address This mails logrotate errors to an address.
ifempty With this, the log file is rotated even if it is empty. This is the default for logrotate.
notifempty This does not rotate the log file if it is empty.
mail address This mails log files that are cycled to an address. When mail log files are cycled, they are effectively removed from the system.
nomail When mail log files are cycled, a copy is not mailed.
olddir directory With this, cycled log files are kept in the specified directory. This directory must be on the same filesystem as the current log files.
noolddir Cycled log files are kept in the same directory as the current log files.
prerotate/endscript These are statements that enclose commands to be executed prior to a log file being rotated. The prerotate and endscript keywords must appear on a line by themselves.
postrotate/endscript These are statements that enclose commands to be executed after a log file has been rotated. The postrotate and endscript keywords must appear on a line by themselves.
daily This is used to rotate log files daily.
weekly This is used to rotate log files weekly.
monthly This is used to rotate log files monthly.
rotate count This specifies the number of times to rotate a file before it is deleted. A count of 0 (zero) means no copies are retained. A count of 5 means five copies are retained.
tabootext [+] list This directs logrotate to not rotate files with the specified extension. The default list of extensions is .rpm-orig, .rpmsave, v, and ~.
size size With this, the log file is rotated when the specified size is reached. Size may be specified in bytes (default), kilobytes (sizek), or megabytes (sizem).

The /etc/logrotate.conf file
The /etc/logrotate.conf file is the default configuration file for logrotate. The default /etc/logrotate.conf file installed with Red Hat Linux is shown below:
# see “man logrotate” for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# send errors to root
errors root
# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress
1
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own lastlog or wtmp –we’ll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}

/var/log/lastlog {
monthly
rotate 1
}

# system-specific logs may be configured here

Setting defaults for logrotate
Default configuration settings are normally placed close to the beginning of the logrotate.conf file. These settings are usually in effect system-wide. The default settings for logrotate on this system are established in the first 12 lines of the file.

The third line
weekly

specifies that all log files will be rotated weekly.

The fifth line
rotate 4

specifies that four copies of old log files are retained before the files are cycled. Cycling refers to removing the oldest log files and replacing them with new copies.

The seventh line
errors root

sends all logrotate error messages to root.

The ninth line
create

configures logrotate to automatically create new log files. The new log files will have the same permissions, owner, and group as the file being rotated.

The eleventh line
#compress

prevents logrotate from compressing log files when they are rotated. Compression is enabled by removing the comment (#) from this line.

Using the include option
The include option allows the administrator to take log file rotation information, which may be installed in several files, and use it in the main configuration file. When logrotate finds the include option on a line in logrotate.conf, the information in the file specified is read as if it appeared in /etc/logrotate.conf.

Line 13 in /etc/logrotate.conf
include /etc/logrotate.d

tells logrotate to be read in the log rotation parameters, which are stored in the files contained in the /etc/logrotate.d directory. The include option is very useful when RPM packages are installed on a system. RPM packages’ log rotation parameters will typically install in the /etc/logrotate.d directory.

The include option is important. Some of the applications that install their log rotation parameters to /etc/logrotate.d by default are apache, linuxconf, samba, cron, and syslog. The include option allows the parameters from each of these files to be read into logrotate.conf.

Using the include option in /etc/logrotate.conf allows the administrator to configure a rotation policy for these packages through a single configuration file.

Using include to override defaults
When a file is read by /etc/logrotate.conf, the rotation parameters specified in the include will override the parameters specified in the logrotate file. An example of /etc/logrotate.conf being overridden is shown below:
#Log rotation parameters for linuxconf
/var/log/htmlaccess.log
{ errors jim
notifempty
nocompress
weekly
prerotate
/usr/bin/chattr -a /var/log/htmlaccess.log
endscript
postrotate
/usr/bin/chattr +a /var/log/htmlaccess.log
endscript
}
/var/log/netconf.log
{ nocompress
monthly
}

In this example, when the /etc/logrotate.d/linuxconf file is read by /etc/logrotate.conf, the following options will override the defaults specified in /etc/logrotate.conf:
Notifempty
errors jim

The nocompress and weekly options do not override any options contained in /etc/logrotate.conf.

Setting parameters for a specific file
Configuration parameters for a specific file are often required. A common example would be to include a section in the /etc/logrotate.conf file to rotate the /var/log/wtmp file once per month and keep only one copy of the log. When configuration is required for a specific file, the following format is used:
#comments
/full/path/to/file
{
option(s)
}

The following entry would cause the /var/log/wtmp file to be rotated once a month, with one backup copy retained:
#Use logrotate to rotate wtmp
/var/log/wtmp
{
monthly
rotate 1
}

Although the opening bracket may appear on a line with other text or commands, the closing bracket must be on a line by itself.
Using the prerotate and postrotate options
The section of code below shows a typical script in /etc/logrotate.d/syslog. This section applies only to /var/log/messages. On a production server, /etc/logrotate.d/syslog would probably contain similar entries.
/var/log/messages
{
prerotate
/usr/bin/chattr -a /var/log/messages
endscript
postrotate
/usr/bin/kill -HUP syslogd
/usr/bin/chattr +a /var/log/messages
endscript
}

The format for this script uses the following methods:

  • The first line, /var/logmessages, declares the file for which this script will be used.
  • The curly braces,{ }, are used to enclose the entire script. All commands contained within these braces will be run on the /var/log/messages file.
  • The prerotate command specifies actions to be taken prior to the file being rotated by logrotate.
  • The command /usr/bin/chattr -a is run to remove the append-only attribute from /var/log/messages.
  • The endscript command marks the end of the prerotate portion of this script.
  • The next line, postrotate, specifies the following commands are to be run on /var/log/messages after the file has been rotated by logrotate.
  • The command /usr/bin/killall -HUPsyslogd is run to reinitiate the system logging daemon, syslogd.
  • The next command, /usr/bin/chattr +a /var/log/messages, reassigns the append-only attribute to the /var/log/messages file. This means the file may only be seen in append mode. This prevents the file from being overridden by any other program or user.
  • The endscript command appears on a line by itself and marks the end of the postrotate portion of this script.
  • The last curly brace,}, marks the end of commands to be applied to the /var/log/messages file.

Running logrotate
There are three steps involved in running logrotate:

  1. Identify the log files on your system.
  2. Create rotation schedules and parameters for the log files.
  3. Run logrotate through the cron daemon.

The code below shows the default cronjob shipped with Red Hat Linux to allow logrotate to run daily:
#/etc/cron.daily/logrotate
#! /bin/sh

/usr/sbin/logrotate /etc/logrotate.conf

This cronjob allows logrotate to run daily with the rotation parameter specified in /etc/logrotate.conf.

Conclusion
Log rotation is the first step in log file management. The logrotate utility provides the Linux administrator with the ability to maintain a log file rotation policy and to retain copies of log files to assist in establishing patterns related to system usage. In this Daily Drill Down, we looked at the installation and configuration of logrotate, used the include option to read configuration files related to RPM packages, and ran logrotate as a cronjob. We also discussed the proper methods for restarting logrotate after the log rotation procedure is completed.
The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.

Linux

Linux Fedora Install Options

Posted on 2010/04/22 by arno Posted in Linux

Linux Install options in Fedora

http://fedoraproject.org/wiki/Anaconda_Boot_Options

 

Links Linux

Xen on Fedora

Posted on 2010/04/21 by arno Posted in Uncategorized

http://www.howtoforge.com/xen_gui_fedora_7_desktop

http://cosi.clarkson.edu/docs/installingxen/

Links Linux
  • Login
  • Mother of all Portals
  • .Handy .Handig
  • Links – wikis – wikies

Archives

  • June 2022
  • October 2021
  • June 2021
  • September 2016
  • April 2016
  • March 2016
  • November 2014
  • September 2014
  • August 2014
  • July 2014
  • April 2014
  • March 2014
  • November 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • February 2013
  • December 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
CyberChimps ©2025