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

Category Archives: 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

PXE and Kickstart, Automated Installations for Linux via WDS

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

source: http://www.ohjeah.net/2008/09/24/pxe-and-kickstart-automated-installations-for-linux-via-wds/

Links Microsoft Server 2008

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
« Previous Page
  • 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