Thursday 29 May 2014

Steps to install an FTP Server on CentOS 6




# yum -y install ftp vsftpd

# vi /etc/vsftpd/vsftpd.conf
local_enable=YES
chroot_local_user=YES

# service vsftpd restart

# chkconfig vsftpd on


Steps to disable SELinux on CentOS 6




In the file /etc/selinux/config, change the value of the variable SELINUX to disabled

# vi /etc/selinux/config
SELINUX=disabled





Steps to change hostname in CentOS 6




Temporary

# hostname <new-hostname>



Permanent

In the file /etc/sysconfig/network, change the value of the variable HOSTNAME.

# vi /etc/sysconfig/network
HOSTNAME=<new-hostname>

Then, restart the network service.

# service network restart

Check if the hostname has changed by running the hostname command:

# hostname

If that does not work, try and reboot the machine.


Steps to configure Proxy in CentOS 6




For yum updates, add the following line to /etc/yum.conf:

proxy=http://<proxy-server-username>:<proxy-server-password>@<proxy-server-IP>:<proxy-port>

OR

proxy=http://<proxy-server-IP>:<proxy-port>



For everything else, declare the following environment variables:

# export http_proxy=http://<proxy-server-username>:<proxy-server-password>@<proxy-server-IP>:<proxy-port>
# export https_proxy=http://<proxy-server-username>:<proxy-server-password>@<proxy-server-IP>:<proxy-port>

OR

# export http_proxy=http://<proxy-server-IP>:<proxy-port>
# export https_proxy=http://<proxy-server-IP>:<proxy-port>



For bypassing the proxy server for any IP address, add it to the environment variable no_proxy:

# export no_proxy="localhost, 127.0.0.1, 10.10.13.178, 10.10.13.196, 10.10.13.198, 10.10.13.199"


Steps to become a root user in CentOS 6




You can user any of the following commands to change to the root user, provided you have the root password:

# su - root

OR

# su root

OR

# su -

OR

# su



Easy and dirty way for your user to run commands with root privileges is to add the following line to /etc/sudoers:

user1    ALL=(ALL)    ALL

You may do this using either visudo command, or by opening the /etc/sudoers file in your favorite text editor. You will of course need to be root.

# su - root
# visudo

OR

# su - root
# vi /etc/sudoers



You can prefix every command you want to run with root privileges with "sudo". You will be asked for your user's password, and not the root password.

You can also open a root shell by using the command:

# sudo -s


Steps to enable and disable firewall in CentOS 6


You have to be the root to run the following commands.



Enable Firewall for IPv4:

# service iptables start
# chkconfig iptables on


 
Disable Firewall for IPv4:

# service iptables save
# service iptables stop
# chkconfig iptables off



Enable Firewall for IPv6:

# service ip6tables start
# chkconfig ip6tables on



Disable Firewall for IPv6:

# service ip6tables save
# service ip6tables stop
# chkconfig ip6tables off