Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to install bulk packages using yum with groupinstall?

Answer:

Sometimes, if you forgot to select "Development Tools" during Fedora/CentOS installations, you can add them later by using one command

yum groupinstall "Development Tools"

Which save you a lot of times from installing the needed packages one by one.

To see what options are available for groupinstall, try

yum grouplist

How to extract RPM package without installing it

Answer:

Assume you have foo.rpm, type the following command to extract the rpm's contents

rpm2cpio foo.rpm | cpio -idmv

Ban a remote IP Address using iptables

Answer:

iptables -A INPUT -s IP -j DROP

Replace IP with the actual remote IP address.

Note that the blocking will be lost when server reboot. You would need to save the rule(s) into a script and reload when server reboot.

How to turn off SELinux?

Answer: (pick either one)

1. Change the run-time configuration (won't take effect when you reboot)

# sestatus informs you of the two permission mode statuses,
# the current mode in runtime and the mode from the config
# file referenced during boot:

sestatus | grep -i mode
Current mode: enforcing
Mode from config file: enforcing

# Changing the runtime enforcement doesn't effect the
# boot time configuration:

setenforce 1
sestatus | grep -i mode
Current mode: permissive
Mode from config file: enforcing

2. Turn off SELinux permanently, use the following command

system-config-securitylevel

Source: http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/selinux-guide/rhlcommon-section-0068.html

How to check if a rpm package is already installed?

Answer:

To query if a package is installed, e.g.

rpm -q httpd

To display package information, e.g.

rpm -qi httpd