Archive for July, 2008

Must-Have CentOS Repos

July 23rd, 2008 No comments

While CentOS stability is great, some packages are considerably behind those available in Fedora. EPEL and Dag provide a great selection of backported RPMs.

To install EPEL:

rpm -Uvh

And Dag:

rpm --import
rpm -K rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -i rpmforge-release-0.3.6-1.el5.rf.i386.rpm

And Remi:

rpm -Uvh remi-release-5.rpm
Categories: Uncategorized Tags:

Amazon EC2 Stuff

July 23rd, 2008 No comments

Bundle EC2 image and save it to S3 :

/etc/init.d/mysql stop # make sure mysql is not running

ec2-bundle-vol -d /mnt -k /mnt/<your pk>.pem 
    -c /mnt/<your cert>.pem -u <your AWS account name> -r i386
ec2-upload-bundle -b <your-s3-bucket> -m /mnt/image.manifest.xml 
    -a <your AWS access key ID> -s <aws-secret-access-key>

register your AMI :

ec2-register <your s3 bucket>/image.manifest.xml
Categories: Uncategorized Tags:

Share a Console using “screen”

July 16th, 2008 No comments

This is too good to risk losing so I’m reproducing the recipe here.
For my needs, I was able to skip a few steps by using root and by using screen session ids.
Here is the original article (with a couple of minor changes):

Assume user jsmith wants to share his terminal session with remote user bjones for training or troubleshooting purposes, but does not want to use VNC or other full-blown GUI remote control access.

– GNU Screen
– Local account on host computer for remote user (i.e. bjones requires local account)

1. Install screen

sudo apt-get install screen

2. Set the screen binary (/usr/bin/screen) setuid root. By default, screen is installed with the setuid bit turned off, as this is a potential security hole.

sudo chmod +s /usr/bin/screen sudo chmod 755 /var/run/screen

3. The host starts screen in a local xterm, using the command screen -S SessionName. The -S switch gives the session a name, which makes multiple screen sessions easier to manage.

screen -S screen-test

4. The remote user (bjones) uses SSH to connect to the host computer (jsmith).

ssh [email protected]

5. The host (jsmith) then has to allow multiuser access in the screen session via the command CTRL-A :multiuser on (all ‘screen’ commands start with the screen escape sequence, CTRL-A).

CTRL-A :multiuser on

6. Next, the host (jsmith) must grant permission to the remote user (bjones) to access the screen session using the commadn CTRL-A :acladd user_name where user_name is the remote user’s login ID.

CTRL-A :acladd bjones

7. The remote user can now connect to the hosts ‘screen’ session. The syntax to connect to another user’s screen session is screen -x host_username/sessionname.

screen -x jsmith/screen-test

DOS to Unix Text Conversion

July 6th, 2008 1 comment

Every once in a while archives contain DOS formatted text files – they contain carriage returns in addition to Unix-style linefeeds. Depending on the project, these may cause all sorts of subtle problems.

The following command recursively strips carriage returns from all files in this and lower folders.

find . -type f -exec dos2unix '{}' ;
Categories: Uncategorized Tags: , , ,