Xi6.org

Tag: linux

Move ubuntu buttons to right instead of left

by on Jan.27, 2011, under linux/ubuntu

To move the minimize, maximize and close buttons in ubuntu 10.x from the left to right, just use the following command. (You can change the order if you prefer):

gconftool-2 –set /apps/metacity/general/button_layout –type string menu:minimize,maximize,close

Leave a Comment :, more...

Openfiler – Rsync over SSH setup & How-to

by on Jan.12, 2011, under linux/ubuntu

Introduction

Openfiler is a nice little NAS box, but when it comes to setup and configuration you’re pretty much left on your own. There’s no good documentation (even the paid user manual is garbage – it only describes the various checkboxes and fields). The openfiler forums are littered with people asking the same questions you are… and getting no answers.

After hours of searching and messing around, I have rsync over ssh working on openfiler! (Yes, SSH is a requirement in order to secure the data transfer – we don’t want anyone sniffing the traffic and picking up… well, anything).

rsync over SSH on openfiler

LDAP Users & Groups

I’m going to go ahead and make the assumption you’ve successfully setup LDAP and have created a few users and groups. If not, I may write another article pertaining to LDAP as I know it may not be the easiest thing to understand and setup.

On my openfiler system I’ve setup various groups and users as follows:

example: (user-name.group-name)
user.local
backup.remote
external.untrusted

For this article we’ll be focusing in the user “backup” as part of the “remote” usergroup.

File Shares & Permissions

I’ve setup a share called “BACKUPS” which is located at /mnt/volume-group/volume/BACKUPS

I’ve set the remote group as the primary group (PG) and has read/write (RW) access. And have granted the local user read only  (RO) access, so that I’m able to access the share on my local network. (I don’t want to accidentally write things that could possibly screw up rsync at a later date).

Under the host access configuration (Which again I’m assuming you’ve setup “trusted” networks or the ip’s of your external servers/machines that you wish to have connect to your openfiler box). I’ve set my “Remote-servers” network to have Read/Write access to rsync. (Ignore the rsync options for now unless you have specific needs or issues later)

rsync daemon

You may have trouble enabling the rsync service/daemon from the web gui, no problem – login to the openfiler server and start it manually.

#/etc/init.d/rsync start

You may or may not get any errors, should be fairly easy to read the error output and fix as necessary. Below is what my /etc/rsyncd.conf file looks like:

port = 873

motd file = /opt/openfiler/etc/rsync.motd

[ volume-group.volume.BACKUPS ]
path = /mnt/volume-group/volume/BACKUPS
comment = rsync-comment
hosts allow =  192.168.1.1/27 192.168.2.1/29
hosts readonly allow =
auth use pam = yes
read only = no
write only = no
use chroot = no
max connections = 0
list = yes

modifying LDAP user for SSH

In order to properly use our LDAP user “backup” over SSH, we’ll first need to give him a proper home directory (as it’s currently set to /dev/null).

Searching for the user gives us some information:

ldapsearch -x uid=backup

Now in order to modify this user we’ll need to make an ldif file using your fav editor (Keep in mind you’ll need to use the options you’ve set on your openfiler LDAP – hint – accounts tab on openfiler shows the DN info):

#nano backup.ldif

dn: uid=backup,ou=People,dc=openfiler,dc=nas
changetype: modify
replace: homeDirectory
homeDirectory: /tmp

replace: loginShell
loginShell: /bin/bash

Enable SSH for LDAP user “backup”:

[root@backupsrv1 ~]# ldapmodify -W -x -D ‘cn=Manager,dc=openfiler,dc=nas’ < ./backup.ldif
Enter LDAP Password: ************
modifying entry “uid=backup,ou=People,dc=openfiler,dc=nas”

Router/Firewall setup – Port forwarding

On my router (wrt54g with tomato firmware), I’ve created a rule that matches the remote client ip (source) and forwards port 22 and 873 to my openfiler box (which iptables also allow those ports).

Remote Client Configuration (files sent from here)

Now onto the good stuff – we’re done with our setup, time to transfer some files from a remote machine to the rsync server.
rsync -avz -e ssh /home [email protected]:/mnt/volume-group/volume/BACKUPS/myserver1
This will prompt you for a password for the user backup. This is fine. We can add SSH keys to remove this prompt and add the command to cron. (I’ll cover this in a later article).
In the above command we’re telling rsync to use -a (archive mode) -v (increase verbosity) -z (compress file data) -e ssh (use the ssh protocol).
There is a difference in using trailing slashes at the end of the directory. I’m backing up my entire /home directory to a directory called /myserver1 (without the trailing slash it creates the directory /home under /myserver1) So we get /myserver1/home. If you add a trailing slash to /myserver1/, the contents of home are written directly into /myserver1/*.

Possible Errors

I’ve written this article after the fact – so I don’t have the countless errors I’ve encountered. Most of the time there’s no associated log output to help you figure out what’s going on. You’ll need to sorta understand how things work in order to better trouble shoot.
You can try running the rsync command without SSH on a few individual test files to make sure that rsync in itself is actually working properly. Then troubleshoot why it won’t work over SSH. (That’s why we modified the LDAP to give the remote user “backup” the ability to have a home directory on SSH) Otherwise we get errors about /dev/null not being a directory.
1 Comment :, , , , more...

Software RAID Ubuntu 9.04 Linux

by on Jul.16, 2009, under linux/ubuntu

Setting up software RAID is “fairly” easy. But first you must install the ALTERNATE installation CD for Ubuntu. (CentOS is pretty straight forward when you select “manual partitioning” in the GUI installer on the regular ISO).

Once you download and burn the alternate ubuntu ISO for your cpu architecture, boot it up on the machine you want to install. (Note: this will erase data on the drives, so make sure no external drives are connected, or any drives in the system you don’t want raided).

During the install, when you come to partitioning, select manual and delete the partitioning tables that currently exist on your drives so that each drive has “FREE SPACE” as the only option under the device.

I’m going to be setting up RAID5, which in my opinion is the best balance between performance and redundancy. (This box is going to be a media server / backup / desktop with three TB drives).

Now for my first device (HD) I’m setting up 3 partitions, (boot, root, and swap). I create the first primary partition of 100MB at the beginning of the drive and set the “use for RAID” where you might normally select ext3, boot, swap etc.  Also be sure to add the boot flag to this partition.

The second partition I setup as logical 6GB and “use for RAID” selected here as well. And the third I set the remainder as a primary partition and “use for RAID”.

I repeat these partitions on the remainder of the 2 drives so each of the 3 drives have identical partition tables.

Next we’re going to select “configure software RAID” that is at the top of the menu, and create a new MD (Multi Disk) device.

Keep in mind we have 3 partitions per disk, totalling 9. So we will have to create 3 MD devices in order to raid each partition.

Creating the first MD device we select RAID1 (mirroring) for the boot partition. This will allow the system to boot properly. (This single raid 1 is very important to our system functioning).

For number of active devices, we type in 3. And 0 spares. Selecting /dev/sda1, /dev/sdb1, and /dev/sdc1 in the device list.

We will repeat creating an MD for each “set” of partitions. (for a total of 3 times). But these subsequent partitions will be RAID5.

You will be presented with RAID MD devices showing up on the partition overview. This is when we will set these partitions to EXT3, SWAP etc…

The 100MB raid1 partition we will set up as EXT3 mounted at /boot. This raid1 will allow the system to boot and not throw a grub error 2 at us.

The 12GB raid partition will be set up as SWAP

And the 2TB partition will be set up as EXT3 mounted at root /

Once we have those set, we finish and write to partition table. It’ll format the drives, sync the arrays and install the OS.

After that’s all said and done it’ll want to reboot. And we’re finished!

5 Comments :, , , more...

Migrating Virtual Machine (VM) FROM esx to xen server

by on Jul.09, 2009, under linux/ubuntu

There seems to be a lot of posts and resources on how to migrate the other way around – but WHY?! Why would anyone want to migrate from Xen to ESX? I’ve had so many issues with ESX I’m spending thousands to create another server and migrate TO Xen!

At the time I needed a relatively quick deployment of a server which I could easily manage virtual machines etc. (Well ESXi seemed like the answer). With only about a week to get the hardware, install and send off, I managed to get it working (I can’t say installation was that easy considering the limited hardware support ESX offers).

Needless to say, after deployment I was noticing VERY poor disk performance. (Yes I installed vmware tools and all that garbage). I tweaked, re-tweaked, re-installed virtual machines, resource pools, etc etc… weeks and months go by trying to fix the piss poor performance. No one on the community forums could help – It seems everyone is running windows guests and suggesting a bunch of stuff that would never make a difference anyways. If i’m getting crappy performance with freshly installed Linux guests, something is wrong with the hypervisor (ESXi).

In any case, I can’t take it anymore – ESX has to go! Reluctant to spend another $3,000 in order to mirror the server (extended downtime to rebuild is not an option). Plus the fact that on ESX I had to install a VM specific to being the firewall for the machine. Why ESX doesn’t have iptables or any firewall/routing built in is beyond me. It’s very insecure without adding additional overhead with another virtual machine appliance.

So while I build a new server and install Xen, It’s so much better! WOOWWW! Not only does it have better features, the performance is about 4x better! I love being able to “template” a VM of a base install, then deploying it quickly and easily as a new machine. The performance is near native (I can’t tell the difference opposed to if it was a single server installed on bare hardware). Where as with ESX, I could notice the sluggishness.

Now onto the main point of this article: Converting a VM from esx to Xen!

This portion coming soon – please leave a comment if you’d like it sooner than later.

1 Comment :, , , , , , , , more...

Subversion client is too old to work with working copy ubuntu linux

by on Jul.05, 2009, under linux/ubuntu

Likely you have tried to do an an svn command on your working copy and it’s giving you the following error:

svn: This client is too old to work with working copy ‘.'; please get a newer Subversion client

Initially I had thought it was a version miss-match with how the repo was checked in, or the server client the repo was hosted with. But it just so happened that I had checked it out with a newer version initially, and then moved it to another box that had a lower subversion client.

In any case, doing a fresh checkout (svn co) on my working copy solved this issue for me. But you may also update your subversion client.

Leave a Comment :, , , more...

formatting a windows partition to linux (ubuntu)

by on Jun.13, 2009, under linux/ubuntu

There are many reasons why you may wish to format an existing windows partition over to linux, most commonly it seems to be users coming from a dual boot scenario and now wish to make the full switch to a better operating system (LINUX!). We all want to rid our computers of the nasty virus of microsoft – and dual booting will soon be a memory of the past – virtualization technology is becoming more and more popular.

So on with the show! Lets delete the windows partition and allocate that space to our nice ubuntu linux install. I love the fact that you never have to re-install linux to do such tasks.

Note: I always like to unplug or unmount all of my external drives to make sure I don’t accidentally select the wrong device

Lets grab a GUI tool (GParted)

sudo apt-get install gparted

From the command line lets run it

sudo gparted

A graphical interface will pop up showing you the partitions you have, as well as any unallocated space. (For me it looks like I might pick up an extra 5mb of unallocated space – sweet!)

I started off with an install of windows, so it’s taking up the first bit of my hard drive (/dev/sda1). And I should also note it contains a boot flag – which is important to booting into either my windows or linux operating systems when my computer starts. (If you don’t have a boot flag and proper boot loader, you wont be able to load anything when you turn on your system)

Select the windows partition (Mine is NTFS on /dev/sda1 with a boot flag)

Right click on the entry and “unmount” (if its not mounted, skip this)

Next right click and select DELETE! :)

Now click the Apply (along the top tool bar)

You should now have a large unallocated partition (or more accurately the size of your previous windows install). Great, things are feeling so much better.

Right click the unallocated disk space and select “new”

Select a file system of ext3 and create the partition as primary

Click apply

Depending on the size of the partition we just made, it may take a short while to format the new file system. Once that is completed we’re going to edit the boot menu that existed previously.

Open a terminal and type

sudo nano /boot/grub/menu.list

Towards the bottom of the text file you will see a windows entry similar to the following

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Windows Vista/Longhorn (loader)
root        (hd0,0)
savedefault
makeactive
chainloader    +1

Just delete that entry and save. (note if you changed the default boot sequence order, you may wish to set “default 0″ near the top of your menu.list)

Next we will mount the new partition to where we would like when the system starts.

sudo nano /etc/fstab

Add the following to the file (make sure the directory exists) – you can use any folder you wish, I like to keep “my” stuff in the /home directory

# /dev/sda1
/dev/sda1     /home/disk     ext3     defaults     0     0

If the directory is outside of your home (ie /home/username), you may need to change the permisions

sudo chown username.username disk/

Lets mount our new partition

sudo mount /dev/sda1 /home/disk

Excellent, all is good! we now have lots of extra space to add games, movies or whatever your heart desires!

Note: You may also want to add the boot flag to your linux partition mounted on / (if it didn’t have the boot flag to begin with). Just right click the partition entry in GParted and select manage flags (selecting “boot”)

When you restart your system everything should be A-OK. The new partition will automatically mount to the location you declared in the /etc/fstab file.

1 Comment :, , , more...

Apache web server slow to respond, Poor performance Ubuntu Linux

by on Mar.14, 2009, under linux/ubuntu

If you’re finding that when going to your web page it’s taking a little too long to make the connection, or its just running sluggsih – it may be trying to resolve your ip via a DNS lookup.

There are many performance tweaking options to tune your apache configuration, but I’m going to start by handling just this one.

Now by default HostnameLookups should be Off. And can be found in

/etc/apache2/apache2.conf
HostnameLookups Off

But you may also want to add it to the httpd.conf

/etc/apache2/httpd.conf

And restart apache

sudo /etc/init.d/apache2 restart

This may or may not fix your performance issues, but it sure did help me greatly! (Even though it was set to off in the apache2.conf file, adding it to the httpd.conf file increased my performance)

An interesting article you may find useful HERE

Leave a Comment :, , , , more...

Adding a static route in ubuntu linux

by on Mar.05, 2009, under linux/ubuntu

You may come across the circumstance where you have one ip subnet with a gateway ip on a different subnet.

Lets say for instance your static ip is 10.10.0.1 and you need to set the gateway as 9.9.0.1. After your initial setup of static ip, you may notice the destination is unreachable.

configure your static ip via command line

sudo nano /etc/netowork/interfaces

if you hapen to be using centos or fedora, you may use something similar to

system-config-network

(or)

setup

in ubuntu using the /etc/network/interfaces file

auto eth0
iface eth0 inet static
address 10.10.0.1
netmask 255.255.255.0
gateway 9.9.0.1

now while all looks right, you probably won’t be able to get online. You can restart your interface with

sudo /etc/init.d/network restart

if you add a custom route to the host and set the default gateway you should then be able to access something

sudo route add -host 9.9.0.1 eth0

sudo route add default gw 9.9.0.1

hopefully everything should be good to go! Make sure that your /etc/resolve.conf file has proper name servers for your isp.

nameserver 123.123.123.123

Now in order to make these changes persistant on startup/reboot you may add them to the /etc/network/interfaces file, but typically that has never worked for me across any distro.

What I do is add them to my rc.local file (which is executed after all other system modules are brought online).

sudo nano /etc/rc.d/rc.local

/sbin/route add -host 9.9.0.1 eth0
/sbin/route add default gw 9.9.0.1

This should help bring your network back online in case of power outage or reboot. Keep in mind that if you /etc/init.d/network restart you will likely have to manually add those routes by hand again. (no biggie).

To check your routing table just simply

route -n

Leave a Comment :, , , , more...

Change Computer Name / Host Name Ubuntu Linux (8.10)

by on Feb.19, 2009, under linux/ubuntu

If you want to change the computer name of your linux box, it’s quite simple. Use the following commands to ensure the name is changed.

sudo nano /etc/hostname

And then make sure your hosts file is updated with the new name as well

sudo nano /etc/hosts

I typically use nano (pico) because to me it seems more user friendly and intutive. You may use vi or any such editor you wish.

2 Comments :, , , , , more...

How To Connect To a VPN using Ubuntu Linux (8.10)

by on Feb.19, 2009, under linux/ubuntu

In order to connect to a VPN you need a few things. Firstly you’ll need to install a VPN client. (Openvpn being my choice).

sudo apt-get install network-manager-openvpn

Then on the network icon on your task bar, right click and select “edit connections”.

Clicking on the VPN tab should now show the add/import buttons available. Click either depending on the files you were given by your system administrator (or whomever). Enter all your settings and select all the key locations and click OK when done.

Close the network connections box and then you are able to left click on the network icon on the taskbar, going to “VPN Connections” and selecing the VPN you just created. (A little lock will show up with a swirly thing going around your icon!).

2 Comments :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...