Tag Info

Hot answers tagged

81

You can look at the contents of /etc/redhat-release, which will look something like this: $ cat /etc/redhat-release CentOS release 5.4 (Final) The contents are different for an actual RHEL system. This technique works on all RedHat derivatives, including CentOS, Fedora, and others.


62

You can use the lsb_release command on recent linux distributions. If you issue: lsb_release -i -r it will tell you the Distribution and Version. This is a little bit more accurate than accessing files that may or may not have been modified by the admin or a software package. As well as working across multiple distros.


60

To be honest, I think this comes down to simple viewpoint: Chef seems more of an imperative, programmatic solution, the usage of ruby as the language instantly makes me hope somebody ported it to python, as is the way of the world with all of ruby's ideas. That's not what you want for this sort of thing though. You want to speak to the void where the ...


21

I prefer to use the /etc/issue file. $ cat /etc/issue I've seen many situations where /etc/redhat-release has been modified to meet software compatibility requirements (Dell or HP's management agents, for instance).


19

I've written a detailed comparison of Chef vs Puppet here: Puppet vs Chef: 10 reasons why Puppet wins. Although it doesn't include use cases, I hope it provides some useful starting points for people wondering which tool to choose for their infrastructure automation.


14

Sorry about the verbosity. Use the tool that makes it's easy to get your job done. That's the point of automation, right? History: I have used puppet in past gigs and last month I spent about a week trying to get used to chef to see if I would make the switch at my new gig. I didn't leap. Jargon: One unfortunate problem with both of these systems is the ...


14

Modify the OPTIONS line in /etc/sysconfig/memcached adding ">> /var/log/memcached 2>&1" on the end. IE OPTIONS="-vv >> /var/log/memcached 2>&1"


12

We recommend everyone run through a reinstall rather than attempt an inplace upgrade from CentOS-4 or CentOS-5! Source: http://lists.centos.org/pipermail/centos-announce/2011-July/017645.html You can run this upgrade centos6 just by using yum upgrade --enablerepo=centosplus. Do not forget: each system running centos is individual (!). I recommend ...


11

About comparing installed kernels with running one: #!/bin/bash LAST_KERNEL=$(rpm -q --last kernel | perl -pe 's/^kernel-(\S+).*/$1/' | head -1) CURRENT_KERNEL=$(uname -r) test $LAST_KERNEL = $CURRENT_KERNEL || echo REBOOT Hope that helps!


11

Install the nsclient++ agent on windows, then configure your RHEL5 nagios config file accordingly. There may be other windows nagios agents, or you can configure nagios to use remote probes with SNMP, but I've used nsclient++ and it works well.


10

Can I suggest an alternative solution? You might find that a configuration management tool like Puppet or Cfengine2 does what you want. You write manifest files that describe how you want a system to look and it goes away and changes the system so it looks like that. Notice the important distinction that you are describing how the system should look, not how ...


10

CPU utilization is measured relative to a single CPU. The maximum is 100% for each CPU, so a four-CPU system would have a maximum CPU utilization of 400%.


9

Add multilib_policy=best to your /etc/yum.conf Yum will now try to install the "best" package.arch for your system and it will only install that one (as long as it is available). Assuming you're on a 64-Bit system, yum will first try to install package.x86_64, if that doesn't exist it will fall back to i386 and noarch. The default setting is ...


8

maybe something like this will help. it will block any hosts, that open more than 150 connections within 2 minutes (180 seconds): iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --set iptables -A INPUT -p tcp --dport 80 -i eth0 -m state --state NEW -m recent --update --seconds 180 --hitcount 150 -j REJECT you have to tune the ...


8

The user ID of scan is set to 0 (root). Check if /etc/passwd contains two entries for scan. One mapped to root. Otherwise, if you are using any other name services check that these dont export scan as UID 0. And make sure you tell these people mapping multiple accounts to the same UID is not a good idea as you break the separation of privileges you would ...


7

Assuming all the users are local users (that is, there's no network directory service like LDAP, Active Directory, NIS, etc), then local users are probably all enumerated in /etc/passwd, which is a colon delimited file with the following fields: username:password:uid:gid:name:home directory:shell You can get just the usernames and home directories, if ...


7

You can try package from ActiveState http://www.activestate.com/activepython/downloads. It doesn't depend on package manager (just unpack and run "install.sh"). Or you can compile Python and create package by yourself Here is how to create RPM by yourself: http://www.ibm.com/developerworks/library/l-rpm1 http://www.tldp.org/HOWTO/RPM-HOWTO/ Here is how ...


7

You can just su. You won't need the password because the script will initally be running as root. There's also the runuser command. If you use /etc/init.d/functions you can use the daemon function which has an option for specifying the user to run as. I'd personally sway towards the latter all other things being equal.


7

No worries, it just executed 'rpm -e' which would not remove any package. [root@web420 ~]# rpm -e rpm: no packages given for erase BTW, for verifying you have not removed all packages you could just run rpm -qa and see the list of installed packages.


7

No, the algorithm is not that simplistic. You can find more information in: http://linux-mm.org/OOM_Killer If you want to track memory usage, I'd recommend running a command like: ps -e -o pid,user,cpu,size,rss,cmd --sort -size,-rss | head It will give you a list of the processes that are using the most memory (and probably causing the OOM situation). ...


7

You deleted all of your users' passwords, because they aren't stored in /etc/passwd anymore like they were in the olden days. pwconv is only for converting entries from passwd to shadow and vice versa -- you should never have to use it in day-to-day tasks. Boot into single-user mode as DaveN suggested, restore the file from backup, chalk this one up to ...


7

First and foremost, boot off a live CD or recovery disk and back up your data. You may want to include system configurations from /etc, too. You can try doing a reinstall over what you have, leaving your partitions you want to keep untouched. As long as you weren't keeping your good data in any system partitions (and let's hope not under /usr), you should ...


7

Per my comment, I don't believe there is an equivalent to the "packages.debian.org" central package archive (with web interface) in CentOS. It's something I think is really missing!


6

Try using: tail --follow=name <logfile> And see if that works better. You don't have to worry about it being rotated out from under you. Any pattern to it stopping? Certain length of time? Certain time of day?


6

Don't try to compile yourself, you'll just get yourself into trouble that way. (and even if you were compiling yourself, you should compile into RPMs and install those, instead of installing directly to the systems). First, try to find all the files you've installed yourself and remove them (check that they don't belong to a system package with rpm -qf ...


6

The answer is found in the Linux source, specifically, /usr/src/linux/mm/shmem.c, starting around line 70 on my system (Gentoo 2.6.31-ish): /* * The maximum size of a shmem/tmpfs file is limited by the maximum size of * its triple-indirect swap vector - see illustration at shmem_swp_entry(). * * With 4kB page size, maximum file size is just over 2TB on ...


6

The /etc/pam.d/system-auth file is used by Red-Hat and like systems to group together common security policies. It is often included in other /etc/pam.d policy files where those common policies are required. When accessing a system via ssh through sshd the /etc.pam.d/sshd policy file is consulted. This file includes /etc/pam.d/system-auth so your changes to ...


6

Disclaimer, I'm the Zenoss Community Manager. Zenoss Core will monitoring your Windows boxes, as well as their applications and databases and most everything else on your network. For Windows there is SNMP and WMI monitoring available without requiring an agent installed on the box.


6

The most reliable way when lsb_release is not installed is: # rpm -q --queryformat '%{VERSION}' redhat-release-server 6Server # rpm -q --queryformat '%{RELEASE}' redhat-release-server 6.4.0.4.el6 On minimal installs, lsb_release is missing. To get this working also with Red Hat clones (credit goes to comments): # rpm -q --queryformat '%{VERSION}' $(rpm ...



Only top voted, non community-wiki answers of a minimum length are eligible