Linux

What Version of Linux am I Running?

I sometimes work on client's servers where the installed distribution and version of Linux are unknown at first. How do you find out which version of Linux is installed? Well, each distribution is different, so it may be necessary to try all of the following.

Determine the Installed Version of Redhat-based Systems


cat /etc/redhat-release

Determine the Installed Version of Debian


cat /etc/debian_version

Determine the Installed Version of Ubuntu


cat /etc/issue

or


cat /etc/lsb-release

How to Regain Root Password Using Grub Commands

From http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=827712&admit=-682735245+1152513688084+28353475

interrupt the grub loader (hopefully you've got a pause there) by just hitting the arrow key around at the menu choice for the grub loader - this will make the timer countdown stop.

Then,
go to the line that holds your choice of the Linux load you want and hit "e" (for edit). This will bring you into an editor for the current load command. Choose the line you want ( I can't remember which one you need off the top of my head - there's probably two - try it on both), and hit "e" once again. Now, you should be editing a single line of the loader. Arrow key to the end of teh command and and the parameter "single" to the end of the line. Hit enter to "save" (only in the buffer - not on the disk) the command.

Ubuntu Dapper Install on Intel Centrino Laptop with on-board ATI Graphics

1. Install Ubuntu.
2. Run all updates from Synaptic.
3. Install Automatix

Edit /etc/apt/sources.list

deb http://www.beerorkid.com/automatix/apt dapper main

Import key

wget http://www.beerorkid.com/automatix/apt/key.gpg.asc
gpg --import key.gpg.asc
gpg --export --armor 521A9C7C | sudo apt-key add

Install

sudo apt-get update
sudo apt-get install automatix

4. Run Automatix

Choose the following:
- Thunderbird 1.5
- DVD Codecs
- Music players and codecs
- Flash
- Java 1.5 JDK and JRE
- nVidia Card Drivers
- Web editing and code tools

Ubuntu Dapper Install on Dual-Core AMD with nVidia Graphics

1. Install Ubuntu.
2. Fix Grub


title Windows XP
root (hd0,0)
savedefault
makeactive
chainloader +1

3. Install Automatix

Edit /etc/apt/sources.list

deb http://www.beerorkid.com/automatix/apt dapper main

Import key

wget http://www.beerorkid.com/automatix/apt/key.gpg.asc
gpg --import key.gpg.asc
gpg --export --armor 521A9C7C | sudo apt-key add

Install

sudo apt-get update
sudo apt-get install automatix

4. Run Automatix

Choose the following:
- Thunderbird 1.5
- DVD Codecs
- Music players and codecs

Resizing an LVM Partition on a Live Server

I recently ran out of space in an lvm partition on a server I manage. I needed to grow the partition with minimal interruption. Here's what I did.

First, I used the lvextend command to grow the logical volume.


lvextend -L +4G /dev/vgname/lvname /dev/hda4

That assigns 4 gigs of space from the physical volume hda4 into the lvname logical volume.

After this step, that extra space is still not usable because the filesystem has not been resized. Resizing the filesystem is done with the following steps.

Note: These steps are specific to ext2/ext3 filesystems. These steps are dangerous. At the time this procedure was done, the volume was completlely full, and problems were already occuring in applications using the volume. This solution represents a brute-force, as fast-as-possible solution to the issue. The good news is that it worked for me, and only minimal data was lost.

Setup Requirements

Install mysql:


apt-get install mysql

Set root password for mysql


mysqladmin -u root -p password NEW_PASSWORD

Create new client super-user


nml_clientadd superusername

Create client user


nml_useradd superusername username

Java SDK Installation on Ubuntu

Installing the Sun JDK on Ubuntu requires building your own .deb package for it. Thankfully, this is a simple process.

First, install the package building tools.


sudo apt-get install fakeroot java-package

Now download the binary from http://java.sun.com.

Finally, make a .deb package of the binary file. Do not run this command as root, the fakeroot tool builds the package as if by root. You'll need to be root when you install it.


fakeroot make-jpkg jdk-1_5_0_06-linux-i586.bin

Then install the package (as root).


sudo dpkg -i sun-j2sdk1.5_1.5.0+update06_i386.deb

Enabling Apache Modules in Ubuntu

Ubuntu uses a nice symlink system to enable and disable apache modules. To enable a module. Use this simple command:


sudo a2enmod %module_name%

To disable one:


sudo a2dismod %module_name%

Troubleshooting PHP Include Failures on SUSE10

All PHP includes were failing in my Drupal application on a newly configured SUSE box. After verifying all the permissions, I found that the php.ini file had an extra-secure
include_path variable. Unlike most other distributions it doesn't allow relative path includes. To change that, just modify the
include_path variable like so.

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
include_path = ".:/php/includes"

The change is subtle. Notice the dot before the colon. That

Enabling mod_rewrite on SUSE Linux 10.0

SUSE's distribution of Apache does not enable mod_rewrite by default. To enable it, edit
/etc/sysconfig/apache2 as root. Look for the uncommented APACHE_MODULES variable, and add
rewrite between the quotes.