Tag Info

Hot answers tagged

86

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.


64

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.


16

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"


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 ...


12

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!


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

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

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 ...


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%.


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 ...


8

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!


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

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 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

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

Try the disable repo switch: --disablerepo=REPONAME UPDATE To find all repositories currently "known" (enabled and disabled): yum repolist all Then to find which repository is giving you grief for the above package, try: yum list php53-mcrypt-5.3.3-4.ius.el5.x86_64 --showduplicates This will then show which of your repositories provide the above ...


6

Based on your comment on MikeyB's answer you're trying to solve this the wrong way IMHO -- Both numactl and taskset will lock your process to a CPU, but they won't keep other processes off that CPU. If someone else is on that CPU when your process needs it you will have to wait. A better solution is to set your process' nice value to something that will ...


6

Restrict shell access to most of the folders but user's own home folder. This user (USER1) should not be able to run any shell commands that will affect any file/folder but their own. The standard Linux permissions scheme should account for this. Unprivileged users can't modify anything that doesn't belong to them, nor access to folders ...


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 ...


6

Jailkit simplifies it. Jailkit is a set of utilities to limit user accounts to specific files using chroot() and or specific commands. Setting up a chroot shell, a shell limited to some specific command, or a daemon inside a chroot jail is a lot easier and can be automated using these utilities.



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