Recently I was working on a script for log reporting. You know, one of those handy little guys that send you some info every day helping to make sure you keep up with whatever it is that you don’t want to forget about. Well, some of the data was in a plain old text file, and there is nothing wrong with that. It’s easy to simply cat the file and pipe it through mailx or mutt, no fuss, no muss.
LightScribe On Linux and AMD64
Here we go with more work on my Alienware box where I ripped out Windows Vista and installed Ubuntu (8.04 Hardy Heron). I haven’t looked back since … ok, I do miss some games that don’t like Cedega or Crossover, but it’s a small price to pay for all of the other benefits I get from running Linux, and especially Ubuntu which is based on Debian.
One of the things that I got with this box was a LightScribe compaible DVD-R/CD-R. This is great, except I didn’t have any clue how to get it to work in Linux. After some digging on the net and reading all around, I got it working and boiled the steps down to a concice recipe.
These steps are listed below. Please note that these *should* work for 32 or 64 bit distros, but specifically I am running AMD64, so part of this was to get over that hump. Details are below with the commands.
Installing a LAMP Stack on Ubuntu
I am using Ubuntu (Hardy Heron) as my primary desktop OS, and I wanted to install some tools for doing development work. At the same time, I thought I might run through the steps and post them for anyone else that might be looking to do the same thing. I’ll walk you through what I am doing, it’s your typical Linux Apache MySQL PHP (LAMP) stack.
First off, you can use sudo to run these install commands as your own local user, by putting sudo before each command, but I find it easier and more concise to simply use sudo to become root and install that way. I will write this article from that perspective, so if you don’t want to do this as root, simply put sudo before each command here.
You can become root by using this command from a terminal session:
sudo su -
Now that we are root, let us install MySQL which will be our database server:
apt-get install mysql-server
Next, let’s install Apache for our web server:
apt-get install apache2
In my case, I am developing in PHP, so we need to install PHP for Apache:
apt-get install php5 libapache2-mod-php5
Last but not least, if you want a nice database manager, get phpMyAdmin:
apt-get install phpmyadmin
If this is not a box that you have KVM (Keyboard, Video, Mouse) access to, and you will be connecting remotely, you will need to install the OpenSSH server so you can ssh into the server. Do this like so:
apt-get install openssh-server
Once installed, you should be able to log into the server with your user account. Please note that by default, you cannot log in as root via ssh. There you have it, now start writing some cool code!
Rsync R Your Friend
Need to sync some files? Locally or remotely? How about re-thinking an old friend, rsync?
You may be like I was, and have discounted rsync for a long time due to the security risk imposed by running the “r” daemon on your servers. Guess what? You can not only use rsync to sync up local directories on the same server (this can be real handy for backups), but you can also sync from one server to another via SSH rather than the rsync daemon. This would be much like scp, only you can sync whole directory trees.
So. Let’s say you want to sync two local directories, how would you do that? Well, if we are syncing /export/datadir to /export/backupdir it would look something like this:
rsync -aruv /export/datadir/ /export/backupdir/
It’s just that easy. Now, those command line switches, what do they do? Check it out:
a = archive r = recursive u = skip files that are newer on the receiving end v = verbose, tell me what's going on
There is another one that is good when syncing between two separate servers, and that is the “z” switch. This tells rsync to use compression during the file transfer thus saving bandwidth. Let’s see what the above would look like from one server to another, as if you are running the command from the server you are syncing to:
rsync -aruvhz --progress server1:/export/datadir/ /export/backupdir/
There are a couple other options there, did you notice? I have added the “h” which tells rsync to output information in human readable format (GB, MB, K, etc), and the –progress which tells rsync to report exactly that, the progress of each transfer. You can use these with local transfers too, mix and match as you see fit.
Ubuntu Desktop Tricks
Anyone that saw how cool Beryl was on older Ubuntu releases will appreciate this. It appears that Beryl has merged with Compiz and thus isn’t available for Ubuntu Hardy Heron (8.04) like you might be used to. That’s because it’s actually enabled by default! If your system has an Nvidia card, and you have the “Restricted drivers” in use, you can right click on the desktop and choose “Change Desktop Backround”. On the “Visual Effects” tab, you can enable the “Extra” settings. This gives you some great effects for your windows and desktop by default, but what if you are like me and want more, especially to dig in and tweak it just the way you want it? Glad you asked …
Pull up a command prompt and install the Advanced Desktop Effects Settings manager, after making sure you are fully up to date:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install compizconfig-settings-manager
Once complete, this should add the Advanced Desktop Effects Settings icon to the System -> Preferences menu. Click that puppy and go crazy! You can setup all kinds on nifty stuff now, enjoy.
Using VNC Viewer, F8 is your friend
This is just a quick tip for anyone that uses VNC, expecially on Linux. This works in TightVNC and maybe others too, it might be a VNC standard. When using the VNC viewer or client on Windows, you can right click on the title bar of the window to get some extra options, like sending Ctrl-Alt-Del to the host to log into a Windows box. When using this on Linux, right clicking on the title bar had no effect. Uh oh, how was I going to login to my Windows box? Well, I found that F8 will bring up the menu and allow you to do various things, including sending keystrokes to the host you are connected to. So, there you have it. When in doubt, try F8 when using the VNC viewer.