Convert RPM-Debian

Ubuntu is an excellent Operating System and we can find almost any package through Software Centers or PPA but sometime the software is not available in deb/ppa but only in rpm format than we can convert the rpm file into deb format very easily using one command.

Let’s check that unison package is install or not:

unison -version

Suppose, we have unison package in rpm format only 🙁

We need to install the Utility called Alien for RPM to DEB Conversion:

Read more

Share

IP Setting on CentOS6 using Shell Script

#!/bin/bash

if [ $# -eq 5 ]
then

echo ""
echo "Taking the backup and Changing the hostname from $(hostname) to $1 ..."

sed -i.bk "s/$(hostname)/$1/g" /etc/sysconfig/network

echo ""
echo "Backing up & Assigning the Static IP ..."
echo ""

cp /etc/sysconfig/network-scripts/ifcfg-$2 /etc/sysconfig/network-scripts/$2.bk

cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$2

DEVICE=$2
BOOTPROTO=static
IPADDR=$3.$4
NETMASK=255.255.255.0
GATEWAY=$3.$5
ONBOOT=yes
EOF

echo "Changing the dns ..."
echo ""

sed -i.bk "s/nameserver.*/nameserver $3.$5/" /etc/resolv.conf

echo "Adding $1 as hostname to the /etc/hosts file .."
echo ""

sed -i.bk "/$(hostname)$/d" /etc/hosts
echo "$3.$4 $1" >> /etc/hosts

echo "Restarting the Network Service, Please connect it using the new IP Address if you are using ssh ..."

service network restart

else

echo "Usage: ip.sh <hostname> <interface> <baseip> <ipaddress> <gateway/dns>"
echo "Example: ip.sh testname eth0 10.10.10 41 1"

fi
Share

Cloning Openvz Proxmox PVE container guest machine

  1. I first created a ‘template’ vm containing all stuff I need and using a temporarily ip adres.
  2. In the network config file of eth0 (/etc/sysconfig/network-scripts/ifcfg-eth0) I comment out the HWADDRESS line, else it will not come up with another mac address…
  3. Stop this ‘template’ vm as it is just used for cloning.
  4. Create a backup : vzdump –dumpdir /path/to/backupdir –snapshot 101
  5. Restore in new container : vzrestore /path/to/backupdir/backupfile_of_container_101 102 or vzrestore –storage ‘storagename’ /path/to/backupdir/backupfile_of_container_101 102
  6. Create a new mac for eth0 : vzctl set 102 –netif_add eth0
  7. Modify the hostname in the proxmox webinterface.
  8. Bootup the vm and open a vnc console.
  9. Change the ip address in /etc/sysconfig/network-scripts/ifcfg-eth0
  10. Go to /etc/ssh and remove all keys : rm -f /etc/ssh/*key*
  11. Restart the ssh server so it will regenerate keys : service sshd restart
Share

Allow NFS attachment on Proxmox OpenVZ containers

Prepare the container

To allow a container to use NFS filesystem, you will need to start it with “nfs” feature enabled. If the container is running while you set the –features nfs:on, you will need to reboot it.

# vzctl set 101 --features "nfs:on" --save
# vzctl start 101

After this you may see nfs in /proc/filesystems

# vzctl exec 101 cat /proc/filesystems
 ext3
 ext2
nodev rpc_pipefs
nodev proc
nodev nfs
nodev sysfs
nodev tmpfs
nodev devpts
Share

Stunnel on Debian/Ubuntu with Squid

What’s Stunnel

The Stunnel program is designed to work as an SSL encryption wrapper between remote client and local (inetd-startable) or remote server. It can be used to add SSL functionality to commonly used inetd daemons like POP2, POP3, and IMAP servers without any changes in the program’s code.

What Stunnel basically does is that it turns any insecure TCP port into a secure encrypted port using OpenSSL package for cryptography. It’s somehow like a small secure VPN that runs on specific ports.

Step 1: Create an Ubuntu Droplet

So far I have tested it on Ubuntu 12.04 x32/x64, Ubuntu 12.10 x32/x64, Ubuntu 13.04 x32/x64.

Step 2: Update and Upgrade Ubuntu

Using these commands update your Ubuntu’s package list and also upgrade the existing packages to the latest version:

apt-get update
apt-get upgrade

Read more

Share

Creating PPTP on Pfsense 2.2.4

If you want to build a PPTP server graphically build using pfsense nice looking interface, then please do follow the steps below. Here I assume, a proper NAT firewall is already running in the pfsense configuration.

Step-1

  1. Go to VPN > PPTP from top menu
  2. Under “Configuration” tab-
    1. PPTP redirection > Enable PPTP server
    2. Define “No of user”
    3. Server Address- type 1.2.3.4 (trust me, it works no matter whatever your WAN or LAN IP is!)
    4. Remote Address Range- <your LAN IP>
    5. PPTP DNS Server- I used- 114.130.5.5 and 8.8.8.8
    6. Place a ‘tick’ “Require 128-bit encryption”
    7. Save
    8. Read more

Share