Wednesday, June 3, 2009
Monday, March 31, 2008
How To Install VMware Server On OpenSUSE 10.3
How To Install VMware Server On OpenSUSE 10.3
Today, I will explain to you how to install VMWare Server on openSUSE 10.3. What this will do for you is be able to run Windows inside your Linux computer. If you have that Windows app that just doesn't run under Wine, then this is the setup for you.
Read more...Setting Up LVM On Top Of Software RAID Subsystem - RHEL & Fedora
Setting Up LVM On Top Of Software RAID Subsystem - RHEL & Fedora
Here is a quick look how to build an LVM on top of RAID 1 array, so that we combine the power of these two. This kind of setup is extremely useful in situations where we want a file server to store large amounts of data which provides a centralized backup, storage space for downloadable files via ftp/http, and that may grow enormously in the coming years after the initial setup.
Read more...Friday, February 15, 2008
OpenVPN Windows HowTo
OpenVPN is a full-featured SSL VPN solution which can accomodate a wide range of configurations, including remote access, site-to-site VPNs, WiFi security, and enterprise-scale remote access solutions with load balancing, failover, and fine-grained access-controls.
Although originally developed for Linux, OpenVPN is now widely used for providing VPN services for Windows clients. This document describes how we install and configure OpenVPN to work in a Microsoft Windows only environment.
Prerequisites
This how to assumes that you have various things already set up:
OpenVPN Server
You need a Windows system to act as the OpenVPN server. This can be a Windows 2000/2003 Server or 2000/XP Professional system.
OpenVPN Clients
One or more OpenVPN client systems. These should be Windows 2000/XP Professional, although 2000/2003 server should work equally well.
Networking
The OpenVPN server system needs to be publically reachable on UDP port 1194 (you can use another port if required but this is the standard port for OpenVPN). If the server is behind a NAT router then this will require address/port forwarding.
It's preferable for the server IP address to be static as this makes things more stable. If your server has a dynamic IP address then you will need to use a dynamic DNS service to provide a fixed hostname.
All systems should have an unfiltered Internet connection, or at least one that allows communication on UDP port 1194. It is possible to run OpenVPN through through more restrictive connections (e.g. a proxy server), but this is outside the scope of this article.
Names and addresses
The names and addresses used in this how to are examples only and should be changed to suit your environment.
- Company Name: Acme Corp.
- Public Domain Name: acme.com
- Private (Windows) Domain Name: acme.com.local
- Server Hostname: widget
- LAN address: 192.168.0.0/24
- Server public address: 1.2.3.4
- Server private address: 192.168.0.1
- VPN address: 10.8.0.0/24
Software
OpenVPN
We generally use the OpenVPN GUI package on Windows systems rather than the stock package, as this provides a system tray icon for controlling the application:
http://openvpn.se/download.html
Server Configuration
Install OpenVPN
OpenVPN GUI can be installed with default options (certificate wizard is not needed). Near the end of the install it will add a TAP-Win32 virtual adapter that is not signed, you need to tell Windows to install this as requested.
Once the installation is complete, you will need to create additional TAP-Win32 virtual adapters using the shortcut in the OpenVPN program group. One adapter is needed for each concurrent VPN user. Rename these adapters to "OpenVPN #n" where n is the adapter number. This is cosmetic only but helps identification.
Configure OpenVPN
Create the server configuration file in the OpenVPN config folder (c:\program files\openvpn\config\)
## server.ovpn ##
port 1194
proto udp
dev tun
ca ca.crt
cert widget.crt
key widget.key
dh dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.0.0 255.255.255.0"
push "dhcp-option WINS 192.168.0.1"
push "dhcp-option DNS 192.168.0.1"
push "dhcp-option DOMAIN acme.com.local"
keepalive 10 120
comp-lzo
max-clients 4
persist-key
persist-tun
status openvpn-status.log
verb 3
Values in italics should be changed to suit your environment.
In this example the max-clients has been set to 4, which would require 3 additional TAP-Win32 virtual adapters to be created.
Set up a Certificate Authority (CA)
You need a Certificate Authority (CA) to sign your client and server certificates. The easy-rsa scripts make this pretty straightforward.
First we need to initialise easy-rsa. You should only do this once as it will wipe out any existing certificates, keys and settings.
C:\Program Files\OpenVPN\easy-rsa> init-config
Next edit vars.bat and change the "KEY_" settings at the bottom of the file.
set KEY_COUNTRY=GB
set KEY_PROVINCE=London
set KEY_CITY=London
set KEY_ORG=Acme
set KEY_EMAIL=hostmaster@acme.com
Finally create the keys folder and the root certificate itself.
C:\Program Files\OpenVPN\easy-rsa> vars
C:\Program Files\OpenVPN\easy-rsa> clean-all
C:\Program Files\OpenVPN\easy-rsa> build-ca
You will be asked to enter some details for the root certificate. Most of these will default to the values that you entered into vars.bat, but you will need to choose a "Common Name" for the certificate.
Common Name (eg, your name or your server's hostname) []:Administrator
Keys and certificates are created in the keys subfolder. The ca.crt file (root certificate) should be copied to the OpenVPN config folder.
C:\Program Files\OpenVPN\easy-rsa> copy keys\ca.crt ..\config\
Important: Key files (.key) are very sensitive and should be kept safe and never sent over insecure (unencrypted) channels. The Certificate Authority key (ca.key) is particularly important - if it is lost or comprimised then you will have to replace all your keys and certificates.
Set up server key and certificate
Once the CA has been set up, we can generate a key and certificate for the server.
C:\Program Files\OpenVPN\easy-rsa> vars
C:\Program Files\OpenVPN\easy-rsa> build-key-server widget
Executing the vars.bat is not necessary if you do this straight after creating the CA because the environment will still be set (but it doesn't hurt).
As with generating the root certificate, most of the details will default to the correct values but you will need to enter a "Common Name". This is best set to the hostname of the server.
Common Name (eg, your name or your server's hostname) []:widget.acme.com.local
You can leave the challange password and optional company name blank.
The server also needs Diffie Hellman parameters.
C:\Program Files\OpenVPN\easy-rsa> build-dh
This may take a while...
Finally copy the key, certificate and DH file to the OpenVPN config folder.
C:\Program Files\OpenVPN\easy-rsa> copy keys\widget.crt ..\config\
C:\Program Files\OpenVPN\easy-rsa> copy keys\widget.key ..\config\
C:\Program Files\OpenVPN\easy-rsa> copy keys\dh1024.pem ..\config\
Setup VPN routing
Routing on the server should be enabled by enabling LAN routing in the Routing and Remote Access service, however we've found that this causes problems with the OpenVPN service so I would not recommend it. Instead use regedit to set the IPEnableRouter registry key to 1.Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Value: IPEnableRouter
Type: REG_DWORD
Data: 0x00000001 (1)
To allow VPN clients to communicate with systems on the LAN (other than the VPN server), you need to add the VPN network to your router(s) configuration. For a simple stub network you would do this by adding a static route to the default gateway to direct traffic for 10.8.0.0/24 to the server.
Network: 10.8.0.0
Subnet Mask: 255.255.255.0
Next Hop Address: 192.168.0.1
To do this with on an IPCop firewall, add a line to the /etc/rc.d/rc.local file.
#!/bin/sh
/sbin/route add -net 10.8.0.0/24 gw 192.168.0.1
You can also add this route at the command line to avoid rebooting the router.
root@ipcop:~ # route add -net 10.8.0.0/24 gw 192.168.0.1
Finishing touches
We like to create a batch file called restartvpn.cmd in the OpenVPN config folder (and desktop shortcut) to restart the OpenVPN service in case it gets stuck.
net stop openvpnserviceConfigure the OpenVPN service to start automatically on boot using the services applet, and then start the service.
net start openvpnservice
Client Configuration
Install OpenVPN
Again the OpenVPN GUI can be installed with default options.
I like to rename the TAP-Win32 (in Network connections) adapter to "OpenVPN". This is cosmetic only but helps identification.Configure OpenVPN
Create the client configuration file in the OpenVPN config folder (c:\program files\openvpn\config\).
## acme.ovpn ##
client
proto udp
dev tun
remote 1.2.3.4 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert fred.crt
key fred.key
comp-lzo
verb 3
Values in italics should be changed to suit your environment.
In this example we assume that the name of the client is "Fred".
Set up client key and certificate
We will generate client keys and certificates on the server, which means you have to be careful to securely transport the client key to the client machine. To avoid this you could generate the key on the client along with a Certificate Signing Request (CSR) which can then be transported to the server where it is signed to create the certificate, however this is beyond the scope of this document.
Generate the client key and certificate on the OpenVPN server machine.
C:\Program Files\OpenVPN\easy-rsa> vars
C:\Program Files\OpenVPN\easy-rsa> build-key fred
Then copy the client key and certificate along with the root certificate securely to the config folder on the client machine. The simplest way of doing this is to just put the files on a USB key (or floppy disk).
C:\Program Files\OpenVPN\easy-rsa> copy keys\fred.crt a:\
C:\Program Files\OpenVPN\easy-rsa> copy keys\fred.key a:\
C:\Program Files\OpenVPN\easy-rsa> copy keys\ca.crt a:\
Then on the client machine
C:\Program Files\OpenVPN\easy-rsa> copy a:\fred.crt ..\config\
C:\Program Files\OpenVPN\easy-rsa> copy a:\fred.key ..\config\
C:\Program Files\OpenVPN\easy-rsa> copy a:\ca.crt ..\config\
Test
Right click the OpenVPN tray icon and select "Connect". It will open a status window showing the connection progress, and if everything is working ok then the status window should close and the icon should turn green.
To test the connection, try pinging 10.8.0.1 (the server VPN IP address), 192.168.0.1 (the server LAN IP address), the address of a PC on the remote LAN (e.g. 192.168.0.123), and then try pinging devices by name.
c:\> ping 10.8.0.1
c:\> ping 192.168.0.1
c:\> ping 192.168.0.123
c:\> ping widget
NOTE: Taken from http://www.runpcrun.com/howtoopenvpn
Thursday, February 14, 2008
Installing Lighttpd With PHP5 And MySQL Support On Fedora 8
Tuesday, December 25, 2007
Formatting & Partioning Hard disks
Before you use fdisk to create or revise partitions, you should check your free space and the partitions that are currently mounted. You can do this with df and mount commands. The following example illustrates how the df command displays the total, used, and available free space on all currently mounted filesystems.
Note the numbers under the 1k-blocks column. In this case (except for the mounted DVD), they add up to about 35GB of allocated space. If your hard drive is larger, you may have unallocated space that you can use for another partition. Just remember to leave room for expansion in appropriate directories, such as /home, /tmp, and /var.
[root@Enterprise root]# df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
9903432 2333948 7058304 25% /
/dev/hda3 101105 19821 76063 21% /boot
tmpfs 451200 0 451200 0% /dev/shm
/dev/mapper/VolGroup00-LogVol02
4951688 149164 4546936 4% /home
/dev/md0 302684 10326 276730 4% /tmp
/dev/mapper/VolGroup00-LogVol03
4951688 194308 4501792 5% /var
/dev/hdc 7384 7384 0 100%
/media/Red Hat Enterprise Linux Server
/dev/hda2 11715984 9509432 2206552 82% /DosD
[root@Enterprise root]#
The second command, mount, includes the filesystem type. In this case, examine the partition represented by device /dev/hda2 mounted with the VFAT file type on the /DosD directory. It provides direct access to the D: drive of the Windows operating system. For the following example, I've set up the data shown from the mount command in columns for clarity.
[root@Enterprise root]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda3 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
/dev/mapper/VolGroup00-LogVol02 on /home type ext3 (rw)
/dev/md0 on /tmp type ext3 (rw)
/dev/mapper/VolGroup00-LogVol01 on /var type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/hdc on /media/RHEL-5 i386 Disc 1type iso9660 (ro,noexec,nosuid,nodev,uid=500)
/dev/hda2 on DosD type vfat (rw)
[root@Enterprise root]#
One of the benefits is that you can move and copy files between the Linux and the DOS partitions using standard Linux commands. You cannot, however, run any Windows applications within Linux unless you run a DOS or Windows emulation package such as Wine (www.winehq.org) or CrossOver Office (www.codeweavers.com).
The fdisk Utility
The fdisk tility is a universally available tool that you should know well. There are many commands within fdisk, more in expert mode, but you need to know only the few discussed here.
Though you can modify the physical disk partition layout using many programs, this section explores the Linux implementation of fdisk. FDISK.EXE from DOS has the same name and is also used for creating partitions, but it doesn't incorporate any Linux-compatible features. It also uses a different interface.
Using fdisk: Starting, Getting Help, and Quitting
The following screen output lists commands that show how to start the fdisk program, how to get help, and how to quit the program. The /dev/hda drive is associated with the first PATA/IDE drive on a regular PC. Your computer may have a different hard drive; you can check the output from the df and mount commands for clues.
As you can see, once you start fdisk, it opens its own command line prompt:
# fdisk /dev/hda
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): q
There are a wide variety of commands associated with fdisk and more when you run the x command to access fdisk's extra functionality.
Using fdisk: In a Nutshell
At the fdisk command line prompt, start with the print command (p) to print the partition table. This allows you to review the current entries in the partition table. Assuming you have free space, you then create a new (n) partition, either primary (p) or logical (l). If it doesn't already exist, you can also create an extended partition (e) to contain your logical partitions. Remember that you can have up to four primary partitions, which would correspond to numbers 1 through 4. One of the primary partitions can be redesignated as an extended partition. The remaining partitions are logical partitions, numbered 5 and above. The Linux fdisk utility won't allow you to create more than 16 partitions on the drive.
When you assign space to a partition, you're assigning a block of cylinders on that hard disk. If you have free space, the fdisk default starts the new partition at the first available cylinder. The actual size of the partition depends on disk geometry; do not worry about exact size here.
Using fdisk: Deleting Partitions
The following example removes the only configured partition. The sample output screen first starts fdisk. Then you print (p) the current partition table, delete (d) the partition by number (1 in this case), write (w) the changes to the disk, and quit (q) from the program. Needless to say, do not perform this action on any partition where you need the data.
# fdisk /dev/hdb
Command (m for help): p
Disk /dev/hdb: 255 heads, 63 sectors, 525 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 525 4217031 6 FAT16
Command (m for help): d
Partition number (1-1): 1
This is the last chance to change your mind before deleting the current partition. If you want to change your mind, exit from fdisk with the q command. If you're pleased with the changes that you've made and want to make them permanent, proceed with the w command:
Command (m for help): w
You did it! Now you have an empty hard disk or hard disk area where you can create the partitions you need.
You no longer have to reboot to get Linux to read the new partition table. Now, the partprobe command rereads the partition table without a reboot.
Using fdisk: Creating Partitions
The following screen output sample shows the steps used to create (n) the first (/boot) partition, make it bootable (a), and then finally write (w) the partition information to the disk. (Note that although you may ask for a 100MB partition, the geometry of the disk may not allow that precise size, as shown in the example.)
# fdisk /dev/hdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
First cylinder (1-256, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (2-256,def 256): +100M
Command (m for help): a
Partition number (1-4): 1
Command (m for help): p
Disk /dev/hdb: 255 heads, 63 sectors, 256 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 12 98163 83 Linux
Command (m for help):
Repeat the commands to create any other partitions that you might need. One possible group of partitions is illustrated here:
Command (m for help): p
Disk /dev/hdb: 255 heads, 63 sectors, 256 cylinders
Units = cylinders of 16065 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 2 16044 83 Linux
/dev/hdb2 3 18 64176 82 Linux swap / Solaris
/dev/hdb3 19 169 1203300 83 Linux
/dev/hdb4 170 250 649782 5 Extended
/dev/hdb5 170 201 248682 83 Linux
/dev/hdb6 202 257 449232 83 Linux
Command (m for help): w
| On the Job | The number of blocks that you see may vary slightly depending on the size of your hard disk; the number of heads, sectors, and cylinders on that disk; as well as the version of fdisk that you're using. |
Using fdisk: A New PC with No Partitions
After installing Linux on a new PC, you'll want to use fdisk to configure additional physical disks attached to the system. For example, if the additional disk is the first disk attached to the secondary IDE controller, run the fdisk /dev/hdc command. Remember the limitations on partitions. If you need more than four partitions on the new physical disk, configure type Primary for the first three partitions, and then Extended for the rest of the disk as partition 4. You can then creating logical partitions 5–16 within the extended partition.
Using fdisk: Creating a Swap Partition
You need to create a partition before you can reassign it as a swap partition. At the fdisk prompt, run the l command. You'll see a large number of file types, listed as hex codes. When you create a partition, fdisk creates a Linux Native type partition by default. As you can see from the output of the l command, the associated hex code is (83).
It's easy to reassign a partition as a swap partition. Run the p command. Remember the number of the partition you want to change. Make sure that partition doesn't contain data that you want to save.
Now run the t command. Type in the number associated with the partition that you want to change. Type in the hex code for the type you want-in this case, 82 for a Linux swap partition. For example, I could run the following sequence of commands to set up a new swap partition on the second IDE hard drive. The commands that I type are in boldface. The details of what you see depend on the partitions that you may have created. It'll be a 1GB swap space on the first primary partition (/dev/hdb1).
# fdisk /dev/hdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10402, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-10402, default 10402): +1000M
Command (m for help): p
Disk /dev/hdb: 5368 MB, 5368709120 bytes
16 heads, 63 sectors/track, 10402 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 1 1939 977224+ 83 Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
The fdisk utility doesn't actually write the changes to your hard disk until you run the write (w) command. You have a chance to cancel your changes with the quit (q) command. To make sure Linux rereads the partition table after fdisk writes it, run the partprobe command
