How to install Webmin on pidora

I tried to install webmin by following the instructions on http://www.webmin.com/rpm.html but I got the following error messages:

 

    # wget http://prdownloads.sourceforge.net/webadmin/webmin-1.730-1.noarch.rpm

    # wget http://www.webmin.com/jcameron-key.asc

    # rpm -Uvh webmin-1.730-1.noarch.rpm

    Preparing…                          ################################# [100%]

    Unable to identify operating system

    error: %pre(webmin-1.730-1.noarch) scriptlet failed, exit status 2

    error: webmin-1.730-1.noarch: install failed

 

To fix the problem, I did the following (thanks to kayvan):

   # mv /etc/redhat-release /etc/redhat-release.bak

   # echo “Fedora release 20 (Heisenbug)” > /etc/redhat-release

   # rpm -Uvh webmin-1.730-1.noarch.rpm Preparing…

   #    ################################ [100%]

    Operating system is Fedora Linux

    Updating / installing…

       1:webmin-1.730-1

   #   ################################# [100%]

    Webmin install complete. You can now login to http://pidora.local:10000/

    as root with your root password.

    # mv -f /etc/redhat-release.bak /etc/redhat-release

Webmin should work fine. It will only report the version to be “Fedora Linux 20”

You should be able to live with that!

 

Update:

You may want to use the current version of webmin:

wget http://www.webmin.com/download/rpm/webmin-current.rpm

 

Using the Webmin YUM repository is another alternative to keep things clean and automatically updated.

If you like to install and update Webmin via RPM, create the /etc/yum.repos.d/webmin.repo file containing :

 

[Webmin]

name=Webmin Distribution Neutral

#baseurl=http://download.webmin.com/download/yum

mirrorlist=http://download.webmin.com/download/yum/mirrorlist

enabled=1

 

You should also fetch and install my GPG key with which the packages are signed, with the commands :

 

wget http://www.webmin.com/jcameron-key.asc

rpm –import jcameron-key.asc

 

You will now be able to install with the command :

 

yum install webmin

 

All dependencies should be resolved automatically.

 


Posted in Linux, pidora, Raspberry Pi, Recent Posts and tagged , , by with comments disabled.

Using ls to create a table of contents for burning a CDR disk

#!/bin/bash

# ex40.sh (burn-cd.sh)

# Script to automate burning a CDR.

 

SPEED=10         # May use higher speed if your hardware supports it.

IMAGEFILE=cdimage.iso

CONTENTSFILE=contents

# DEVICE=/dev/cdrom     For older versions of cdrecord

DEVICE=”1,0,0″

DEFAULTDIR=/opt  # This is the directory containing the data to be burned.

                 # Make sure it exists.

                 # Exercise: Add a test for this.

 

# Uses Joerg Schilling’s “cdrecord” package:

# http://www.fokus.fhg.de/usr/schilling/cdrecord.html

 

#  If this script invoked as an ordinary user, may need to suid cdrecord

#+ chmod u+s /usr/bin/cdrecord, as root.

#  Of course, this creates a security hole, though a relatively minor one.

 

if [ -z “$1” ]

then

  IMAGE_DIRECTORY=$DEFAULTDIR

  # Default directory, if not specified on command-line.

else

    IMAGE_DIRECTORY=$1

fi

 

# Create a “table of contents” file.

ls -lRF $IMAGE_DIRECTORY > $IMAGE_DIRECTORY/$CONTENTSFILE

# The “l” option gives a “long” file listing.

# The “R” option makes the listing recursive.

# The “F” option marks the file types (directories get a trailing /).

echo “Creating table of contents.”

 

# Create an image file preparatory to burning it onto the CDR.

mkisofs -r -o $IMAGEFILE $IMAGE_DIRECTORY

echo “Creating ISO9660 file system image ($IMAGEFILE).”

 

# Burn the CDR.

echo “Burning the disk.”

echo “Please be patient, this will take a while.”

wodim -v -isosize dev=$DEVICE $IMAGEFILE

#  In newer Linux distros, the “wodim” utility assumes the

#+ functionality of “cdrecord.”

exitcode=$?

echo “Exit code = $exitcode”

 

exit $exitcode


Posted in Linux, Recent Posts and tagged by with comments disabled.

How to Install and Configure VsFTPD on Rasberry Pi

I have chosen to use VsFTPD instead of ProFTP for it’s simple configuration but robust high load capability.

This steps can be implemented on any debian based linux systems like ubuntu, Rasbian and very many others. I have RaspBMC (an XBMC Media Centre) running on my Rasberry Pi.

STEP 1: Installation

As in any other debian based Linux systems, the installation of the FTP server can be done simply by executing the following command:

$ sudo apt-get install vsftpd

This command installs and start the ftp server automatically.

This is an example of the VsFTPD configuration file (/etc/vsftpd.conf):

——– start ———–

listen=NO
pamservicename=ftp
anonymousenable=NO
local
enable=YES
writeenable=YES
dirmessage
enable=YES
uselocaltime=YES
xferlog
enable=NO
connectfromport20=YES
ftpd
banner=Raspbmc FTP Server
securechrootdir=/var/run/vsftpd/empty
pamservicename=vsftpd
rsacertfile=/etc/ssl/private/vsftpd.pem
localroot=/home/$USER/publichtml
localumask=022
chroot
localuser=YES
user
subtoken=$USER
allow
writeable_chroot=YES

——– stop —————

STEP 2: Configuration

Stand-alone mode:

The ftp server can either be configured in stand-alone or normal mode. By default the VsFTPD automatically configured as stand-alone. This means that the server have its own startup scripts called daemon. In that case, the VsFTPD daemon can be started by executing “/etc/init.d/vsftpd start”. The server in stand-alone mode can further be managed with stop, restart, status and reload.

Normal mode:

The other approach to configure the VsFTPD server is to use “xinetd” to start the FTP service in normal mode. This helps to keep the FTP service alive. In order to achieve this objective, we first need to install the “xinetd” super server by executing the following command:

$ sudo apt-get install xinetd

The above command will install and start the xinetd super server on your system automatically. However, there is the chance that “xinetd” is already installed on your system. In that case, please skip the step above.

Next, create a file called vsftpd in /etc/xinetd.d/ with the following content:

service ftp
{
disable = no
sockettype = stream
wait = no
user = /usr/sbin/vsftpd
per
source = 5
instances = 200
noaccess = 192.168.1.0/24 #use this to block any connections from this network
onlyfrom = 192.168.1.0/24 #use this to allow connections only from this network
bannerfail = /etc/vsftpd.busy
log
onsuccess += PID HOST DURATION
log
on_failure += HOST

}

Pleas alter any of these options to match your system configurations.

  • server – to get the correct path to enter here, type “which vsftpd” on the terminal
  • noaccess – this will block any host or hosts defined here
  • bannerfail – this should the path to the file with the text to show to any blocked IP address

STEP 3: /etc/vsftpd.conf Configuration

Open the file /etc/vsftpd.conf and change

listen=YES

to

listen=NO

This instructs the FTP server not to open any ports but let “xinetd” control and manage the entire ports and services. In order for the normal mode to run smoothly, we need to first stop the vsftpd service by executing the following command:

$ sudo service vsftpd stop

followed by

$ sudo service xinetd reload

We have to test and confirm that the FTP server have been started in normal mode and that the port 21 is open by the following command:

$ sudo netstat -ant | grep 21

You should see this:

tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN


Posted in FTP, Linux, Linux Installation, VsFTP and tagged , , by with comments disabled.

VMware STOP: 0x0000005d Error

Warning:

I am NOT the original author of this article. You can find the original article here!

I recently ran into this error while trying to install Windows 2008 R2 Server 64 Bit on my corporate virtual network. Windows 2003 server standard was initially installed on this same configuration. The aim of the project was to remove the Windows 2003 server and install windows 2008 R2 server on it the system. Well, I completely forgot before starting that I had to change the guest operating system type. this eventually lead to this error.

After searching a while on google, I came accross the above mentioned article. It saved my day! The question is why repeat the same thing here? Well, I decided to repeat this here for my personal reference only. It might be useful for someone else too.


Posted in Linux, Linux Installation, VMware and tagged , , by with comments disabled.

Progress Monitor On a Linux Console

I sometimes want to monitor the progress of a copy or backup job on the console. The trick to do that is as follows:

while true; do something…; sleep 10; clear; done;

example:

[tom@ns2 ~]# while true; do df- h /media/usr; sleep 10; clear; done;

 

What this is, it display the size of /usr partition, the used space, available space and the progress of the job in percentage. The “clear” command will make sure all these informations are shown on a single line by clearing the screen. The clear command is very cool 😉

It hope someone find this useful 


Posted in Linux, Rsync and tagged , by with comments disabled.

Mounting NFS Shares on ESX 4.0

The easiert way to do this is to use ssh (Putty).

Run all commands in these steps from the ESX/ESXi command line with root access.

Ensure that you can ping and vmkping the NFS server address.

Ensure that any firewalls between the ESX host and NFS Server do not block the connection.

Ensure the access on the NFS server is set to Anonymous user, Root Access (norootsquash), and Read/Write.

Try to restore the mount with this command:

# esxcfg-nas -r

Check to see if the datastore has mounted after trying to restore it with:

# esxcfg-nas -l

If it is not mounted, try remounting it using this command:

# esxcfg-nas -a <datastore name> -o <nfs server hostname/ip> -s <mount point>

Alternatively try to add the datastore again using the vSphere client:

For security reasons RPC protocol filtering is enabled and the connection is refused. Open firewall ports on the network for RPC protocol and check the physical switch for any RPC protocol filtering.

On ESX hosts only (Does not apply to ESXi hosts):

Check ESX firewall open ports with this command:

# esxcfg-firewall -q 

Note: Check the output for NFSClient. If it is not listed, proceed to step 9.

Open the NFS client firewall ports 111 and 2049 on UDP and TCP protocol either on vCenter Server or on ESX with the command:

# esxcfg-firewall –enableService nfsClient

Alternatively, modify the security policy in vSphere Client. Click Configuration > Security Profile > Properties, select NFS Client and click OK.

Note : Ensure that the ports 111 and 2049 are also open on the NFS server.

Known Issues:

Unable to connect to NAS volume NFS4exports: Unable to mount, no VMkernel TCP stack found

Solution:

 Note: Do not set up NFS datastores through the vSphere Client on the ESX Server system. Unlike VMFS datastores, NFS datastores created through the vSphere Client are not recognized by Lab Manager. Such datastores conflict with the creation of NFS datastores through the Lab Manager Web console.

NFS Server

  • Ensure the NFS server supports NFSv3 over TCP
  • The NFS server must be accessible in read-write mode by all Managed Server (ESX) systems
  • The NFS server must allow read-write access for the root system account
  • The NFS export must be set for either no_root_squash, or chmod 1777
  • Ensure NFS daemons are running on the server (“rpcinfo -p localhost” or “service nfs status” )

VMKernel must be able to mount share

  • Check the VMkernel IP address:
    • Using the vSphere Client, select the ESX server
    • Select the Configuration tab
    • Click Networking
    • View the Networking diagram for the VMkernel (or click Properties, and click VMkernel in the Ports tab. If VMkernel is not listed, you must add it)
  • Ensure this IP is allowed to mount the NFS share by inspecting the export list

This issue may also occur if EtherChannel is configured and an incorrect NIC teaming policy is used.


Posted in Linux, NFS and tagged , by with comments disabled.

CentOS 6.4 Netinstall

Download the network installation iso file and burn to CD.
Place the CD in the CD-Rom and reboot the system.
When ask to select the network install method, choose “HTTP” and enter the following:

1) for 32 Bit
Host: mirror.centos.org
Directory: centos/6.4/os/i386

2) for 64 Bit
Host: mirror.centos.org
Directory: centos/6.4/os/x86_64

Posted in CentOS, Linux, Linux Installation and tagged , , by with comments disabled.

Can’t Mount A USB Device On ESX/ESXi Server

You may want to mount a USB device (Key or media) on an ESX server to export or import files (e.g. vmdk). The problem is the USB devices shows up with “lsusb” but is not mounted properly.

The reason for this behaviour is that the ESX/ESXi 4.1 is designed for passthrough to any virtual machine on the system. As such, the usbarbitrator service will always claim external devices plug into the host using the passthrough technology to make it available for the virtual machines. To resolve this issue, the usbarbitrator must be stopped first before the external device can successfully be mounted. In the following steps, I will explain how it’s been done:

Requirement:

  • SSH server must be running on the host (ESX/ESXi)
  • PuTTY or the console of another UNIX/Linux system 

1.) Stop the usbarbitrator service by running this command

/etc/init.d/usbarbitrator stop

2.) Disconnect and reconnect the usb device. The device might be automatically mounted under

/vmfs/volumes/NO NAME/ (just navigate here to export or import your files)

**) If not automatically mounted, use the following commands to find out where the device is connected to (e.g. /dev/sda1)

fdisk -l
tail /var/log/messages

To mount the device, first create a folder

mkdir /ExtUSB

mount the device with

mount -t ext3 /dev/sda1 /ExtUSB/

3.) After using the device, run the following command to start the usbarbitrator service

/etc/init.d/usbarbitrator start

We are done!


Posted in ESX, ESXi, Linux, VMware and tagged , , by with comments disabled.

How to Export/Import Virtual Machine On ESX Server

We recently updated our hardware (old ESX server) and had to export and import the virtual machines to the new server

In achieving this goal, we had to use an external USB drive to backup and transfer VMDK files from an old ESX server to the new one.

Requirements:

  • External USB drive with enough capacity
  • The drive has to be formated (preferably ext3 or ext4)
  • Coffee, cigarett or anything but no alcohol 😉

Format and Mount the Drive:

 Steps:

  • Connect the external drive to the ESX server
  • Login to the server console using ssh connection (e.g putty)
  • To find out where the device is connected, enter “fdisk -l” (without the quotes ” “)
  1. fdisk -l

 

 

 

 

Note: As seen above, a partition has been created and only need to be formated

  • Format the new drive by typing these commands

  mkfs.ext3 -m 1 /dev/sdb1

 e2label /dev/sdb1 /ExtUSB (optional)

  where sdb1 is the partition shown above and 1 for 1% of the partition for administrative purposes

  for more information, type man mkfs.ext3   

  • Create a folder (mount point) where you want to mount the new drive (Example: mkdir /ExtUSB)
  • mount -t ext3 /dev/sdb1 /ExtUSB

  To make this permanet, type vi /etc/fstab and enter:

  LABEL=/ExtUSB1  /ExtUSB   ext3   defaults        0 0

  Save the file (type  :wq and press ENTER)

  • mount the partition

  mount -a

  • Check the to see that the new partition is mounted as expected by typing

  mount

Export the VM files and Logs to the external USB drive:

Vmktools is the VMware ESX Server file system management tool we used for this task. It is a program for creating and manipulating virtual disks, files systems, logical volumes and physical storage devices on the VMware ESX Server. To export or import VMDK (virtual disk) files, the command to use is ‘vmkstools’.

Export:

  • Enter the following comands as it is to export the VMDK files

  vmkfstools -i /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk /mnt/usb/[vm_name].vmdk -d 2gbsparse

  • To also export the configuration files for the virtual machine, just copy all those files with the following extentions: *.vmx, /.log, *.nvram, *.vmxf and *.vmsd. The best way to do this, is to first zip the files in tar.gz format and then copy to the external USB drive as follows:

  cd /vmfs/volumes/[datastore_name]/[vm_name]/

  tar -czvf [vm_name].tar.gz *.vmx *.log *.nvram *.vmxf *.vmsd

  cp [vm_name].tar.gz /mnt/usb/

Import:

Prior to importing the exported files, make sure you have created a new virtual machine (name it whatever you want). The VMDK and other files in the newly created virtual machine must be deleted to avoid conflicts with the ones to be imported. Take a look at these images to get an idea where to find these files:

Browse Data Storage

Browse the Data Storage

Delete VMDK Files

Delete all files from the VM folder as shown above

  • Enter the following comands to import the VMDK files

 vmkfstools -i /[path_to_USB_mount]/[vm_name].vmdk /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk

  • To also import the configuration files for the virtual machine, first extract [vm_name].tar.gz file to a folder (should be created first) and just copy all those files with the following extentions: *.vmx, /.log, *.nvram, *.vmxf and *.vmsd to /vmfs/volumes/[datastore_name]/[vm_name]/. The following comands should take care of this task:

  cd ~ (change to home directory)

  mkdir VMDK-Files

  cp /ExtUSB/[vm_name].tar.gz VMK-Files/

  cd VMDK-Files/

 tar -xzvf [vm_name].tar.gz

  rm -rf [vm_name].tar.gz

    cp * /vmfs/volumes/[datastore_name]/[vm_name]/

You can check to see if all files are imported as shown below:

Imported VMDK Files

Now, go ahead and start your VM machine. If carefully done, it should work as expected.

Related Site:

http://www.vladan.fr/


Posted in ESX, ESXi, Linux, VMware and tagged , , , by with comments disabled.

How To Disable CD/DVD ROM And USB Port On Linux Systems

 
There are many methods to do this and I will be covering some of these methods here
These methods has been successfully tested on RHEL and CentOS but I am also sure it will work on many other Linux distributions.
 
Disabling CD/DVD ROM
 
1. Method:
 
A more practical and reversible way is to rename the kernel module
Log into the linux system and enter the following inputs on the system console
 
[root@lnxesx ~]# cd /lib/modules/$(uname -r)/kernel/drivers/cdrom
[root@lnxesx cdrom]# ls
cdrom.ko-ok
[root@lnxesx cdrom]# mv cdrom.ko cdrom.ko-ok
 
Disabling USB Port

1. Method:

Similarly to the method used above for CD/DVD ROM, USB ports can be disabled using same method as well.
 
[root@lnxesx ~]# cd /lib/modules/$(uname -r)/kernel/drivers/usb/storage
[root@lnxesx storage]# ls
ums-alauda.ko   ums-datafab.ko  ums-isd200.ko    ums-karma.ko     ums-sddr09.ko  ums-usbat.ko
ums-cypress.ko  ums-freecom.ko  ums-jumpshot.ko  ums-onetouch.ko  ums-sddr55.ko  usb-storage.ko-ok
[root@lnxesx storage]# mv usb-storage.ko usb-storage.ko-ok
 
2. Method:
 
Grub option
 
You can get rid of all USB devices by disabling kernel support for USB via GRUB. Open grub.conf or menu.lst (Under Debian / Ubuntu Linux) and append “nousb” to the kernel line as follows:
 
kernel /vmlinuz-2.6.18-128.1.1.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 nousb
 

Posted in Linux and tagged , , , , by with comments disabled.