Yum Commands
YUM packages updater (Fedora, RedHat and alike)
Download and install a rpm package
This will install an RPM, and try to resolve all the dependencies for you using your repositories.
yum localinstall package_name.rpm
Update all rpm packages installed on the system
Upgrade a rpm package
Remove a rpm package
List all packages installed on the system
Find a package on rpm repository
Clean up rpm cache erasing downloaded packages
Remove all files headers that the system uses to resolve dependency
Remove from the cache packages and headers files
Disable SELinux for Apache
You can disable Apache SELinux protection easily.
Please keep in mind that by disabling SELinux for apache you are inviting more security related problems.
Disable Apache SELinux Protection
Open /etc/selinux/targeted/booleans file using a text editor:
# vi /etc/selinux/targeted/booleans
Append or modify value for httpd_disable_trans as follows:
Save and close the file. Type the following two commands:
# setsebool httpd_disable_trans 1
# /etc/init.d/httpd restart
GUI tool to disable SELinux for Apache
Open a shell prompt type the command system-config-securitylevel
system-config-securitylevel
Next select SELinux tab > click on Disable SELinux protection for httpd daemon checkbox > Save the changes
Finally restart httpd service:
# /etc/init.d/httpd restart
Changing time zone in Linux
1. Logged in as root, check which timezone your machine is currently using by executing `date`. You’ll see something like Mon 17 Jan 2005 12:15:08 PM PST, PST in this case is the current timezone.
2.Change to the directory /usr/share/zoneinfo here you will find a list of time zone regions. Choose the most appropriate region, if you live in Canada or the US this directory is the “America” directory.
3. If you wish, backup the previous timezone configuration by copying it to a different location. Such as
mv /etc/localtime /etc/localtime-old
4. Create a symbolic link from the appropiate timezone to /etc/localtime. Example:
ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
5. If you have the utility rdate, update the current system time by executing
/usr/bin/rdate -s time.nist.gov
6. Set the ZONE entry in the file /etc/sysconfig/clock file (e.g. “America/Los_Angeles”)
7. Set the hardware clock by executing:
How to Change Date and Time
You can change the date and time on linux machine using the date command.
Example: If you want to change the date to July 31, 11:16 pm then type as follows
If you want to change the year as well, you could type
You can also use the following:
date -s “31 JULY 2009 23:16:00″
Iptables Command Switch
Each line of an iptables script not only has a jump, but they also have a number of command line options that are used to append rules to chains that match your defined packet characteristics, such the source IP address and TCP port.
-t ‘table.
If you don’t specify a table, then the filter table is assumed. The possible built-in tables include: filter, nat, mangle
-j ‘target’
Jump to the specified target chain when the packet matches the current rule.
-A
Append rule to end of a chain
-F
Flush. Deletes all the rules in the selected table
-p ‘protocol-type’
Match protocol. Types include, icmp, tcp, udp, and all
-s ‘ip-address’
Match source IP address
-d ‘ip-address’
Match destination IP address
-i ‘interface-name’
Match “input” interface on which the packet enters.
-o ‘interface-name’
Match “output” interface on which the packet exits