How to Install Vsftpd Ftp Server on RHEL 6

In this post, i will show you on how to install Vsftpd service on Red Hat Enterprise Linux 6 (RHEL 6).This post assumed that you have configure local yum repository.

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

1. Install the Vsftpd service.

    [root@rhel6 ~]# yum install vsftpd
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    DVD-RHEL6-Repository                                                         | 3.7 kB     00:00 ...
    DVD-RHEL6-Repository/primary_db                                              | 2.3 MB     00:00 ...
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package vsftpd.i686 0:2.2.2-6.el6 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package            Arch             Version                 Repository                        Size
    ====================================================================================================
    Installing:
     vsftpd             i686             2.2.2-6.el6             DVD-RHEL6-Repository             155 k
    
    Transaction Summary
    ====================================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 155 k
    Installed size: 343 k
    Is this ok [y/N]: y
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : vsftpd-2.2.2-6.el6.i686                                                      1/1
    
    Installed:
      vsftpd.i686 0:2.2.2-6.el6
    
    Complete!
    

2. Start Vsftpd Service :

    [root@rhel6 ~]# service vsftpd start
    Starting vsftpd for vsftpd:                                [  OK  ]
    

3. Stop Vsftpd Service :

    [root@rhel6 ~]# service vsftpd stop
    Shutting down vsftpd:                                      [  OK  ]
    

4. Restart Vsftpd Service :

    [root@rhel6 ~]# service vsftpd restart
    Shutting down vsftpd:                                      [  OK  ]
    Starting vsftpd for vsftpd:                                [  OK  ]
    

5. Make Vsftpd Service auto start on boot up :

    [root@rhel6 ~]# chkconfig vsftpd on
    

How to remove “Red Hat Enterprise Linux Test Page”

Symptoms :
After i installed apache httpd on Red Hat Enterprise Linux (RHEL) server, i got the following message :
Red Hat Enterprise Linux Test Page

Solution :
Go to welcome.conf file :

    [root@rhel6 ~]# vi /etc/httpd/conf.d/welcome.conf
    

To disable the Welcome page, comment out all the lines below :

    # This configuration file enables the default "Welcome"
    # page if there is no default index page present for
    # the root URL.  To disable the Welcome page, comment
    # out all the lines below.
    #
    <LocationMatch "^/+$">
        Options -Indexes
        ErrorDocument 403 /error/noindex.html
    </LocationMatch>
    

Comment out all the lines as below :

    # This configuration file enables the default "Welcome"
    # page if there is no default index page present for
    # the root URL.  To disable the Welcome page, comment
    # out all the lines below.
    #
    #<LocationMatch "^/+$">
    #    Options -Indexes
    #    ErrorDocument 403 /error/noindex.html
    #</LocationMatch>
    

Reload the apache httpd service to take effect :

    [root@rhel6 ~]# service httpd reload
    Reloading httpd:
    

How to Disable the SELinux on RHEL 6

In Redhat Enterprise Linux 6 (RHEL 6) minimal server installation, SELinux is set to enable. To disable SELinux, without having to reboot, you can use the setenforce command as below:

    [root@rhel6 ~]# setenforce 0
    

To disabled the SELinux on your next reboot, please change “SELINUX=enforcing” to “SELINUX=disabled”.

    # 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 - No SELinux policy is loaded.
    SELINUX=enforcing
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

Change to the following :

    # 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 - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

How to Install Extra Repository for Redhat Enterprise Linux 6 (RHEL6)

In this post, i will show you on how to setup Extra Yum Repository for Redhat Enterprise Linux 6 (RHEL6).

1. How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

2. Setup epel yum repository for RHEL 6.

    [root@rhel6 ~]# cd /tmp
    [root@rhel6 tmp]# wget http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    --2012-01-24 08:54:00--  http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    Resolving download.fedora.redhat.com... 209.132.181.26, 209.132.181.27, 209.132.181.23, ...
    Connecting to download.fedora.redhat.com|209.132.181.26|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 14064 (14K) [application/x-rpm]
    Saving to: âepel-release-6-5.noarch.rpmâ
    
    100%[==========================================================>] 14,064      41.3K/s   in 0.3s
    
    2012-01-24 08:54:01 (41.3 KB/s) - âepel-release-6-5.noarch.rpmâ
    
    [root@rhel6 tmp]# rpm -Uvh epel-release-6-5.noarch.rpm
    warning: epel-release-6-5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
    Preparing...                ########################################### [100%]
       1:epel-release           ########################################### [100%]
    
    [root@rhel6 tmp]# yum repolist
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    epel/metalink                                                                | 3.8 kB     00:00
    epel                                                                         | 4.3 kB     00:00
    epel/primary_db                                                              | 3.4 MB     00:38
    repo id                          repo name                                                    status
    RHEL6-Repository                 RHEL6 repository                                             13,395
    epel                             Extra Packages for Enterprise Linux 6 - i386                  5,625
    repolist: 19,020
    

3. Setup Atomic yum repository for RHEL 6.

    [root@rhel6 tmp]# wget http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    --2012-01-24 19:42:14--  http://www6.atomicorp.com/channels/atomic/redhat/6/i386/RPMS/atomic-release-1.0-13.el6.art.noarch.rpm
    Resolving www6.atomicorp.com... 69.20.6.166
    Connecting to www6.atomicorp.com|69.20.6.166|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 6332 (6.2K) [application/x-rpm]
    Saving to: âatomic-release-1.0-13.el6.art.noarch.rpmâ
    
    100%[==========================================================>] 6,332       20.7K/s   in 0.3s
    
    2012-01-24 19:42:15 (20.7 KB/s) - âatomic-release-1.0-13.el6.art.noarch.rpmâ
    
    [root@rhel6 tmp]# rpm -Uvh atomic-release-1.0-13.el6.art.noarch.rpm
    warning: atomic-release-1.0-13.el6.art.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5ebd2744: NOKEY
    Preparing...                ########################################### [100%]
       1:atomic-release         ########################################### [100%]
    
    [root@rhel6 ~]# yum repolist
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    repo id               repo name                                                               status
    RHEL6-Repository      RHEL6 repository                                                        13,395
    atomic                CentOS / Red Hat Enterprise Linux 6Server - atomicrocketturtle.com         394
    epel                  Extra Packages for Enterprise Linux 6 - i386                             5,625
    repolist: 19,414
    

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 6

In this article, I will share about how to update and install RPM packages from the image CD-ROM/DVD-ROM in Red Hat Enterprise Linux 6 (RHEL 6). This step can also be used on CentOS 6 or older versions such as CentOS 5. It would be very useful if the server you have a slow internet connection, or no internet connection. Instead of using internet connection directly to RHEL repositories registered, it is possible to use the Local CD/DVD- ROM as your yum repository. There are two methods to install and configure local yum repository RHEL 6. Both methods have been tested and works well on Linux RHEL 6 server. You can choose whichever method you choose :

Method 1:
1. Insert DVD/ISO into DVD-Drive.
2. Mount the ISO from the DVD-ROM into /mnt directory :

    [root@rhel6 ~]# mount /dev/cdrom /mnt
    mount: block device /dev/sr0 is write-protected, mounting read-only
    

3. Check the existing partition on your RHEL 6 server :

    [root@rhel6 ~]# df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           9845280   1328824   8016336  15% /
    tmpfs                   515660         0    515660   0% /dev/shm
    /dev/sda1               495844     28689    441555   7% /boot
    /dev/sr0               2862360   2862360         0 100% /mnt
    

4. Go to /mnt and check current directory :

    [root@rhel6 ~]# cd /mnt
    [root@rhel6 mnt]# pwd
    /mnt
    

5. List out what is in DVD.

    [root@rhel6 mnt]# ls
    EULA                      RELEASE-NOTES-es-ES.html  RELEASE-NOTES-ru-RU.html
    GPL                       RELEASE-NOTES-fr-FR.html  RELEASE-NOTES-si-LK.html
    HighAvailability          RELEASE-NOTES-gu-IN.html  RELEASE-NOTES-ta-IN.html
    images                    RELEASE-NOTES-hi-IN.html  RELEASE-NOTES-te-IN.html
    isolinux                  RELEASE-NOTES-it-IT.html  RELEASE-NOTES-zh-CN.html
    LoadBalancer              RELEASE-NOTES-ja-JP.html  RELEASE-NOTES-zh-TW.html
    media.repo                RELEASE-NOTES-kn-IN.html  repodata
    Packages                  RELEASE-NOTES-ko-KR.html  ResilientStorage
    README                    RELEASE-NOTES-ml-IN.html  RPM-GPG-KEY-redhat-beta
    RELEASE-NOTES-as-IN.html  RELEASE-NOTES-mr-IN.html  RPM-GPG-KEY-redhat-release
    RELEASE-NOTES-bn-IN.html  RELEASE-NOTES-or-IN.html  Server
    RELEASE-NOTES-de-DE.html  RELEASE-NOTES-pa-IN.html  TRANS.TBL
    RELEASE-NOTES-en-US.html  RELEASE-NOTES-pt-BR.html
    

6. Read what is in media.repo. Take note on the mediaid :

    [root@rhel6 mnt]# cat media.repo
    
    [InstallMedia]
    name=Red Hat Enterprise Linux 6.0
    mediaid=1235481171.125642
    metadata_expire=-1
    gpgcheck=0
    cost=500
    

7. Create dvdrhel.repo text file in /etc/yum.repos.d/ with the following content. Please create something as follow:

    [root@rhel6 ~]# vi /etc/yum.repos.d/dvdrhel.repo
    
    [DVD-RHEL6-Repository]
    mediaid=1235481171.125642
    name=DVD-RHEL6 repository
    baseurl=file:///mnt/Server
    enabled=1
    gpgcheck=0
    

8. Finish. You can start install, remove and update using yum command :

Method 2 :
1. Check the existing partition on your RHEL 6 server :

    [root@rhel6 ~]# df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           9845280   1221632   8123528  14% /
    tmpfs                   515660         0    515660   0% /dev/shm
    /dev/sda1               495844     28689    441555   7% /boot
    

2. Create repo directory in /media :

    [root@rhel6 ~]# mkdir /media/repo
    

3. Create 1 2 3 directory in /media/repo :

    [root@rhel6 ~]# mkdir -p /media/repo/{1,2,3}
    

4. Mount the ISO from the DVDROM into /media/repo/1 directory :

    [root@rhel6 ~]# mount -o loop /dev/cdrom /media/repo/1
    
    [root@rhel6 ~]# df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           9845280   1221644   8123516  14% /
    tmpfs                   515660         0    515660   0% /dev/shm
    /dev/sda1               495844     28689    441555   7% /boot
    /dev/loop0             2862360   2862360         0 100% /media/repo/1
    

5. Create temporary repo folder under /tmp to put required rpm’s packages for createrepo installation :

    [root@rhel6 ~]# mkdir /tmp/repo 
    

6. Copy the require packages to install create repo :

    [root@rhel6 ~]# cp /media/repo/1/Packages/createrepo* /tmp/repo
    [root@rhel6 ~]# cp /media/repo/1/Packages/deltarpm* /tmp/repo
    [root@rhel6 ~]# cp /media/repo/1/Packages/python-deltarpm* /tmp/repo
    

7. Install the rpm packages using below command :

    [root@rhel6 ~]# rpm -ivh /tmp/repo/*
    warning: /tmp/repo/createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
    Preparing...                ########################################### [100%]
       1:deltarpm               ########################################### [ 33%]
       2:python-deltarpm        ########################################### [ 67%]
       3:createrepo             ########################################### [100%]
    

8. Go to /media/repo directory :

    [root@rhel6 ~]# cd /media/repo/
    [root@rhel6 repo]# pwd
    /media/repo
    

9. Run createrepo command :

    [root@rhel6 repo]# createrepo .
     2358/13395 - 1/HighAvailability/Packages/system-config-keyboard-1.3.1-3.el6.i68
    iso-8859-1 encoding on Ville Skyttä  - 2.8.2-2
    
     5037/13395 - 1/LoadBalancer/Packages/system-config-keyboard-1.3.1-3.el6.i686.rp
    iso-8859-1 encoding on Ville Skyttä  - 2.8.2-2
    
     7716/13395 - 1/Packages/system-config-keyboard-1.3.1-3.el6.i686.rpm
    iso-8859-1 encoding on Ville Skyttä  - 2.8.2-2
    
    10395/13395 - 1/ResilientStorage/Packages/system-config-keyboard-1.3.1-3.el6.i68
    iso-8859-1 encoding on Ville Skyttä  - 2.8.2-2
    
    13074/13395 - 1/Server/Packages/system-config-keyboard-1.3.1-3.el6.i686.rpm
    iso-8859-1 encoding on Ville Skyttä  - 2.8.2-2
    
    13395/13395 - 1/Server/Packages/zsh-4.3.10-4.1.el6.i686.rpm
    Saving Primary metadata
    Saving file lists metadata
    Saving other metadata
    

10. Clean up the repo :

    [root@rhel6 ~]# yum clean all
    Loaded plugins: rhnplugin
    Cleaning up Everything
    

11. Create a repo config file in /etc/yum.repos.d/ directory :

    [root@rhel6 ~]# vi /etc/yum.repos.d/rhel.repo
    
    [RHEL6-Repository]
    name=RHEL6 repository
    baseurl=file:///media/repo
    enabled=1
    gpgcheck=0
    

12. Start install using yum command as below :

    [root@rhel6 ~]# yum install httpd
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    RHEL6-Repository                                                             | 1.3 kB     00:00 ...
    RHEL6-Repository/primary                                                     | 5.4 MB     00:00 ...
    RHEL6-Repository                                                                        13395/13395
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package httpd.i686 0:2.2.15-5.el6 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ====================================================================================================
     Package            Arch              Version                   Repository                     Size
    ====================================================================================================
    Installing:
     httpd              i686              2.2.15-5.el6              RHEL6-Repository              813 k
    
    Transaction Summary
    ====================================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 813 k
    Installed size: 2.8 M
    Is this ok [y/N]: y
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : httpd-2.2.15-5.el6.i686                                                      1/1
    
    Installed:
      httpd.i686 0:2.2.15-5.el6
    
    Complete!
    

How to Change the Hostname on RHEL 6/Centos 6 Server

We can change the hostname of the linux operating system by using two basic methods which using the command line or graphical interface. As a reference, this article will describe how to change the hostname Red Hat Enterprise Linux 6 (RHEL 6) or CentOS 6. Please note that the server reboot is required for both options below.

Option A:
1. Modify /etc/sysconfig/network

[root@localhost ~]# vi /etc/sysconfig/network

2. Edit to your preferred hostname :

NETWORKING=yes
HOSTNAME=MyNewHostname.localdomain

3. Save and reboot your server.

Option B:
1. Type the following command to enter GUI mode.

[root@localhost ~]# system-config-network

2. Go to “DNS Configuration”.
Hostname

3. Modify your preferred hostname and click OK.
Hostname

4. Click ” Save & Quit”.
Hostname

5.Reboot your server.