วันเสาร์ที่ 28 กรกฎาคม พ.ศ. 2555

How To Enable or Disable SELinux


From the command line, you can edit the /etc/sysconfig/selinux file. This file is a symlink to/etc/selinux/config. The configuration file is self-explanatory. Changing the value of SELINUX orSELINUXTYPE changes the state of SELinux and the name of the policy to be used the next time the system boots.
[root@host2a ~]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0
Changing the Mode of SELinux Using the GUI
Use the following procedure to change the mode of SELinux using the GUI.
  1. On the System menu, point to Administration and then click Security Level and Firewall to display the Security Level Configuration dialog box.
  2. Click the SELinux tab.
  3. In the SELinux Setting select either DisabledEnforcing or Permissive, and then click OK.
  4. If you changed from Enabled to Disabled or vice versa, you need to restart the machine for the change to take effect.
Changes made using this dialog box are immediately reflected in /etc/sysconfig/selinux.


วันพฤหัสบดีที่ 26 กรกฎาคม พ.ศ. 2555

[E-mail] Can not mount NFS in Ubuntu with CentOS 6.3

Hi everybody

I'm using ubuntu 12.04.LAN IP is 192.168.1.36

I install Virtual Box. In virtual box I install CentOS 6.3. LAN IP is 192.168.56.102

2 computers can ping success

I want to mount folder in CentOS /home/www/web/uploads to /home/nfs (in Ubuntu)

Ubuntu: rootmkdir /home/nfs
/etc/init.d/nfs-kernel-server start
service portmap start
in /etc/exports I add /home/nfs 192.168.56.102(rw,insecure,no_root_squash)

In CentOS:mount -t nfs 192.168.1.36:/home/nfs /home/www/web/uploads

Error: mount.nfs: access denied by server while mounting 192.168.1.36:/home/nfs

Please help me solve this problem

Thank you very much
-------------------


Hi,
Once run "exportfs -av", and once restart portmap and nfs-kernel-server services,
after that try to mount again , in case if you face any issue , please check "tail -f /var/log/syslog"
you can also check following things from client machine
showmount -e <NFS_SERVER_IP> # it will show you nfs settings
also check following command from client side
rpcinfo -p <NFS_SERVER_IP>



Display number of processors on CentOS


Quick question - How do I display number of processors on linux?


Simply use top command:

top

Get info from /proc/cpuinfo with the help of grep command

grep -c processor /proc/cpuinfo

Mounting cd drive in CentOS

Follow  the command to mount a cdrom in CentOS


CD Rom
mount /dev/cdrom /mnt



DVD Rom
mount /dev/dvd /mnt

วันพุธที่ 25 กรกฎาคม พ.ศ. 2555

Remove all i386 packages from CentOS 5 x86_64


A quick solution to duplicate packet installation. This tutorial will show you how to remove all i386 packages from CentOS 5 x86_64 server
yum remove \*.i\?86

How To Adding Swap Space On CentOS

Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 128 MB to 256 MB, but there is only 256 MB of swap space. It might be advantageous to increase the amount of swap space to 512 MB if you perform memory-intense operations or run applications that require a large amount of memory.


To add a swap file:
  1. Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks. For example, the block size of a 64 MB swap file is 65536.
  2. At a shell prompt as root, type the following command with count being equal to the desired block size:
    dd if=/dev/zero of=/swapfile bs=1024 count=65536
    
  3. Setup the swap file with the command:
    mkswap /swapfile
    
  4. To enable the swap file immediately but not automatically at boot time:
    swapon /swapfile
    
  5. To enable it at boot time, edit /etc/fstab to include the following entry:
    /swapfile          swap            swap    defaults        0 0
    
    The next time the system boots, it enables the new swap file.
  6. After adding the new swap file and enabling it, verify it is enabled by viewing the output of the command cat /proc/swaps or free.