Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

March 24, 2010

Backup for (Ubuntu) Linux

During all my toils of getting my development machine back up working (laptop using Eclipse to do a little Android development) I have been doing a lot of backups. And have had to struggle with it.

So where are the easy backup solutions for (Ubuntu) Linux lurking about? I need to do a backup to (and restore from) external media CDs or DVDs, preferably RWs. Which software handles that easily including blanking said RW medias, including DVD+RWs. And preferably is able to do multi-volume backups.

At this time I do not have a set backup routine for my pictures, mail, videos, etc. I do use Ubuntu One for some things but am limited to the free version and thus only 2 GB. So it is basically Ad Hoc backup for me.

Anybody have any good backup solutions? Please post in comments! (comments are no longer moderated in new (< 14 day old) posts)

October 28, 2007

HomeServer Part 5 - Initial configuration

In this instalment of the HomeServer series we will do the initial configuration of the HomeServer which will turn it into a working Firewall/Router.

Network interfaces

Only eth0 is configured properly. Eth1 is recognized by the kernel module and brought up but as it is not connected, it is not getting configured in the network configuration sub system. Luckily this is fairly easy to do.

Edit the file /etc/network/interfaces in your favorite editor. Remember to sudo your edit command. Otherwise the file is read only.

Leave the lo entry as it is. No reason to tempt fate by changing this.

Clone the eth0 entry and rename the device identifier with eth1. The config file should look something like this (bar the lo lines):

auto eth0 # Bring up eth0 automatically
iface eth0 inet dhcp # eth0 is an inet (TCP/IP) v4 based interface
# (as opposed to inet6 (TCP/IP v6), IPX etc protocols)
# It gets its network address, netmask, gateway,
# broadcast, DNS, etc address information from a
# DHCP server

auto eth1 # Bring up eth1 automatically

iface eth1 inet static # eth1 has a static address assigned by us
address 192.168.2.1
netmask 255.255.255.0

Then you can bring up eth1 by running ifconfig:

#sudo ifconfig eth1 up

DHCP Server

I Selected to install the dhcp3 server in my HomeServer. The configuration file for this server is located at /etc/dhcp3/dhcpd.conf. Open the configuration file with root capabilities and edit the following lines:

Comment out the ‘option domain-name’ line for now.

Uncomment the ‘authoritative’ line as our HomeServer is supposed to be the authoritative DHCP server on our local network.

Append the following lines at the end of the file to set up our network topology.

# Outside network (on eth0). No service provided
Subnet 10.0.0.0 netmask 255.255.255.0 {
}

Our sample network is 10.0.0.0 with a network netmask of 255.255.255.0. Please contact your ISP for the details of your setup. We are not going to provide any service to this network. We are just informing the dhcp daemon that it exists.

# Local network (on eth1)
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.129 192.168.2.250;
option routers 192.168.2.1;
}

If you have additional nets please add them accordingly, using the above as a template.

Back to the global variables in the beginning of the file. Change these lines to your suit your setup. If you like you can change the ‘option domain-name’ line. Please note that this will not change internet behavior outside of your local setup. I would advise you to raise the lease time to something close to 12 or more hours. Remember to add your domain name servers with the ‘option domain-name-servers’ line :

Option domain-name-servers x.y.z.q1, x.y.z.q2;

Add as many as you like that are available to you.

Shoreline Firewall (Shorewall) minimum setup

The configuration files for Shoreline Firewall is not ready in the /etc/ structure. You need to copy the appropriate default files and edit them to suit your setup. As our initial setup is a two interface setup we copy the default files from /usr/share/doc/shorewall/examples/two-interfaces like this :

#sudo cp /usr/share/doc/shorewall/examples/two-interfaces /etc/shorewall

This will copy all necessary files plus the file README.txt. For now I am keeping this file as its contents remind me which default setup I have copied.

Modify the Shorewall policy file (/etc/shorewall/policy) to allow the firewall machine (our HomeServer) to access the net. We need this in order to update our ubuntu installation. Change the line :

$FW net REJECT info

to

$FW net ACCEPT

I decided to comment out the old line to preserve what the default setting is in my config file, copied and modified the copy. Remember to remove the info keyword to avoid your log file being cluttered with lines stating that your firewall accessed the internet.

Initial configuration of Shorewall is now done. We will have to modify the Shorewall setup to allow access to our services, e.g. Samba (providing SMB - Windows File Server protocol), Apache (webserver), MySQL (relational SQL data base server) etc. running on the HomeServer.

We are not yet quite done setting up shorewall. Remember to enable startup in the /etc/shorewall/shorewall.conf file; edit the line:

STARTUP_ENABLED=No

to =Yes

Remember to allow Shorewall to be started on debian based systems (ubuntu and its cousins are based upon debian). Modify the file /etc/default/shorewall line:

startup=0

to =1

Remember to compile and start shorewall:

#sudo shorewall start

To check whether the rules has been set up use the command

#sudo iptables –L

Congratulations! You now have a working Router/Firewall setup – the first step on our road to a HomeServer!

Next time we will have a go at setting up the Samba server which provides the SMB protocol for serving files to Windows clients.

October 27, 2007

HomeServer Part 4 - Installation

A few things has changed during the last 5-6 weeks. I have been able to aquire some used parts to upgrade my HomeServer project. Thus the Hardware setup for this project is as follows :

CPU Pentium 4 2.4 GHz
RAM 640 MB DDR Ram
Motherboard Intel 845 Desktop Motherboard
NICs 2 x D-Link DGE-628T Gigabit
Graphics board GeForce 2 MX
TV Tuner BrookTree 878 Based card
Hard disk drives 160 GB Seagate Harddisk ATA
Optical drives 20x Lite-On DVD-RW drive
Power Supply Unit Trust 520W Pro PSU Low Noise Big Fan
Computer case Full Size “server” tower with
  • 3 internal 3.5” hdd bays
  • 1 external 3.5” floppy bay
  • 5 external 5.25” bays

The Graphics board and the TV Tuner are probably the oldest parts in this setup. The graphics board is mainly there because I need it during the initial install. Also most systems will not start without a Graphics board. The TV Tuner board is one that I have sitting idle in my desktop computer so the plan is to get some sort of Media Server part up and running too.

The optical drive was used for installation purposes as well and will be used in my backup plan. The current hard drive will serve both as the boot drive and main storage drive. I was contemplating whether I should partition it with one big root (/) partition and one /home partition or if I should keep a smaller root (/) partition together with /var and /usr partitions. I decided that a big root (/) partition was the way forward as it would allow for both root (/) /var and /usr to grow unproportionately without running into the situation where one partition lacks space and another has plenty of unused blocks.

Future hardware plans:
S-ATA RAID Controller
Hard disk drives 2 x 320 GB (at least) S-ATA in RAID 1 for /home user files

To safeguard personal data such as digital photos, documents, etc I plan to add a RAID 1 array based upon Serial ATA drives. This will, with the backup procedure safeguard important files. If a disk in the RAID 1 array fails, it will continue to run on the other drive. The faulty drive can be replaced and the RAID 1 array will recreate itself onto the new disk. Theoretically this should be possible online, on the fly so that both Data and Server is available as much as possible.

When the RAID 1 array is added it will host the user files in their /home directories. The main /home partition will then host the semi-volatile files such as MP3s created from our CD etc. collection.

Software:

Operating System Ubuntu 7.10 “Gutsy Gibbon” – server edition

Kernel Ubuntu vanilla kernel 2.6.22

Just shortly before I assembled the hardware, Ubuntu 7.10 code name “Gutsy Gibbon” was released (on oct. 18th 2007) so I decided to go with the server edition of this new Ubuntu. If you want long term support, or you are simply not comfortable with using the latest version and would rather go for the tried and tested version, I suggest You try the LTS version available to you (6.06 code name “Dapper Drake” at the time of writing this).

Ubuntu detected the IDE controller as a SCSI controller and gave the boot drive the designation /dev/sda.

The drive was partitioned into three parts :
Partition Mount point Type Size
sda1 / ext3 15 GB
sda2 swap 2 GB
sda3 /home ext3 143 GB

The Ubuntu server installer installed the core system. In addition I selected to install the following extra packages:

  • OpenSSH server - to allow remote system administration
  • LAMP server - Linux, Apache, Mysql, PHP. This will allow me to run easy web based administration modules as well as provide a test and development bed for web development.
  • Samba file server - to provide remote file storage for windows boxes
  • NFS file server - to provide remote file storage for *nix (mainly Linux) boxes
  • DHCP server - to provide network management
  • Shoreline Firewall - to provide protection from outside (and inside) attacks

During the install I selected to add just one user (jan). I will add more as they are needed. Remember that Ubuntu allows this admin user account to act as root by preceeding the commands with the command sudo. You will be prompted with a request for your password if you have not done sudo within the last 15 minutes.

I also added the procinfo, make, gcc and linux-source packages. Procinfo to provide process etc info. Make, gcc and linux-source to allow me to finetune the kernel on the server as well as other applications.

Next Blog will be on the initial configuration of the HomeServer

September 18, 2007

HomeServer part 3

I have been away from the post a couple of days. Other things had more urgency and/or priority.

Continuing on the HomeServer project:

I have had a look at the harddisk which will hold the very first instalment of the HomeServer project and although I thought I had an 8 GB drive it seems that it is only a 4.3 GB drive. This does not stop the project as this - initially - is more than we need.

Software needed:

first off we need a base on which to build everything on. As this blog is on Linux you have probably guessed that I will not choose Microsoft Windows (tm) for this project. But almost any *nix would be an excellent choice. Maybe one of the *BSDs around would have been the obvious choice but as I have no experience on BSD I would rather not choose that. Which leaves us with ; Linux.

I have tried a few Linux distributions and they have all had their contribution to making Linux a better product. But I am going to select ubuntu (http://www.ubuntu.com) for the job. This choice is made on the basis of three major reasons.

1. ubuntu is based upon debian which has a reputation of a conservative but rock solid distribution that is well proven and tested. Ideal for a server
2. ubuntu has newer versions of software bundled than debian. You might say that ubuntu is a solid performer with an edge.
3. ubuntu uses the .deb packaging system for updates.


The firewall
Linux has built-in firewall and routing capabilities right out of the box, ipchains up to kernel 2.4 and iptables since the 2.3 kernel series. administering netfilter though can be quite tricky and complicated.

I am currently researching shorewall and will post my findings in a later blog.

September 10, 2007

Welcome to my blog

Hi and welcome to my blog on Linux!

This blog will contain ramblings, tips, etc about and my experiences with Linux.

I have been using Linux for more than 6 years now and have had some experience with using it but little experience programming on the *nix platform. All this will change soon enough.

My Linux use has been both as a desktop and for server purposes both at home and at a few (small) installations that I have had the joy to administer.

Currently I am admin'ing a small internet cafe. This setup comprises of Windows machines (Win XP Home) as client machines, (Windows XP Home and Windows XP Professional) as administrative machines and Linux machines as server and firewall.

This cafe runs the SmartLaunch [SL] system (http://www.smartlaunch.net) which uses Windows as its platform for both clients, admin and server machines. The client machines needs to run Windows as they run the games that the public wants. The admin machines will most likely keep running on windows as this is what most of the employees know. My plans for the server is to move it to a Linux machine, that will partly run Samba to serve the WinBoxes with files, MySQL to serve the [SL] server with an SQL service and then I would like to move the [SL] server itself to a VMWare Virtual Machine running WinXP Pro on a Linux host OS.

Later a dedicated Gameserver for hosting CounterStrike, Day of Defeat, etc based games wil be added.