- Linux Training
- Desktop Tutorials
- Server Tutorials
|Create a Backup Server|
|Desktop Training - DSL|
Project: Create a BackUp Server
There is one thing that every user needs, decent backup. Yet, many people fail to see the value until it is too late. This project involves creating a backup server from an old Pentium 133 with 128 RAM. If you do not have one, your neighbor probably does. It seems everyone is looking for ways to use old hardware.
Actually you can use a 486. RAM should be 16 MB or more. The computer will need an network card so you can transfer backups to the server. The size of the hard drive is determined by what you have and how much you will backup.
The hub allows you to connect several computers into a network so you can share printers, backup, etc. In the example you see the hub connects everything.
Install DSL on the Server
Step One: Boot the Live CD
You will need the Live CD to be running on the computer to install to the hard drive.
Step Two: Create Partitions
First you need to become root on the system. You will completely destroy all information on the computer so backup anything that you need! The command to change to root is:
You will see a new prompt to indicate that you are root. Now you need to create the partitions for the operating system to be placed on.
Creating a Partition
You must be root to complete this process.
Print the partition entries - see what is there before you begin the process.
It is always a good idea to verify that what you are about to destroy is what you want to destroy. No doubt about it, if you partition it all information will be gone.
Now you can see what partitions are there. The next step is to use fdisk to change the partition setup.
Now you should see the partitions as well as a command prompt for fdisk.
Command (m for help):
Type m to see the command list.
Delete unwanted partitions
Once you have verified that you want to get rid of the existing partitions, use the d option to delete them.
Partition number (1-4): Enter the number that is the partition you want to remove.
Type the p command to print out the current status, you should see that the partition you selected has been removed.
Create new partitions
Before you create new partitions it is important that you ask yourself what you want to do on the drive, is it a workstation or server, each will have different needs. Use the n option to create the new partitions.
Command action e extended
p primary partition (1-4)
For DSL you want two partitions, both to be primary partitions, 1 and 2. The first partition will be used for a swap file and the second will be used to install DSL on. This assumes there is nothing else on the disk.
Because you want both to be primary partitions choose p and then choose 1 to setup the first partition. When it ask to start at the first cylinder of the disk just select Enter to take the default. The last cylinder will determine the size, choose a size about twice the size of your existing RAM. You can enter the size in megabytes by using a +128M or similar. +128M creates a 128MB partition.
Follow the same process for the second partition except this partition you want to take the remainder of your disk. This will be your 2nd primary partition on the drive and you will then hit Enter for both the start of the cylinder and the end to take the rest of the disk. Now use the p option and you should see something similar to this:
/dev/hda1 1 122 491872+ 83 Linux
/dev/hda2 123 788 2685312 83 Linux
In this example the start for hda1 is 1 and it ends at 122 while hda2 starts at 123 until the end of the disk. The 83 number tells you that the ID for these partitions is Linux. You will need to change one to a swap format.
Verify partition types
View the partition types that you may need with the l option and then check that each of your partitions is the correct type.
The first partition will need to be changed to 82 which is the ID for swap. The t option is used to change the format. When you use t fdisk will ask for which partition. It should be the first smaller partition. Then it will ask which hex code and the number is 82 for swap.
/dev/hda1 1 122 491872+ 82 Linux swap
/dev/hda2 123 788 2685312 83 Linux
Type the p option to view your partitions, you should see one is swap like the example above.
Write the information to disk
Nothing has changed on the drive until you use the w option, then all the information that you have created will be written to the drive. When you write to disk using the w option it will be forever changed!!!!!!! So be careful you have a backup. Once you use the w option you will see the disk syncing. You may have to restart to get both partitions setup.
Now you may begin the installation of DSL on the disk. You will use the first partition for swap and the second for DSL.
Turn Swap on
Use these two command to turn on swap.
Start the Install
Use this command to get the process going.
You will be asked where to install DSL, on what partition, be sure to choose hda2. You will also be asked if you want a standard or enhanced desktop, choose standard. When asked if you want to use the Rieser file system choose no if you are using a slow machine, which you probably are. Finally, do the LILO boot (mkliloboot) when asked.
That should do it, restart and you should be up and running.
Setup the Network IP Address in Server
If you have a network card in your server, not wireless card, then open the DSL Control panel and select Netcardconfig. The setup for a network card with Netcardconfig is straightforward. Do not use DHCP, setup a static IP Address instead.
When you enter a static IP Address notice first of all that the first network card detected on your computer is eth0. The second one would be eth1, etc. The IP ranges 192.168.1-10.0 can be used for internal networks so you will need to use one of those networks unless you have a static IP Address from your ISP.
In the example, you see that the network chosen is the 192.168.5.0 network which gives you 255 IP Addresses. The individual DSL computer in the example is given 192.168.5.33 (set it to 192.168.5.76 if you are following the server example) and the gateway, which is a router in this case, has an Internal IP Address of 192.168.5.1. The external IP Address that is given is called a public IP Address and is routable so it can be used on the Internet. Note that this public IP Address must be given to you by your ISP you just cannot use anyone you want. The concept of a gateway is that you are telling your DSL computer that when it needs to go outside your local network to the Internet it should go to the 192.168.5.1 address.
The network mask that is shown in the example allows for you to use up to 255 IP Addresses on your internal network. Most of the time people will use this subnet because it allows for so much expansion.
The default broadcast address is seen below and you should maintain that IP Address for broadcast.
Here is the Default Gateway, or the inside IP Address of your router.
The Nameserver is the the server that your computer will use to resolve IP Address to domain name. DNS, Domain Name Services, manages the mappings between host names, like cnn.com, to Internet addresses, (like 126.96.36.199). The host names exist because it is easier for humans to remember the host name rather than the number.
Every host name must have a registered DNS server so that the resolving of hosts to IP numbers can occur. In fact, DNS is used by all of the networking processes and programs including web browsers and FTP.
Your ISP (Internet Service Provider) can provide you will a DNS server that you can use.
That should complete your network card configuration.
Start the SSH Server
The DSL Control Panel provides a simple button to click which runs a script activating the SSHD Server. Once the SSH Server is activated it is probably a good idea to modify your
When you view the default
ssh sshd : ALL@ALL : ALLOW
ALL : 127.0.0.1 : ALLOW
ALL : ALL@ALL : DENY
To restrict connections to a single, a network or a number of IP Addresses, change the file to this:
This limits to just one IP Address.
This will limit to an entire network. This way any computer on your network could use it as a backup server.
SSHD: 192.168.5.78 192.168.5.77
This will limit connections to the two IP Addresses listed.
The reason to limit connections is that it provides an additional layer of security in that you limit the locations that can connect to your SSH server.
Once your SSH Server is running and the network is connected physically. You can test your connection to the server using ping. Since the server IP Address in the example is 192.168.5.76 you would use this command from one of the workstations:
mike@qa:~> ping 192.168.5.76
PING 192.168.5.76 (192.168.5.76) 56(84) bytes of data.
64 bytes from 192.168.5.76: icmp_seq=1 ttl=128 time=1.38 ms
64 bytes from 192.168.5.76: icmp_seq=2 ttl=128 time=0.643 ms
64 bytes from 192.168.5.76: icmp_seq=3 ttl=128 time=0.433 ms
Use Ctrl+c to stop the pings.
From this output you see that the network is working OK and there is a connection. If you do not see the times like 1.38 ms then you will need to check network connections and network card setups.
Transfer Files Using SSH
Format for scp command
Example: (transferring the file test.txt to myserver.com for john)
Notice the : after the server name and then the file directory which the user must have rights to. One common mistake is that you should designate the user that you are connecting to the server as, for example dsl. So to connect to a DSL server use:
Creating a Simple Script for BackUp
This example is a backup script that can be used to back up an entire directory to another server. This script will recursively copy the folders and their contents as well as preserve the permissions on each file to a directory on the remote machine.
Establish a connection with the ssh command and then run this script.
This will backup all of fredś home directory to the backup server in the /home/dsl directory.